Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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 http://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?

share|improve this question
It appears that Preview.app does not have a scripting dictionary and is thus not scriptable. –  Daniel Nov 18 '13 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 Nov 18 '13 at 15:52
tell application "Preview" set save_location to ¬ (choose file with prompt "Choose the png to be modified") activate open save_location end tell –  Deesbek Nov 18 '13 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 Nov 18 '13 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 Nov 18 '13 at 15:57

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

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.

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.