AppleScript_ The Definitive Guide - Matt Neuburg [8]
Not only is AppleScript not omnipotent; it isn't even all that potent. AppleScript is a genuine programming language with some interesting and valuable features, but it's not very powerful or useful on its own. It takes some scriptable application to give AppleScript any real muscle. So, for instance, AppleScript's numeric abilities are limited (it has no built-in trigonometric or logarithmic functions ) and its facilites for text processing are fairly rudimentary (it doesn't support regular expressions , and it isn't even very good at extracting substrings). Granted, these shortcomings aren't as significant as they used to be. Mac OS X is loaded with other scripting languages, such as Perl, which are expert at regular expressions—and AppleScript can drive Perl (and vice versa), so success might simply be a matter of combining specialties appropriately. Nevertheless, the general spirit and intention of AppleScript is that the power should be invested mostly in various scriptable applications, not in AppleScript itself.
Thus it becomes crucial to be able to ascertain whether an application is scriptable. You'd think this would be an easily answered, black-and-white, yes-or-no question. But in fact it turns out to be frustratingly difficult to know whether an application is scriptable. (This book points out many instances of AppleScript's making something simple into something frustratingly difficult.)
You can obtain an initial overall survey of the situation by means of Apple's Script Editor program (it's in /Applications/AppleScript): choose File → Open Dictionary, which displays a list of applications present on your computer that the Script Editor thinks are scriptable. You should, however, regard this list with a bit of suspicion, and confirm that a particular application really is or is not scriptable. To do so, choose Window → Library, and in the Library window, press the "+" button (or Control-click to get the contextual menu, and choose Add). You'll see a standard Open dialog. Navigate to an application, select it, and press Open. One of two things will happen:
The application is reported as not scriptable
An error dialog may appear, stating: "Unable to add the application or extension because it is not scriptable." In this case, the application is definitely not scriptable and that's the end of that.
The application is added to the Library window
This means that the application might be scriptable. But you might have a false positive. To find out, double-click the application's listing in the Library window. This should open the application's dictionary display (see Figure 2-2). Even if it does, you still might have a false positive. Explore the dictionary, clicking the various Suites (in the first column of the browser) and looking through the classes and commands (in the second column) to make sure that these actually do something appropriate to the function of that particular application.
A good example is the application