Is there an Applescript dictionary for Preview.app? I am unable to find it under Mac OS X 10.7.5, and Applescript 2.2.1.

I did a rudimentary search in google and duckduck but came up empty.

I've also ran https://apple.stackexchange.com/a/40084/10733 however when I run it for Preview I am getting the following error:

tell application "Preview"
    get every property
        --> error number -1708
error "Preview got an error: Can’t get every property." number -1728 from every property

Where can I find the scriptable objects for Preview?

I have found several answers saying it is not scriptable, however I have not changed the NSAppleScriptEnabled preference and the following runs:

tell application "Preview"
    set save_location to ¬
        (choose file with prompt "Choose the png to be modified")
    open save_location

end tell

I've posted a separate question about why this runs on stackexchange.

My original question stands. Where/How can I find the scriptable objects?

  • It appears that Preview.app does not have a scripting dictionary and is thus not scriptable.
    – Daniel
    Commented Nov 18, 2013 at 15:50
  • Thanks for the edit, have not had first coffee yet. Just because something does not have a defined dictionary it does not mean it is not scriptable.
    – Deesbek
    Commented Nov 18, 2013 at 15:52
  • 1
    tell application "Preview" set save_location to ¬ (choose file with prompt "Choose the png to be modified") activate open save_location end tell
    – Deesbek
    Commented Nov 18, 2013 at 15:53
  • I haven't had any luck scripting Preview. I hope you find someone with a better answer; I'd look forward to reading it.
    – Daniel
    Commented Nov 18, 2013 at 15:53
  • That is a rudimentary file open which is working, but as I was trying to answer apple.stackexchange.com/q/111012/10733 I was trying to add text, which without a dictionary is just stabbing in the dark.
    – Deesbek
    Commented Nov 18, 2013 at 15:57

3 Answers 3


As markhunte said, NSAppleScriptEnabled is set to true by default in Preview's Info.plist in 10.9. So Preview has a basic AppleScript dictionary, and tell application "Preview" to properties works by default.

In 10.8 or earlier versions of OS X you can set NSAppleScriptEnabled to true manually:

defaults write com.apple.Preview NSAppleScriptEnabled -bool true

The open and activate commands also work with applications that don't have an AppleScript dictionary.


Preview.app is NOT made Scriptable by apple and as far as I am aware never has been.


It does appear apple have enabled scriptability in Preview.app

And I only say this is the case as I have a new install on a Macbook Pro that I know I have never change the Previews scriptability.

Never the less there is still no Preview.app suite.

I suspect (and I may have the facts wrong) this was because Preview.app was original only for previewing files and not an editor.

Although there are now more options to actually edit some file types in Preview apple have NOT made it scriptable.

This is not to say it cannot be made scriptable. AFAIK all cocoa app can be made scriptable if the developer creates a Scripting Definition File for it. To do this you would need to know the methods in the code of the application to define ( putting it simply)

You could even write the sdef file yourself if you know the method information.

You can make Preview.app scriptable by changing it's NSAppleScriptEnabled preference. But that is pretty much pointless as this would only list some of the standard suits. But Preview.app would know nothing about it's self.

  • Hi I have not changed NSAppleScriptEnabled preference but a short script I wrote, ran. See the edited question for the code????
    – Deesbek
    Commented Nov 18, 2013 at 16:46
  • updated answer in light of this..
    – markhunte
    Commented Nov 18, 2013 at 16:59

I would say that considering Automator contains scripted actions which are based in Applescript there is indeed a way to script Preview, just depends what you're trying to do.

Some perusing in the Automator actions section for Preview may yield good results. There are a number of tools I use such as rotation and scaling operations for batch processing which should be accessible to Applescript. Perhaps also Automator might prove a good method to get around not having direct Applescript access since you can embed Applescript in an Automator workflow.

Good hunting!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .