Dojo (HowTo)







  Easter Eggs




  Martial Arts

The Right Tool for the Job
Info on AppleScipt

Tim Mityok <[email protected]>
Copyright © 1998-99 by Public Access Software

Now that AppleScript, Apple's proprietary scripting language, has been pushed into the forefront you might be considering taking the plunge. And with AppleScript now PowerPC-native it is very fast too.

Using the proper tool for any job, not just script writing, is critical. Fortunately Mac users have one free and two commercial tools to choose from for basic through advanced AppleScript authoring.

Good - Script Editor

Script Editor from Apple Computer is basic and functional. The set three of button controls on the far left of the window allow you to start recording actions in other programs (if they support Recording), stop recording/execution of the script and to run/execute the current AppleScript respectively.

The button on the far right will "compile" the script which includes checking the syntax of what you have written for errors and reformatting the text to identify various components of the AppleScript language and to make it easier to read.

The easiest and cheapest (free) way to begin writing AppleScripts is to use the Script Editor included with the Mac OS from Apple Computer since version 7.5.

The Script Editor lets you write scripts in AppleScript along with other OSA-compatible languages such as QuickKeys or Frontier if you have the required software installed. You can write, edit, compile - which formats and checks for errors such as typos or improper terminology and save your scripts in one of three formats.

Typically AppleScripts are saved as script files that are used by Applications in either editable or run-only format. The Script Editor can also save scripts as double-clickable applictions in editable or run-only format that can optionally support drag 'n' drop if so configured.

There are several limits to Script Editor which may or may not affect you when writing your scripts. The biggest drawback is that the Script Editor currently lacks any Find/Replace editing features If you write large scripts that reuse the same variable names over and over having a quick Find/Replace comes in very handy.

You can copy the entire script into a text editor such as BBEdit or SimpleText with Find/Search and make changes there. Then you would simply copy the text back into the Script Editor and compile it.

The other drawback, which most scripters will not encounter, is the limited size of the scripts that Script Editor can currently edit and save. If your script is larger than about 30 kilobytes you may not be able to open the file once you save and close it using the Script Editor program.

You can get around the 32k limitation by using a "plugin" or component architecture for your larger scripts.

Better - Scripter

A commercial script editing program called Scripter from Main Event Software has been around for quite a while now. The price is a bit steep at $199 for a single-user license, but you do get a lot for your money. Scripter includes powerful Find/Replace editing features, a trully overkill script Debugger that can allow you to "step" through individual lines of AppleScript and allow you to watch as variable's values change or the script produces errors.

Scripted also includes an expanded AppleScript Dictionary viewer which can list Object Heirarchies and provide for quick access to frequently used Applications.

If you often reuse portions of AppleScript code that you create you can save them into the included ScriptBase component of Scripter. Scripts can even be assembled entirely from ScriptBase although it is not a portable solution if you intend to distribute your final scripts to others.

There are several drawbacks to Scripter as well. The biggest drawback is the interface of Scripter. Scripter's floating toolbar consists of cryptic black & white icons, that lack labels, which can perform various functions and act as shortcuts to Menu commands.

It would be nice to elaborate more on the features, but after failing to download the Demo in one web browser, switching to another and finally downloading the archive I was not able to even run the Demo program because "the file" could not be found.

The concept of the Toolbar would be nice if there were some labels or clear icons describing each tool's function, but there are none. The interface feels very 80's like and is seriously neglected in such a costly commercial product.

The other main drawback in Scripter that could be potentially serious is the lack of 32 kilobyte and larger script support. Again this may not affect most scripters and there are ways around the 32k limit, but for $200 you shouldn't have to deal with such a limitation.

Scripter was originally targeted at Mac web server CGI developers and has languished since AppleScript was replaced by compiled processor-native web server plugins.

Best - Script Debugger

Script Debugger from Late Night Software has its script Running, Recording and Compiling button controls in a floating window as well as Pause and Step buttons to control the flow of the script. Within each script window are separate controls for enabling or disabling integrated debugging features or for changing the type of script you are writing to be either plain text, debugging script only, script only or script applet.

The "Handler" pop-up menu in the lower left corner of the script window gives you a list of all script routines or handlers available in your script and is a quick and handy way to jump to different parts of larger scripts.

The Data window for Script Debugger is where the contents of variables are viewed before, during and after your script is executed. You can enter a number of variables into the Data window and watch them all change as you step or run the script in the main window.

The best, and last, commercial script editing program has to be Script Debugger from Late Night Software. With a price tag of $129 US Script Debugger costs less and provides the majority of the functionality of Scripter with a modern and easy-to-use interface.

As its name implies Script Debugger includes a powerful integrated Debugger that lets you step through your script line by line, set breakpoints or places to stop during a script's execution and watch variable's values change over time just like Scripter can, all while costing $70 less. Script Debugger is PowerPC-native and is designed to be more in line with traditional Mac programming tools.

Script Debugger also provides advanced views of an Applications Scripting Dictionary including Hierarchical views of Objects as well as a complete list of AppleScript Dictionaries including all Scripting Additions and the Finder installed on your System grouped into logical categories.

The biggest advantage over other available script editing programs Script Debugger has is the lack of a 32 kilobyte limit for individual scripts. You can make your scripts as large and complex as you would like and Script Debugger will happily let you save and re-open the massive files you create.

Script Debugger includes its own bag of goodies in its proprietary collection of Scripting Additions. You get over 70 new AppleScript commands with Script Debugger for your own use plus Scheduler which is a utility that allows to you execute various scripts at pre-determined times. Scripter also allows you to "hide" its own AppleScript Dictionary to prevent you from accidentally using its own scripting commands instead of your intended application or Scripting Addition.

Scripting - Above and Beyond

The commercial script editing programs also provide numerous features that most scripters will never require such as CGI development tools integrated in both Script Debugger and Scripter or the ScriptBase database features of Scripter.

Unless you are doing serious scripting work using the Script Editor is the best way to go even with its lack of Find/Replace capabilities. Its included with the Mac OS by default and therefore is not an additional expense as the commercial programs are.

If you need to make very large and complex script Script Debugger will not let you down. The Debugger may be overkill and impractical for developing many simple scripts, but if you need it only a few times its nice to have it available. The price may be high for most people, but it is still cheaper than Scripter.

Scripter is touted as the best tool in the industry, but its archaic interface and limited script size doomed it for a lack of acceptance by Public Access Software for serious AppleScript authoring.

For completeness I should also mention FaceSpan from Digital Technology International. FaceSpan allows you to create more traditional Macintosh applications complete with an interface all using AppleScript. FaceSpan is not a true AppleScript editor as it is geared towards RAD (Rapid Application Development) needs and not work flow automation or basic scripting.

FaceSpan is $149 US which includes and unlimited use royalty-free runtime engine to drive your FaceSpan applications.

More Information:

  1. Apple Computer AppleScript web site: <>
  2. Main Event Software: <>
  3. Late Night Software, Ltd.: <>

Created: 02/22/99
Updated: 11/09/02

Top of page

Top of Section