Apple Script global dictionnary

Hello to all of who helping generously,

  1. Is there a reason why the detail provided in the application dictionary seem so technical and difficult to understand ?? Wouldn’t it be a good place to give example of the terminoly used and the way it could be used in scripts ??

  2. Is ther a global dictionnary of all (mostl) verbs used in Apple Script ??

  3. I am looking to a way to tell if an application is running or idle but open ??

Thanks in advance.

Robert Lespérance
Québec, Canada

I agree that dictionaries (by both Apple and other software supplies) are very difficult to twig. Why can’t they give some examples?

A good or even basic description of its grammar is AppleScript’s biggest lack. There are a number of AS guide books but none is comprehensive. A new one came out just this month (O’Reilley press?), I may add it to my collection.

I have been writing scirpts for years but not every day. So, between scripts I tend to forget the grammar. When I start a new script, I look in my Scripts folder for a proven script that does something similar and copy it. If that fails, I go online and search for a similar script. When I get the bells and whistles working on a frequently used procedure (reading/writiing text files, appending text, working with the clipboard, munging text), I isolate the code and transfer it to a library with my documentation – this way I can reuse it without having to relearn the grammar and testing a new script goes more smoothly.

  1. Dictionaries are simply dictionaries. Good developers will provide allways lots of documentation and live samples explaining its terminology. A cool example is the “oldie” Dialog Director, whose download includes lots of samples

  2. Take a look to the AppleScript Language Guide. It describes nearly all available terminology in plain AppleScript. Here is a copy of the AppleScript Suite, as a browseable dictionary:

    Will work also:

tell app "Finder" to (name of processes) contains "Internet Explorer"
  1. There are lots of resources to learn actively applescript, such as this BBS, Apple’s applescript-users list, MACSCRPT list, the documentation (articles, FAQ and source code) at this site…

In addition to JJ’s suggestion of checking out the MacScripter BBS and other sections, in the latest article on ‘unScripted’ here on MacScripter, I tried to outline a technique for learning to script just about any scriptable application. I use QuarkXPress in all of the examples but the technique can be applied to any application. This technique will not help solve every problem but is, I hope, a really good start. The important thing is to really understand the object hierarchy, acceptable properties and data types.

If you have specific topics that you would like to see covered in ‘unScripted’ please send me an email and I will consider the topic or multiple topics for an upcoming article.

In defence of the writers of the various application dictionaries, this is partially done automatically when the ‘AETE’ resource is created so there is only so much the software developers can include. In the dictionary, everything but the comments after the class or property is generated automatcially (I think that is the case anyway).

When it comes to development, however, trial and error and deconstructing other people’s code is the best way to learn, albeit, not the most effecient.

Scott Lewis,
MacScripter Staff

#2: One easy (free) way to look at the commands available in AppleScript is to download Smile from It is a great free script editor with many advanced features. It also comes with a tutorial that may help you get started scripting.

#3: Not sure what you mean by ‘idle.’ Do you mean running, but not the frontmost application? If so, here’s what you need to know:

System Events knows what processes are running, and whether they are frontmost, etc. (take a look at System Events dictionary, look under process). So, to find out whether Terminal is running:

tell application "System Events"
	name of processes contains "Terminal"
	-- return true if Terminal is running, false if it isn't
end tell

And, to find out whether Terminal is the front application:

tell application "System Events"
	frontmost of process "Terminal"
	-- return true if Terminal is frontmost, false if it isn't
end tell

One last one, tells you whether Terminal is hidden, or not:

tell application "System Events"
	visible of process "Terminal"
	-- return true if Terminal is visible (not hidden), false if it is hidden
end tell

Hope that gets you going. :slight_smile:

I just realize that I didn’ t mentioned that I was working in 9.2.2 not OS X. Thanks for the script suggestions. The first part of the script is working … The second part is if the app is not running I want to open it.

When the script opens the app, I get an error message telling “Impossible to continue to open” (translated from french … :^)). My script is:

if appisopen is equal to “no” then
open application XYZ
end if

What’s wrong ??? Thanks again … :^)

Salut rlesperance, Ca va?

I’m guessing that since you translated your error message from French that you are a native French speaker. I imagine that the fact that the dictionary is in English might make it more difficult to understand (as if it is not difficult enough already).

I think the problem might be the “open” verb. When you tell an application to “open” it expects a reference to a file for the application to open. The two verbs that will “open” the application itself are “activate” and “launch”. “Activate” technically brings the application to the foreground but if it is not running, it will launch it first then bring it to the front. I think “launch” is the technically correct verb.

Your code should look something like this:

tell application "Finder"
	if exists application process myAppName then
		set appisopen to "Yes"
		set appisopen to "No"
	end if
end tell

if appisopen = "No" then
	tell application myAppName
		activate -- you can also use "launch" here
	end tell
end if

The “tell application “Finder”” command is what checks if the application is running. You can use “process” or “application process” to check if it is running (exists).

I hope this helps. Bonne chance.

Bonjour lewiscot. Thanks your fix just did it !!!

I still believe that a aggregate dictionnary for the most frequent verbs would be very useful either in a book or better on the web. Imagine verbs indexed by topics or usages with example for each of one. Are any of you AppleScript pros looking for a hobby ?? :smiley:

  1. You were right. LAUNCH works OK. Almost obvious, but were does this verb come from ? It is neither in the Finder’s nor in the Standard Scripting addition’s dictionary.

  2. Does the AS language change alot in OS X ??

  3. At Apple’s AppleScript site everything seems to be for OS X. Am I wrong ?? Were are all the previous ressources ??

Gratitude for the help. Alone we can do very little … With others we can move mountains.


Bonjour Robert,

Qu’est ce qui ce passe a France?

I didn’t realize that the “launch” verb was not in the Finder or Standard Additions dicitionaries. I agree completely with the aggregate dictionary idea. It seems like a pretty big undertaking but I think I might give it a shot. I’ll check with other MacScripter staff to see if it is something we might add to the site.

I’m not sure how much AppleScript changes in OSX. I haven’t spent a lot of time scripting OSX so I’m not an expert on that. I have adapted a few of my more robust scripts to OSX though and noticed very little in the way of changes. There are some new terminologies and definitely a lot more power with shell scripting, etc. I think the changes are quite significant however with the releas of Panther. I have bought it but haven’t had time to actually use it yet.

You’re right, the Apple site only has info on AppleScript for OSX. The older data is still there however on the ftp site. You’ll need to do a search for “” and something related to “Interapplication communication”. I have the link somewhere and will forward it when I find it.

De rien.

Scott Lewis,
MacScripter Staff

Bonjour Scott from snowful Québec,

For the global dictionnary keep me posted. If I were a bit of an expert I would give an effort to have it done.

I am french but from Québec, Canada. Your good at french, keep shooting.


There are 2 scripts that lists and sorts available dictionnaries on our computer for us to chose from. These scripts are from Nigel Garvey: (1) Open Dictionary - Running (2) Open Dictionary - OSAXen.

Give it a try … It is faster !!! But still does not give a full dictionnary index of Apple Script …

Could these links be only available with OS X ???

This one ( will work under OS 9, but be opened from Resorcerer or ResEdit. If you modify the resource “aeut” to “aete” most probably will be opened without problems.
The link by Krioni is Smile, available for OS 9. Look here: