Highlights of AppleScript 1.5.5 in Mac OS 9.1
Highlights of AppleScript 1.5.5 in Mac OS 9.1
- Subject: Highlights of AppleScript 1.5.5 in Mac OS 9.1
- From: Chris Espinosa <email@hidden>
- Date: Tue, 09 Jan 2001 14:43:14 -0800
All,
Apple announced today it will immediately begin shipping Mac OS 9.1, the
latest update of Mac OS 9. Designed to ensure a smooth transition to Mac OS
X, Mac OS 9.1 serves as the basis for Classic, the technology in Mac OS X
that ensures compatibility with today9s application software.
The AppleScript team has been working to keep the AppleScript
implementation in Mac OS 9 in synch with that in Mac OS X to ensure maximum
script compatability between the two OS environments and to make your
transition easier. To that end, Mac OS 9.1 includes AppleScript 1.5.5,
which has similar features to the version of AppleScript that shipped in the
Mac OS X Public Beta.
IMPORTANT NOTE
When Mac OS X ships March, we will release an update to AppleScript for
Mac OS 9 to bring it up to date with features and bug fixes in AppleScript
for Mac OS X. Two specific issues that are known in AppleScript 1.5.5 will
be addressed then:
- While AppleScript 1.5.5 improves support for Unicode text, it is limited
to getting, sending, and displaying Unicode text. Other operations on
Unicode text (concatenation, equality testing, word or character access)
will cause an error or crash.
- Due to an error in integrating a new feature, some features of the
Read/Write scripting additions are not working. Specifically, writing a
list to a text file will corrupt the text file.
Both of these issues will be addressed in the AppleScript release for Mac
OS X and a corresponding Software Update for Mac OS 9.
FEATURES AND CHANGES IN APPLESCRIPT 1.5.5 FOR MAC OS 9
ONLY RUNS ON MAC OS 9.1
AppleScript 1.5.5 requires Mac OS 9.1 and cannot be used on earlier versions
of the Mac OS.
MOUNT VOLUME USES KEYCHAIN
As of AppleScript 1.5 and later, the 'mount volume' scripting addition will
look in the Keychain to see if there is a password for the requested server.
Note that keychain passwords are stored according to the connection
protocol: a key for a server accessed via AppleTalk is different than a key
for accessing the same server through TCP/IP. So if you've created a key
for that server connected via TCP/IP, you must use the TCP/IP form of 'mount
volume' (using a URL of the form afp://host.domain.com/volume) in order to
have the keychain key work correctly. Similarly, if you created the key
while connected to the server via AppleTalk, you must use the AppleTalk form
of 'mount volume' to use that key.
ROUND LIKE TAUGHT IN SCHOOL
In AppleScript 1.5 and later, the 'round' scripting addition now can take an
additional enumerated parameter: 'like taught in school'. With this
parameter, numbers whose fractional parts are less than .5 are rounded
towards zero, and fractional parts of .5 and above are rounded away from
zero.
UNICODE SUPPORT
In AppleScript 1.3, initial support was added for Unicode data. AppleScript
could send, receive, load, and store Unicode strings, and convert between
text strings and Unicode strings. It could not display them or perform any
operations on them. In AppleScript 1.5 and later, Unicode strings can be
displayed in script editors (if the appropriate fonts are installed in the
system). CAUTION: In AppleScript 1.5.5, certain operations on Unicode text
can cause AppleScript to crash or hang. Apple advises that if your script
is handling Unicode text, you should convert the Unicode text to a string
before attempting to manipulate the text in any way. Full Unicode support
is provided in AppleScript 1.5 for Mac OS X and will be provided as an
update for AppleScript on Mac OS 9.
Unicode support in AppleScript 1.5 and later has been improved to correctly
convert Unicode strings of mixed languages to the appropriate
language-specific characters if the necessary Language Kits are installed.
MAC OS X SUPPORT
In AppleScript 1.4.3, an option was introduced to save scripts as "Mac OS X
applets". Due to changes in Mac OS X, these do not actually work on that
system. As of AppleScript 1.5 and later, applets saved as "Mac OS X
applets" will work on Mac OS X Public Beta and later.
AppleScript version 1.5 and later can now handle script files in which the
script data is stored in the data fork, rather than the resource fork. All
scripts that ship with Mac OS X will be stored in the data fork, but the
Script Editor by default will continue to save script data in the resource
fork for compatability with previous versions of AppleScript.
As of AppleScript 1.5, AppleScript and the Script Editor recognize files
that end in '.scpt' as script files, if they are missing other type and
creation data. This should make it easier to transfer script files using
media or communications methods that do not retain Mac type and creator
data.
AppleScript 1.5 and later now accept all styles of line endings for the
purposes of finding paragraph breaks in strings. The expression 'every
paragraph of s' will break paragraphs correctly whether the string is
Mac-style (paragraphs end with 0x0D), UNIX style (lines end with 0x0A), or
DOS style (lines end with 0x0D0A).
OTHER CHANGES
The Script Editor in AppleScript 1.4.3 introduced a "proxy icon" in the
title bar of script windows: an icon that represents the saved script file
on disk. Unfortunately, dragging that icon to a disk folder did not move
the script file to that folder; in AppleScript 1.5 and later, it does.
In Script Editor 1.4.3 and earlier, command-clicking on the title of a
script window that is not frontmost would bring up a pop-up menu for that
script's path. Users expect command-dragging the titles of background
windows to drag those windows without bringing them to the front; in Script
Editor 1.5 and later, that is indeed what happens.
In AppleScript 1.5 and later, the "Where is application <name>?" dialog box
now uses Navigation Services instead of Standard File.
In AppleScript 1.5 and later, the "info for" scripting addition now returns
the size of the file or folder as a real number, not an integer. This
accomodates files or folders that are greater than 2 Gigabytes in size.
In AppleScript 1.4.3 and earlier, certain arithmetic operations on odd
integers were handled differently from the same operations on even integers,
making those operations approximately half as fast. Odd integers are now
treated the same as even integers, so certain repetitive arithmetic
operations on odd integers will be faster in AppleScript 1.5 and later.
AppleScript documentation erroneously reports the effective range of
AppleScript integers: the true range is 2^29-1 to -2^29 (i.e. 536870911 to
-536870912). In AppleScript 1.3 through 1.4.3, integer addition and
subtraction handled arithmetic operations at the extremes of this range
incorrectly; for example, 536870911 + 1 would return -536870912. In
AppleScript 1.5 and later, operations on large-magnitude integers will be
promoted to reals, so for example 536870911 + 1 returns 5.36870912E+8.
In AppleScript versions 1.4.3 and earlier, asking for the middle item of an
empty list (e.g. 'middle item of {}') would cause AppleScript to crash.
This has been fixed in 1.5 and later.
In AppleScript 1.4.3, running multiple applets simultaneously could
occasionally cause AppleScript to crash. This has been fixed in AppleScript
1.5 and later.
In AppleScript 1.4.3 and earlier, providind large numbers as the 'seed'
parameter to the 'random number' scripting addition would have undesired
effects: similar large numbers would consistently produce the same initial
random value (though subsequent values would be more randomly distributed).
This is especially troublesome because AppleScript itself uses the system
clock as a seed value if none is provided, and most system clock values tend
to be similar large numbers. In AppleScript 1.5 and later, large seed
values produce more evenly distributed initial values.
In AppleScript 1.3 through 1.4.3, on rare occasions the 'random number'
scripting addition, when given real numbers for its range, would generate a
number fractionally larger than the upper bound of the range. In
AppleScript 1.5 and later, all random numbers are assured to be no greater
than the upper bound.
In AppleScript 1.4.3 and earlier, attempting to access item 0 of a list
(e.g. 'item 0 of {2, 3, 4}') would produce no error and no result. In
AppleScript 1.5 and later, it produces an 'index out of range' error.
In AppleScript 1.4.3 and earlier, creating a script with no 'run' handler
(explicit or implicit), but having a 'parent' property of a script with an
implicit run handler, would work in the Script Editor but crash if the
script were saved as an applet. For example:
script crasher
property parent : current application
display dialog "This hasn't crashed"
end script
property parent : crasher
Note the script has no statements other than the script and property
definition, so there is no 'run' handler; when AppleScript tries to run it,
it looks in its 'parent' script ('crasher') and tries to run its run
handler. But because there is no explicit run handler in the 'crasher'
script, it tries to get the run handler from its parent, and loops
infinitely. This has been fixed in AppleScript 1.5 and later.
In Folder Actions 1.4.3 and earlier, Folder Actions would create an
invisible "Icon\n" file in any folder you control-clicked, whether you
attached a Folder Action to it or not. As of Folder Actions 1.5.5, the file
is created only if you actually attach a folder action.
In Folder Actions 1.5.5 the 'action name' and 'action number' parameters of
the 'remove action from' and 'edit action of' events have been changed to
'using action name' and 'using action number' for readibility. Older
scripts should decompile to the new form automatically.
Regards,
The AppleScript Team
Apple