Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is OSX Lion Preview application scriptable? [closed]

Is OSX Lion (or older OSX) release of Preview scriptable?

like image 397
P5music Avatar asked Dec 12 '11 12:12

P5music


People also ask

Does Apple still use AppleScript?

AppleScript is a scripting language created by Apple Inc. that facilitates automated control over scriptable Mac applications. First introduced in System 7, it is currently included in all versions of macOS as part of a package of system automation tools.

How do I close script editor on Mac?

Command + period (.) You can also kill (force quit) Script Editor and, provided it autosaves your documents, the scripts will be restored to the last compiled versions when you reopen.


1 Answers

Preview is not now, and have never been AppleScript-able, which does suck. It'd be nice if it were, though.

From this blog:

However, from 10.4–10.6 it was possible to enable the default Cocoa scripting support via these Terminal commands:

sudo defaults write /Applications/Preview.app/Contents/Info
NSAppleScriptEnabled -bool YES 

sudo chmod a+r /Applications/Preview.app/Contents/Info.plist 

This was sufficient to be able to get at the file of the current document to delete it, change its Finder label, import it into EagleFiler, etc. Under 10.7, modifying the Info.plist file breaks the application’s code signature. I would expect this to cause a harmless warning message in the Console, but it actually causes Preview to crash.

like image 90
Chris Cashwell Avatar answered Sep 19 '22 02:09

Chris Cashwell