Should I use scripting additions?

AppleScript’s dictionary is large, but not always large enough. Sooner or later you will probably find yourself up against something that AppleScript just cannot seem to do…that’s when it’s time to look for a scripting addition to get the job done.

Think of a scripting addition (or OSAX) as just a means to add an extra word, or many words, to the dictionary.
A few examples: Email osaxen allows you to send email with AppleScript without ever launching an email program. Satimage OSAX contains trig functions. AutoType OSAX (MacOS) lets you “type” characters and simulate keyboard actions (like Command-Shift-3 to take a screenshot).

Other osaxen just make life easier. For example, ACME Script Widgets contains a command called “Tokenize” which parses text without the confusion of Apple’s text delimiters. As an example:

set the_text to "Vacation.jpg "
set break_it_up to tokenize the_text with delimiters "." -- returns {"Vacation", "jpg"}
set no_extension to item 1 of break_it_up -- returns "Vacation"

Any scripting addition you use would have to be installed on any machine your script would run on, but this is a small price to pay for the functionality they extend to AppleScript.

AppleScript’s purists will allways tell you to use “vanilla” solutions if you can (use plain AppleScript statements, without the help of osaxen or third-party helpers), which are allways more easy to mantain-update and highly portables. However, some times the only way is the use of a scripting addition for many reasons: power (eg, complex search-replace operations), speed (eg, calculations with binary digits), functionalities (eg, use advanced User Interface objects, such as progress bars)…

Please, note that if you distribute scripts using osaxen commands, you must instruct your users to install the related scripting additions. Otherwise, those commands won’t be available for your scripts.