AppleScript Reference – Definitive Guide and Introspection Capabilities

applescript

Is there some canonical place I can find a reference for the scripting capabilities various things have in AppleScript?

For instance, I'd like to automate iTunes a little bit. Looking around on the web I see iTunes supports get album of current track and current track has several properties: name, artist, etc. But nowhere can I find a reference for all of iTunes' properties, or capabilities other than current track. That info may be on Doug's AppleScripts for iTunes somewhere, but then that's iTunes specific, I want a general reference for all apps.

Similarly, Google Chrome has some scriptability. How can I discover what it can do? It's a third party product and Google has written some of their own docs, but they seem incomplete.

A website AppleScript reference would be great. Even better would be if AppleScript has some introspection abilities so I can just ask iTunes itself what it supports with AppleScript code. (Honestly I hate the language, but it seems to be the only way to access a lot of neat things in MacOS apps.)

Best Answer

Most apps that can be scripted with AppleScript will have a dictionary you can open with AppleScript Editor (File > Open Dictionary). The app's dictionary will then list details for each of the commands and classes that can be used with it in an AppleScript script.

Creating an AppleScript dictionary is up to the app's developer, so you may occasionally come across apps with poorly documented, incomplete or outdated dictionaries, but it's still usually a good place to start.