Ernest Lehman, 89, who died July 2 in Los Angeles after an apparent heart attack, was a Hollywood screenwriter of astonishing range: embittered drama ("Sweet Smell of Success"), sophisticated suspense ("North by Northwest") and the fearlessly sentimental ("The Sound of Music").

After four Academy Award nominations for his writing, he won an honorary Oscar in 2001 -- the first for a screenwriter -- for a "body of varied and enduring work."

Early in his career, Mr. Lehman was a Broadway press agent, journalist and short-story writer. His first screenwriting credit was for "Executive Suite" (1954), a tale of corporate intrigue so taut that the director, Robert Wise, did not need a musical track to heighten the tension.

Wise used Mr. Lehman on "Somebody Up There Likes Me" (1956), in which Paul Newman plays the thuggish boxing champ Rocky Graziano, and the musicals "West Side Story" (1961) and "The Sound of Music" (1965).

He adapted a string of Broadway successes, among them: Rodgers and Hammerstein's "The King and I" (1956); Edward Albee's "Who's Afraid of Virginia Woolf?" (1966); and the Jerry Herman musical "Hello, Dolly!" (1969).

Despite working from polished productions, Mr. Lehman said he made invaluable contributions to restructuring the plots.

He was credited with imagining the opening montage that sweeps over a mountain range in "The Sound of Music" and the sequence with a crop-dusting plane that terrorizes Cary Grant in "North by Northwest" (1959), one of his rare original scripts.

In the Alfred Hitchcock thriller, Grant played a much-divorced advertising executive with a flexible credo: "In the world of advertising, there's no such thing as a lie. There's only expedient exaggeration."

Falsely accused of murdering a diplomat, Grant goes on the run and meets a mysterious blonde played by Eva Marie Saint. One of Mr. Lehman's disappointments was that the censors would not let Saint tell Grant, whom she has just met in the train's dining car, "I never make love on an empty stomach."

The result was "I never discuss love on an empty stomach." And Mr. Lehman later said he found the change silly. "Now it would be nothing," he said. "It would appear on a kiddie show."

Ernest Paul Lehman was born Dec. 8, 1915, in New York. His parents were in the garment business.

At City College of New York, he studied creative writing because, he said, "I couldn't get myself to go out into the world of people and look for a job."

To earn money, he was briefly a press agent, trying to persuade Walter Winchell and other powerful columnists to print gossipy news about his clients. He pulled from this experience to write "Sweet Smell of Success," the story of a monstrous columnist and a slimy publicist that was first published as a short story in Cosmopolitan. In 1957, it became a film with Burt Lancaster and Tony Curtis.

He clashed with Lancaster, and plans for Mr. Lehman to direct were canceled. He fled for several weeks to Tahiti, professing a nervous breakdown. "I'm told that when I phoned in sick from the hospital, Burt grinned," he later said. "So he was perfectly cast as the columnist."

Nor did he like working with writer-director Billy Wilder to adapt the screenplay for "Sabrina" (1954), a romance about a chauffeur's daughter amid Long Island's smart set.

He successfully fought Wilder's demand that Audrey Hepburn, as the daughter, be shown sleeping with the far-older Humphrey Bogart in one scene.

Mr. Lehman spoke glowingly about Hitchcock, whom he met when they began work on an adaptation of a seafaring disaster film. Both men soon wanted to abandon ship, and their discussions evolved into "North by Northwest."

As part of his approach to writing, he visited the locations of scene settings. At one point, he visited what would be the film's climactic scene at Mount Rushmore.

"First I tried to climb Mount Rushmore," he told the Los Angeles Times. "That was a ridiculous procedure for a screenwriter. Halfway up, I looked down and realized I could be killed if I slipped."

After a string of award-winning films in the 1960s, Mr. Lehman made a disastrous directorial debut with "Portnoy's Complaint" (1972), based on the randy novel by Philip Roth. Returning to screenwriting, he wrote Hitchcock's final film, "Family Plot" (1976), and "Black Sunday" (1977), about a terrorist plot at the Super Bowl.

Films turned far too coarse for his taste, and he later turned down "The Silence of the Lambs," among other offers. He liked to say he was working on a memoir called "How the Hell Should I Know?: Tales From My Anecdotage" or "Names I Never Dropped Till Now."

His first wife, Jacqueline Shapiro Lehman, died in 1994. He married Laurie Sherman in 1997 after meeting her through an online chat room and wooing her as a friend with such lines as, "I like distant intimacy." He is survived by Sherman; two sons from his first marriage; a son from his second marriage; and two grandchildren.

Ernest Lehman and Alfred Hitchcock discuss the crop-duster sequence in "North by Northwest," one of Lehman's rare original scripts.