Enabling AppleScript in Apps like Preview.

Having just read this blog item in Daniel Jalkut’s blog (he’s the author of FastScripts), I thought I’d post a link here because it’s a way to make Cocoa apps respond at a fundamental level (like the name of the window).

See: Minimal Scriptability

I’ve tried it, and it works very nicely because the Cocoa framework handles the script request for ‘standard’ scripting items. It’s as if the app had just the basic framework of scriptability, but that’s better than none. If I figure it out, I’ll write an AppleScript to do it.

Heres a post from macosxhints http://forums.macosxhints.com/showpost.php?p=281059&postcount=6 about the same thing.

I suppose a simple defaults write do shell script would work…

Maybe he got the idea from you, Mark. Yours predates his. As the last poster in the thread you linked pointed out, Preview can often be made to respond to GUI scripting, for example in sizing a window, but I wanted to be able to get window names and hadn’t tried this (which works):

tell application "Preview" to activate
tell application "System Events" to tell process "Preview" to set N to name of window 1

I very much doubt it, but yer you caught me showing my tail feathers. my bad

Thats is neat, it is kind of like coercing an app