As is so often the case in the cyclic world of software development, history repeats itself, but (despite Marx’s dictum) it’s better the second time. A couple of years ago, my TidBITS contributions fell off temporarily while I worked flat out on some projects connected with AppleScript (“Notes From the AppleScript World,” 2006-02-13). Well, it has happened again. For the last few months I’ve been assisting Mark Alldritt, veteran programming wizard and AppleScript master extraordinaire, with the documentation and development of the new version of Script Debugger, the flagship application of his Late Night Software.
As a Late Night employee, I can’t praise Script Debugger 4.5 without risking a conflict of interest, but it’s fine for me to tell you what it does and why I use it (and in any case my opinion is already a matter of public record). In an amazing feat of technical magic, Script Debugger instruments AppleScript so as to make it debuggable, letting you set breakpoints and step through your script one line at a time, watching the values change. It also helps solve the perennial headache of scripters everywhere, learning what aspects of a scriptable application are scriptable, by exposing the application’s “object model” in real time before you’ve written a single line of code. For example, it instantly shows you, graphically, that iTunes currently has such a thing as “album of file track 2 of browser window 1’s view”; armed with that kind of knowledge, you can easily start scripting.
What’s new in Script Debugger 4.5? Most profound is that Script Debugger itself is now once again scriptable (having lost its scriptability in the trauma of being rewritten as a Cocoa application in version 4.0, owing to the shortcomings of Cocoa’s own scriptability implementation). This permits automation and enables some new debugging techniques. Also, Script Debugger is now much more canny about that perpetual bugbear of AppleScript on Mac OS X, the annoying tendency of applications to launch when their scripting dictionary is accessed; in several situations it warns when this might happen, and can even prevent it.
Overall, users will experience Script Debugger 4.5 as a vastly more sophisticated editor. The editing window can be split horizontally and vertically, the code block structure can be highlighted, find-and-replace can use regular expressions, and menu item shortcuts can be customized. Even better, Script Debugger uses its internal knowledge of AppleScript language syntax to make text entry far more convenient. Start to type an AppleScript term; Script Debugger can complete it. Type a user-defined abbreviation; Script Debugger will expand it (so that typing just “dd”, for example, could enter an entire “display dialog” command with all the trimmings). Type an opening delimiter (like a left parenthesis); Script Debugger can close it (with a right parenthesis). And my absolute favorite: Type the start of an AppleScript block (like a “repeat” or a “tell”); Script Debugger can enter the corresponding block closing for you (“end repeat”, “end tell”). The drudgery relief is palpable all over the AppleScript world.
Other improvements bring Script Debugger into the modern Leopard world: Unicode literal strings are legal, limitations on script length are removed, and Quick Look and Spotlight are supported. Oh, and I suppose I ought to mention that the online help documentation (“cross-referenced and cross-linked out the ying-yang,” as John Gruber would say), as well as the tutorial introduction, and Script Debugger’s extensive and example-filled scriptability dictionary, are all thoroughly rewritten by moi.
Finally, I should mention that Script Debugger 4.5 is the product of the best beta-testing process I have ever participated in. The testers exercised the application thoroughly at every stage, and found bugs that left me gasping in amazement at the cleverness of their very discovery. Plus, they freely offered suggestions and criticisms at every level. The developer, for his part, took all of this on board with goodwill, providing the testers with complete access to information about what he was changing and where he was heading and what bugs remained open, and allowing Script Debugger’s usability and clarity to be honed by the testers’ real-world experience and needs. This is beta testing at its finest, and all users are its beneficiaries.
Script Debugger 4.5 requires a PowerPC G4, G5, or Intel processor and Mac OS X 10.4 Tiger or Mac OS X 10.5 Leopard; the latter is recommended. It costs $199, or $49 to upgrade from version 4.0. A 20-day full-featured demo is available as a 10.7 MB download.