Journey to the Center of the Earth had its opening and closing scenes in Edinburgh. One of my relatives even appears in one of the crowds! In the film they are set in Edinburgh, though not the book I think.
I think some of the latest Greyfriars Bobby version was filmed in Stirling. Much of Trainspotting was filmed in Glasgow, though not set there (as is Rebus).
Movies filmed in Edinburgh (not necessarily set there), including Forth bridge -
Jude, Mary Reilly, Split Second, Margaret's Museum, Women Talking Dirty, Hallam Foe (all famous!)
Films SET in Edinburgh (not necessarily filmed there)...
I'm trying to think of ones, NOT on the list.
"Festival", now there's a real turkey. Please don't bother with it!
"Jekyll and Hyde" (many versions, story often transferred elsewhere)
As for books, Edinburgh has them coming out of its earholes, you barely need to ask. Scott, Stevenson... even Conan Doyle based much of "London" on Edinburgh as he knew it better.