Applescript 2.0 (Mac OS X 10.5 'Leopard ')

Applescript finally hits version 2.0! AppleScript 2.0 was released as part of Mac OS X version 10.5 and requires Mac OS X version 10.5 or later. The number of changes isn’t perhaps as many as previous revisions, but they are major changes. Let’s take a look.

Apple provided the usual disclaimer in their release note. It states that scripts written for older versions of AppleScript will work in 2.0 and that scripts written for 2.0 will work with versions back to version 1.1 if they don’t use features added since that version.¨

Unicode Text

As we all thought might happen, all text in Leopard’s Applescript is now unicode. This means that the text, string, and unicode text classes are all functionally the same. If you test the class of any of these items, you will get back the text class and they will all compare as equal. However you will get unicode behavior whether you specify as unicode text or not, which may be different than the string behavior for some languages, especially for operations like words of.

This also means that the ascii number and ascii character commands are no longer valid. In their place, text items now have an id property that returns the unicode value for a text character or a list of values for a string longer than 1 character.

Text characters that combine characters (like é or Ã¥) will return both the text value and the combined character, and Applescript 2.0 will count them as a single character when getting the length of a string. Other changes required by the switch to unicode are (quoted from Apple’s release notes):