roadrunnertwice: DTWOF's Lois in drag. Dialogue: "Dude, just rub a little Castrol 30 weight into it. Works for me." (Castrol (Lois))
[personal profile] roadrunnertwice
I got annoyed at something earlier today and decided to fix it, and FastScripts was once again the first tool I reached for, so I decided to finally shell out for it.

For the curious: I got sick of downloading PDFs I only intend to read once and then having them clog up the downloads folder, and I wanted a command to trash the file right from the PDF reader. (Preview isn't scriptable, of course, but you should be using Skim anyway.)

tell application "Skim"

set current_file to file of document of window 1

tell window 1 to close

tell application "Finder" to delete current_file

end tell

Depth: 1

Nice!

Date: 2012-05-25 01:47 am (UTC)
From: [personal profile] nadreck
Seems like a nice, fast script there.

As far as Preview not being scriptable: it adds a lot of its functions to Automator, but isn't technically scriptable itself. That said, any command that would qualify as an "Apple Event" (ie, open, close, switch to window, etc) is supposed to work whether the rest of the app is scriptable or not.