2

I have asked another question on AskDifferent about Preveiw scripting dictionaries, and have done a subsequent search here which says Preview is not scriptable.

However when I run:

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

end tell

It works. Does that mean that Preview.app is scriptable with Applescript 2.2.1 and Max OS X 10.7.5 which is what I am using?

If so then where can I find a listing of the objects?

Community
  • 1
  • 1
Deesbek
  • 865
  • 2
  • 12
  • 27

2 Answers2

5

All Mac applications respond to the Open and Activate commands even if they do not have dictionaries. Your script works because it exploits the built-in capabilities of any application. The absence of a dictionary means that you cannot query or manipulate open documents and windows (i.e. the application's data model).

However, you can use UI Scripting to select menu items, click buttons within windows, and send keystrokes to the application.

Mark Alldritt
  • 597
  • 1
  • 4
  • 9
2

You can find out what Preview's dictionary is by launching /Applications/Utilities/AppleScript Editor and choosing File>Open Dictionary from the menu bar, finding Preview in the list of applications shown there, and clicking Choose.

Chuck
  • 4,662
  • 2
  • 33
  • 55
  • Thanks, but there is no dictionary for Preview, and that is the whole point of my question. – Deesbek Nov 18 '13 at 17:39
  • 2
    Preview does have an AppleScript dictionary by default in 10.9 but not in earlier versions of OS X. – Lri Nov 18 '13 at 18:01
  • 1
    Yep, no dict in OS x 10.7.5 (got an older Mac with that) but in OS X 10.9 there is, containing 2 suites (Standard Suite, Text Suite) and some print settings stuff. –  Nov 18 '13 at 18:55