AppleScript 1.3.1: Common Support Questions

This article provides answers to some of the most common AppleScript questions listed below.

What is AppleScript?
What are the new features in AppleScript 1.3?
How can I tell if an application is scriptable?
How can I tell if an application is recordable?
Certain Finder operations aren't scriptable; what options do I have?
How can I tell if AppleScript is properly installed?
I can't get my script to work. How can I troubleshoot it?
What's the best way to learn AppleScript?
Where can I get more help with AppleScript in general?
Where can I get help with one specific scripting problem I'm having in AppleScript?
Question: What is AppleScript?

Answer: AppleScript is an object-oriented script language built into the Macintosh Operating System, which lets you send commands or messages, called Apple Events, to applications. Using a natural, English-like syntax, users can create scripts to automate complex and/or repetitive tasks, or simplify desktop and network administration.

Applications that support AppleScript are said to be scriptable. Some applications, such as the Finder, are also recordable, which means you can create a script by manually performing and recording actions within that application. Still other applications are said to be attachable, which means that you can attach scripts to application components, such as menus.

The Script Editor, which is installed with the Mac OS, is a utility that enables users to create and compile scripts, or save them as applications (called applets). The Script Editor also lets you record actions performed in recordable applications; the resulting script can then be edited, and saved as either a compiled script or an application.


Question: What are the new features in AppleScript 1.3?

Answer: AppleScript 1.3, included with Mac OS 8.5, has been completely rewritten in native Power PC code. As a result, scripts may run up to 5 times faster than before.

Other important improvements include:

Question: How can I tell if an application is scriptable?

Answer: Any scriptable application or software components (such as control panels or scripting additions) will have a dictionary which contains a list of commands and objects that the application understands, along with a brief description of syntax and parameters. To see if an application has a dictionary, you can try either of the following steps:


Question: How can I tell if an application is recordable?

Answer: To tell if an application is recordable, open the Script Editor, and hit the record button. Then switch to your application and perform some actions. For example, in the Finder (which is recordable), you might create a new folder, give it a name, move it to another location. After performing your actions, return to the Script Editor and select stop [recording] button. If the application is scriptable, you will see the commands you performed entered in the Script Editor window.


Question: Certain Finder operations aren't scriptable; what options do I have?

Answer: First, when scripting the Finder, its a good idea to open the Finder dictionary (choose Open Dictionary in Script Editor, then navigate to the Finder) to view what types of commands and objects it understands. Many control panels will have their own dictionary as well, but not all are scriptable. Here are some workarounds that may help you if you need to perform an action on a software component that is not scriptable:Other Scripting Additions can be found on the Internet; most are freeware and include a read me file of some sort that describes their use. Also, you can open their dictionaries to learn how to use them. See the question below about getting more help with AppleScript for web sites where you can browse for scripting additions.

Question: How can I tell if AppleScript is properly installed?

Answer: Try using one of the Automated Tasks from under the Apple Menu. Automated tasks are applescripts provided by Apple and installed with the Mac OS. To see if Applescript is working on your machine, you can select a file or folder on your hard disk, and then select the Automated Task "Add an alias to Apple Menu". If this task is successfully completed, then you know AppleScript is working on your machine.


Question: I can't get my script to work. How can I troubleshoot it?

Answer: Here are some tips to help you troubleshoot problems you may have when creating your own scripts:


Question: What's the best way to learn AppleScript?

Answer: Regardless of the application you'll be scripting in, most people find that creating your own scripts is easiest when you have some examples to follow. Use the Apple Help Guide to see examples of scripting the Finder. Sometimes it helps to copy the examples EXACTLY, and verify that they work. Then edit them gradually to your own specifications.

When working with third-party applications, check documentation or files installed for examples of scripting that application. You can also check out the company's web site, and search their support databases for guidance.

For a ground-up approach, there are several excellent books on the market that will teach you AppleScript. Look for recently updated editions, as early books did not cover scripting the Finder (because the Finder was not scriptable when AppleScript was first introduced). There are also some excellent resources on the Web, as listed below.


Question: Where can I get more help with AppleScript in general?

Answer: For general help with AppleScript, try these resources:

(http://applescript.apple.com) - Apple's Web Pages for AppleScript:

(http://www.applescriptsourcebook.com) - "The AppleScript Sourcebook" from Bill Cheeseman; includes downloadable scripts, libraries and applets.

(http://lists.apple.com/) - Subscribe to AppleScript Mailing List (or search archives):

(http://developer.apple.com/techpubs/mac/AppleScriptFind/AppleScriptFind-2.html) - AppleScript Finder Guide, online.



Question: Where can I get help with one specific scripting problem I'm having in AppleScript?

Answer: Apple Technical Support only offers "up-and-running" support with scripting; they can assist you if AppleScript doesn't seem to be working at all, either because it is not installed properly, or some other condition is causing it to fail. But Apple, and most other software companies, do not offer free assistance to users attempting to write their own scripts. There are other resources for this type of assistance, however:

- the AppleScript mailing list (http://lists.apple.com/) a discussion group which communicates via email to exchange help and ideas with other scripters

- Apple Discussion about AppleScript, a Web-based discussion area for users to help users, is available at (http://discussions.info.apple.com/webx?.ee6ba86).

Both of these resources involve users helping users. For best results, when composing your question, be sure to include:

The more detailed you are, the easier it will be for others to offer suggestions that may help solve the problem.

Published Date: Feb 18, 2012