What does it do? AppleScript is a plain-language programming system built into the Mac OS (from 7.5), which allows you to control applications, including the Finder, by sending them commands.Scripting lets you automate tasks which you need to repeat, and link different programs together to perform co-ordinated tasks and make life easier. Its at once a way of creating macros which are almost independent of the software being controlled, and a superb integrative tool. How does it work? Scripts are converted into a series of messages called Apple Events. Your scripts Apple Events are sent to the Mac OS, which then routes them to the correct destination application. The receiving application responds in much the same way that it responds to its own internal menu commands. A reply is passed back to the Mac OS, and finally to your AppleScript. Different applications support different scripting commands, described and documented in the AppleScript dictionary (part of the application itself), which can be opened with the AppleScript Script Editor. Some applications are not just scriptable but are also recordable. This allows you to step through a task with the Script Editor, automatically recording the scripting commands necessary to perform that task. You can then edit and repeat the recorded script. What can go wrong with it? Although close to plain English, AppleScript is a sophisticated programming language. Errors can result from many causes: a language problem (syntax error), picked up by the Script Editor when it checks and compiles the script; commands or objects not supported by the target program (it checks its dictionary again); problems with the target program (not enough memory, and so on). Some applications still only support the minimum required suite of four commands, which makes them unscriptable. How can I upgrade it? Its upgraded as part of the Mac OS. Third-party tools to assist scripting can be helpful, and include example scripts, debuggers (to track errors), up to FaceSpan, a complete development environment which lets you create standalone applications with AppleScript. These are supported by their respective vendors. Further info Web sites worth visiting include: comprehensive resource www.AppleScriptSourcebook.com/home.html the AppleScript SourceBook; and www.macadillo. com/atw/ AppleScript This Week, news and more from Russ Coffman. |