This document contains the AppleScript release notes for Mac OS X v10.4, its updates, and for earlier versions. For AppleScript release notes for Mac OS X v10.5 and its updates, please refer to the current release notes for AppleScript (AppleScript Release Notes).
AppleScript versions 1.10.2, 1.10.4 and 1.10.5 shipped pre-installed on certain Macintosh models. AppleScript users who currently have AppleScript 1.10.4 or 1.10.5 should update to version 1.10.6 or later.
Mac OS X v10.4.7 - AppleScript 1.10.7
Mac OS X v10.4.6 - AppleScript 1.10.6
Mac OS X v10.4.3 - AppleScript 1.10.3
Mac OS X v10.4.2 - Standard Additions 1.10.1
Mac OS X v10.4 - AppleScript 1.10
Mac OS X v10.3.5 - Standard Additions 1.9.4
Mac OS X v10.3.2 - AppleScript 1.9.3
Mac OS X v10.3 - AppleScript 1.9.2
Mac OS X v10.2.3 - AppleScript 1.9.1
Mac OS X v10.2 - AppleScript 1.9
AppleScript 1.8.3
April 2002 Developer Tools Update - AppleScript 1.8.2
Mac OS X v10.1.2 - AppleScript 1.8.1
December 2001 Developer Tools Update - AppleScript 1.8
Mac OS X v10.1 - AppleScript 1.7
Mac OS X v10.0 - AppleScript 1.6
AppleScript 1.10.7 is included with Mac OS X version 10.4.7 and requires Mac OS X version 10.4 or later.
Quitting a read-only bundled applet no longer causes an error to be reported. [4505459]
Compiled scripts containing dates now decompile and run correctly when transferred from PowerPC-based Macs to Intel-based Macs (and vice-versa). [4525261]
delay commands and on idle handlers no longer conflict. [4508927]
Concatenating an empty record no longer causes a crash. [4510216]
A crash that could occur in certain circumstances when copying large nested script objects has been fixed. [4510228]
A memory leak has been fixed. [4505510]
Specifying a data type of "TEXT" for a read or write command (e.g., read fileRef as "TEXT") no longer causes an error on Intel-based Macs. [4508534]
AppleScript 1.10.6 is included with Mac OS X version 10.4.6 and requires Mac OS X version 10.4 or later.
Changes to property values are now preserved when a script is run from the Script menu. In previous versions of AppleScript, the property values were only preserved if the script returned a result. [4400567]
A problem that caused the path to, path to it, and path to application "AppName" commands to return the wrong result in certain situations has been fixed. [4400329]
A compilation problem that caused the after reference form to be converted to before on Intel-based Macs has been fixed. [4460185]
Crashes triggered by various Dashboard widgets and applications in certain situations have been fixed. [4400300] [4400304] [4400306] [4400309] [4400557]
A memory leak has been fixed. [4400420]
A problem that could cause the choose application dialog to be invisible has been fixed. [4400378]
A problem that could cause choose remote application to be unable to find applications on remote machines using Bonjour has been fixed. [4400386]
AppleScript 1.10.3 is included with Mac OS X version 10.4.3 and requires Mac OS X version 10.4 or later.
The OSAGetPropertyNames() and OSAGetHandlerNames() APIs now return all of the properties and handlers of a script object when the script object contains a parent property declaration. Previously they would only return properties and handlers that were declared before the parent property. [4179456]
AppleScript 1.10.3 now respects the normal rules when trying to fetch terminology from the host application: it loads an 'aete' resource if one is present, or sends an event if the application is marked as having dynamic terminology. Previously, it would always send an event. This only affects scriptable applications that run scripts in their own process. [4250843]
The delay command now yields more time to other processes. [4179466]
do shell script ... with administrator privileges no longer slows down when called more than once in the same script. [4179474]
The get volume settings command now returns the correct output volume when the balance is set to the right of center. [4242153]
The performance of the system info command has been improved. [4182950]
Standard Additions 1.10.1 is included with Mac OS X version 10.4.2 and requires Mac OS X version 10.4 or later. It contains changes to the do shell script command. Note that only Standard Additions has changed in this release, the AppleScript runtime has not changed and its version number remains 1.10.
do shell script ... with administrator privileges now sets both the real and effective user ids of the script to 0. This matches the behavior in Mac OS X version 10.3.x, and corrects a number of permission troubles in Mac OS X versions 10.4.0 and 10.4.1. [4126949]
Using sudo(8) with the administrator privileges parameter of the do shell script command will no longer cause the script to hang. In general, adding sudo to with administrator privileges is redundant, but some scripts rely on it. [4126949]
AppleScript 1.10 is included with Mac OS X version 10.4 and requires Mac OS X version 10.4 or later. It contains many new features and enhancements, and corrects problems found with AppleScript 1.9.3 and earlier versions.
AppleScript 1.10 can use scripts developed for any version of AppleScript from 1.1 through 1.9.3, any scripting addition created for AppleScript 1.5 or later for Mac OS X, and any scriptable application for Mac OS 7.1 or later.
A script created with AppleScript 1.10 can be used by any version of AppleScript back to version 1.1, provided it does not use features of AppleScript, scripting additions, or scriptable applications that are unavailable in that version.
Scripts that compare AppleScript version numbers using string comparisons will need to be changed in order to work correctly with the new AppleScript version number. A considering numeric strings statement must be added before the string comparison so that the string 1.10 will be greater than the string 1.9.3.
Scripts that compare version numbers by coercing the version class to a real number and then doing numeric comparisons will need to be changed. The coercion from version to real has been changed to allow the second and third parts of the version number to be 0..15 instead of 0..9. As a result, the version 1.2.3 will now coerce to the real number 1.0203. Previously, it would coerce to the real number 1.23.
Scripts that compare AppleScript version numbers, and which need to run on AppleScript 1.10 as well as earlier versions of AppleScript, should do numeric comparisons using the Gestalt version number. The Gestalt version number can be obtained using the system attribute "ascv" command.
String concatenation now uses the richer of the two operands. If either operand is Unicode, the result will be Unicode.
The path to me command now returns the correct result for compiled scripts, including those that are run using the run script command.
Beginning in Mac OS X version 10.4, the mount volume command can no longer mount Mac OS 9 server volumes if the server is specified using the AppleTalk server name. The TCP server name or IP address must be used instead.
Do not use sudo(8) with the administrator privileges parameter of the do shell script command. Due to a bug, if sudo thinks it needs a password, it will prompt for it on a non-existent terminal and wait forever for a response, causing the script to hang. This may break existing scripts.
The do shell script command now runs the shell script as seteuid-root, not actually root. This creates certain differences; for instance, perl will refuse to accept -e options when seteuid-root.
The error codes returned by the do shell script command have changed.
If the with icon parameter to the display dialog command specifies an icon that doesn't exist, an error is now reported. Previously, the error was ignored.
The return value from the list disks command is now a list of Unicode strings. Previously, it was a list of plain strings.
Getting the count of the paragraphs or text items of an empty Unicode string now returns 1 instead of 0.
Strings that contain only a plus or minus sign, can no longer be coerced to a number.
The implicitly encoded text types, typeText, typeCString, and typePString, are all deprecated as of AppleScript 1.9.2, since they are incapable of representing international characters and may be reinterpreted in unpredictable ways. Additionally, typeCString and typePString do not support the full range of text coercions, and will be removed entirely in a future release. typeStyledText and typeIntlText, while they have explicit encodings, are not recommended, since they are incapable of representing Unicode-only characters like Hungarian, Arabic, or Thai. The recommended text type is typeUnicodeText.
A new Open Scripting Architecture (OSA) API has been added that lets you get the scripting dictionary of an application as an sdef (see ASDebugging.h and sdef(5)). If the target application does not have a true sdef but does have an 'aete' or Cocoa-generated dictionary, it will translate that, so the API will work on any scriptable application. [3657719]
OSAError OSACopyScriptingDefinition ( const FSRef * ref, SInt32 modeFlags, CFDataRef * sdef );
Parameter Descriptions ref An FSRef to the application file or bundle. modeFlags There are no flags currently defined; pass 0. sdef If the result is noErr, a CFDataRef containing the sdef XML, which you are responsible for releasing; otherwise undefined.
Discussion To provide an sdef in your application, put the sdef in the Resources folder of your bundle, and add the key OSAScriptingDefinition to your Info.plist with the value of the sdef name (e.g., MyApplication.sdef).
Known Bugs and Limitations Dynamic generation of sdefs is not supported. sdefs in single-file applications are not supported.
A crash that occurred when calling OSAScriptError() with the kOSAErrorApp selector has been fixed. [3547609]
The osascript command line tool now passes the kOSAModeCompileIntoContext mode flag when compiling a text script. [3684436]
The osascript command line tool can now call scripts that take parameters. Any arguments following the script will be passed as a list of strings to the direct parameter of the run handler. [3165225]
A new Considering/Ignoring attribute has been added that affects string comparisons. The numeric strings attribute specifies that numeric substrings should be collated by their numeric value. For example, version 1.9 is less than version 1.10. [3614412]
A new string constant named quote has been added whose value is "\"". [3618573]
String concatenation now uses the richer of the two operands. If either operand is Unicode, the result will be Unicode. [3375227]
The date class now has hours, minutes, and seconds properties. The hours property always uses a 24-hour clock. [3516702]
The month property of the date class can now be set to an integer. [3525546]
The weekday constants can now be coerced to numbers. Sunday is 1. [3639194]
The coercion from version to real has been changed to allow the second and third parts of the version number to be 0..15 instead of 0..9. As a result, the version 1.2.3 will now coerce to the real number 1.0203. Previously, it would coerce to the real number 1.23. [3621631]
A tell application "AppName" statement can now use the applications short name (CFBundleName) if the application is currently running. [3655554]
If a script application (applet) encounters an error, the Edit button in the error dialog will now open the applet in the default script editor. The default script editor can be set using the new AppleScript Utility application. [3084519]
If an applet has a custom startup screen, the startup screen will now be displayed when the user selects the About appletName menu item. Previously, the generic applet About Box was displayed. [3537429]
If a bundled applet has a custom startup screen stored in Contents/Resources/description.rtfd/TXT.rtf, that startup screen will be displayed instead of the startup screen stored in the bundles 'TEXT' and 'styl' resources. Note that non-text startup screens are not currently supported. [3545405]
Bundled applets now display localized menus and dialogs. [3847125] [3933933]
The applet startup screen dialogs and error dialogs now conform to the Aqua Human Interface Guidelines. [3545405] [3535392]
The applet About Box has been updated. [2632525]
The with prompt and with title parameters to the choose application command now support Unicode text. [3526680]
The choose application dialog now remembers the column widths. [2680232]
The choose file and choose folder commands now have a showing package contents parameter that specifies whether packages should be treated as folders. The default is false. [3616391]
The of type parameter to the choose file command now accepts either a list of file types or a list of type identifiers. [3226364]
The choose from list command now has a with title parameter that specifies the title of the dialog. By default, the dialog does not have a title. [3722157]
The choose from list command now supports Unicode text. [3318667]
The choose from list command now supports long prompts and multi-line prompts. [2641867]
The choose from list dialog now allows a text item to be selected by typing the first few characters of its name. [3497349]
The choose from list dialog now supports full keyboard access. [2748218]
A new choose remote application command has been added that enables the user to choose a running application on a remote machine or on the local machine. [2763939]
The choose URL command now supports CIFS file servers. [3444824]
A new display alert command has been added that displays a standard alert dialog that conforms to the Aqua Human Interface Guidelines. [3580135] Note that standard alert dialogs have the following restrictions: A default button is required. The right-most button will be the default button unless the user specifies otherwise using the default button parameter. The cancel button cannot be the same as the default button.
The display dialog command now has a cancel button parameter that specifies the name or number of the cancel button. [3422345]
The display dialog command now has a hidden answer parameter that specifies whether editable text should be displayed as bullets. The default is false. [1622240]
The display dialog command now has a with title parameter that specifies the title of the dialog. By default, the dialog does not have a title. [3601825]
The default answer parameter to the display dialog command now supports Unicode text and linefeeds. [3332444] [3316708]
The with icon parameter to the display dialog command now accepts an alias or file reference to a .icns file. [3437405]
The display dialog dialog now supports full keyboard access. [3272416]
The display dialog dialog now uses Aqua icons for note, caution, and stop. [3437405]
The display dialog dialog now conforms to the Aqua Human Interface Guidelines. [3438825]
The do shell script command now displays the Mac OS X authentication dialog in order to obtain administrator privileges. [3004723]
The do shell script command now has a user name parameter that specifies an administrator account. This parameter can be used along with the password parameter and the administrator privileges parameter in order to execute commands as an administrator without displaying an authentication dialog. [3004723]
The info for command now has a size parameter that specifies whether the size of the item should be returned. The default is true. [3566020]
The info for command now returns the type identifier for files. [3226360]
The info for command now returns the short name (CFBundleName) for applications. [3655608]
The info for command now returns the busy status for packages. The busy status is set to true if the package is marked as incomplete (kExtendedFlagObjectIsBusy). [3675978]
The info for command now sets the busy status for non-bundled files to true if either the file is marked as open (kioFlAttribFileOpenBit) or the file is marked as incomplete (kExtendedFlagObjectIsBusy). [3976012]
The list disks command now supports disk names that contain Unicode characters. The return value from the list disks command is now a list of Unicode strings. Previously, it was a list of plain strings. [3513241]
A new localized string command has been added that returns a localized string for a specified key. [2857256]
The path to command now has a folder constant for the Automator workflows folder. [3748836]
The path to me command now returns the correct result for compiled scripts, including those that are run using the run script command. [3634573]
A new path to resource command has been added that returns an alias to the specified resource. [3177652]
The say command now accepts Unicode text and numbers as the direct parameter and as the displaying parameter. [3380562]
A new system info command has been added that returns a record containing information about the system. [3611016]
Strings that contain only a plus or minus sign, can no longer be coerced to a number. [2604425] [3759051]
The numeric value classes, the enumerated value class (typeEnumerated), and the type value class (typeType) can now be coerced to and from Unicode text and styled text. [3333079]
The Unit Type value classes (e.g., miles, gallons) can now be coerced to and from Unicode text. [3567987]
The version class (typeVersion) can now be coerced to Unicode text. [3333229]
Plain text (typeText) can now be coerced to styled text (typeStyledText). [3333079]
A coercion from typeFileURL to object specifier has been added. [3244564]
Coercing a file specification (typeFSS) to an object specifier now works correctly for filenames that are longer than 31 characters. [3078972]
Coercing an alias to an object specifier would crash in certain circumstances if the alias could not be resolved. This has been fixed. [3556365]
Distance and weight conversions are now more accurate. [3627006]
"file://localhost" as URL no longer causes a crash. [3580636]
Getting the first word of an empty Unicode string no longer causes a crash. [3619870]
Getting an arbitrary element of Unicode text using some (e.g., some word of theUnicodeText) now produces more random results. [3479349]
Getting the count of a non-existent element of Unicode text (e.g., count files of theUnicodeText) now returns 0. Previously, it returned the number of characters. [3735260]
Getting the count of the paragraphs or text items of an empty Unicode string now returns 1 instead of 0. [3978194]
A problem that caused some styled text comparisons to fail when the primary language was set to Japanese has been fixed. [3528969]
tell application "AppName" will now look for a Mac OS X application named AppName.app before looking for a Classic application named AppName. Previously, the Classic application was found first. [2868512]
Long application names are no longer truncated when used in a tell statement. [2854838] [3736065]
Long application names are no longer truncated in the Where is xxx? dialog. [3874872]
Long volume/folder/file names no longer cause errors. [3625871]
Getting the POSIX path of a path string that is already POSIX now returns the correct results. [3405197]
Scriptable Cocoa applications that contain Resource Manager resources, but do not contain an 'aete' resource, are now recognized as scriptable. [3553719]
If a with timeout statement specifies a timeout of more than 8947848 seconds, the timeout will be set to 8947848 seconds. Previously, an error was reported. [3570429]
A compilation problem that caused the last character of an enhanced application URL specification to be removed has been fixed. [3577364]
Backslash characters and Yen sign characters will now compile correctly when the primary language is set to Japanese. [3765766]
The '¬', '÷', '≠', '≤', and '≥' characters will now compile correctly when the primary language is set to Japanese, Korean, or Chinese. [3427926] [3758459] [3828128]
Bundled applets created using AppleScript 1.9.x always appear to be named applet when targeted from a remote machine. This has been fixed for bundled applets created with AppleScript 1.10 and later. [3625938]
Bundled applets created using AppleScript 1.9.x erroneously display the Open in the Classic environment checkbox in the Finders Get Info window. This has been fixed for bundled applets created with AppleScript 1.10 and later. [3560457]
The size of the internal symbol table has been increased which enables larger scripts to be compiled. [3465382]
The size of the internal runtime stack has been increased which enables larger static lists to be created. [3612848]
The default formatting is now localizable. [3381966]
The References formatting category is no longer used. [3394917]
A divide by 0 within a try block within a repeat block no longer causes a hang. [3735291]
Crashes that would occur in certain circumstances after garbage collection have been fixed. [3410634] [3783112]
Memory leaks have been fixed. [3400572] [3542919]
Several error reporting problems have been fixed. [3537493] [2361457] [3481518] [3382032] [3753807] [3756205] [3775760]
The choose application, choose from list, choose URL, and display dialog commands will no longer present dialogs on remote machines. [3342807]
The choose application command no longer leaks memory. [3505723]
In Mac OS X version 10.3.x, the choose application dialog is not responsive to mouse clicks within the content area when inactive. This has been fixed. [3467405]
The of type parameter to the choose file command now works correctly for packages that dont contain a PkgInfo file (e.g., scripting additions). [3742878]
choose file of type {"MooV"} now works as expected. Previously, it allowed the user to choose any file that QuickTime could open. [3595938]
The choose file name dialog now recognizes packages. [4003078]
The display dialog command will no longer create a dialog that is too tall for the screen when given a very long string to display. [3464996]
The display dialog command now displays Japanese text correctly when an applet is running on a Japanese-primary system. [2812677]
The do shell script command now works correctly with multiple commands when the administrator privileges parameter is specified. [3466509]
When the administrator privileges parameter is specified to the do shell script command, the 5 minute authentication timestamp now applies only to the current script. [3004723]
The do shell script command now returns the correct error code (-128) if the user cancels the authentication dialog. [3446874]
The info for command now returns the correct file type and file creator for packages that dont contain a PkgInfo file (e.g., scripting additions). [3153056]
read before <delimiter> as date no longer causes an error. [3383413]
The run script command no longer causes a stack overflow error if the direct parameter is not specified. [3514354]
The using parameter to the say command now works correctly when Speech Recognition is turned on. [3055088]
The using parameter to the say command no longer causes an error if the specified voice is not capitalized correctly. [2361457]
the clipboard as Unicode text now works correctly when the clipboard contains styled text but no Unicode text. [3668725]
Error checking and reporting has been improved. [3523658] [3522599] [2361457] [3413730] [3446766]
Several errors in the Standard Additions dictionary have been fixed. [3512009] [3431746] [3632368] [3608653] [3505597]
Standard Additions 1.9.4 is included with Mac OS X version 10.3.5 and requires Mac OS X version 10.3 or later. It contains improvements to the set volume command as well as a new get volume settings command. Note that only Standard Additions has changed in this release, the AppleScript runtime has not changed and its version number remains 1.9.3.
A new get volume settings command has been added that returns a record containing information about the current volume settings. [3467967]
The set volume command now has four new parameters that enable the user to set the output volume, the input volume, the alert volume, and the mute setting (output muted). The direct parameter is now deprecated. If the direct parameter is specified, all other parameters are ignored. [3563760]
The set volume command now sets the volume level correctly. [3268130] [3479316]
AppleScript 1.9.3 is included with Mac OS X version 10.3.2 and requires Mac OS X version 10.3 or later.
In AppleScript 1.9.2, coercing an AEDesc to Unicode text will fail if the text is a null string. This has been fixed. [3439141]
In AppleScript 1.9.2, the with timeout statement does not return an error if the timeout expires. This has been fixed. [3457829]
When using a Japanese-primary system, scripts that compile correctly with AppleScript 1.9.1 may fail to compile with AppleScript 1.9.2. This has been fixed. [3419243]
In AppleScript 1.9.2, saving a blank script with Script Editor 2.0 will result in a crash. This has been fixed. [3421468]
In AppleScript 1.9.2, using Xcode to open a new .applescript file that was created by Interface Builder will result in a crash. This has been fixed. [3454301]
AppleScript Studio debugging has been improved. [3467973] Note, AppleScript Studio debugging requires Xcode 1.1.
In AppleScript 1.9.2, the mount volume command will fail if the user name is not specified and the volume does not allow guest access. This has been fixed. [3464919]
AppleScript 1.9.2 is included with Mac OS X version 10.3 and requires Mac OS X version 10.3 or later. It contains many new features and enhancements, and corrects problems found with AppleScript 1.9.1 and earlier versions.
AppleScript 1.9.2 can use scripts developed for any version of AppleScript from 1.1 through 1.9.1, any scripting addition created for AppleScript 1.5 or later for Mac OS X, and any scriptable application for Mac OS 7.1 or later.
A script created with AppleScript 1.9.2 can be used by any version of AppleScript back to version 1.1, provided it does not use features of AppleScript, scripting additions, or scriptable applications that are unavailable in that version.
The implicitly encoded text types, typeText, typeCString, and typePString, are all deprecated as of AppleScript 1.9.2, since they are incapable of representing international characters and may be reinterpreted in unpredictable ways. Additionally, typeCString and typePString do not support the full range of text coercions, and will be removed entirely in a future release. typeStyledText and typeIntlText, while they have explicit encodings, are not recommended, since they are incapable of representing Unicode-only characters like Hungarian, Arabic, or Thai. The recommended text type is typeUnicodeText.
The offset command now ignores case by default and honors considering and ignoring statements with regards to case and diacriticals. See the offset section below for more information.
Resource-fork script files can no longer be created using store script. See the store script section below for more information.
The path to me command will return a path that ends with a colon when used within a script application that has been saved in the new bundled format.
Four new functions have been added to the Open Scripting Architecture (OSA) API in Mac OS X version 10.3. The new functions enable applications to load, execute, and store scripts using any of the old (data/resource fork based) or new (bundled) script formats. The new functions are OSALoadFile(), OSALoadExecuteFile(), OSAStoreFile(), and OSADoScriptFile(). For details, see the Open Scripting Architecture Reference.
AppleScript now sends the subject parameter in some cases where it previously failed to. This allows applications to make the at parameter for make new optional. [3039070]
System terminology is now read into memory only when needed for compilation or decompilation. This reduces the memory cost for applications that simply run compiled scripts. [3142099]
AppleScript now preserves international characters better when compiling Unicode source. [3157261]
AppleScript 1.9.2 supports a new bundled format for compiled scripts and script applications (applets) that uses standard Mac OS X bundles. Compiled script bundles have the filename extension .scptd, while applet bundles have the filename extension .app. [3150267] [3150248]
Scripting additions can be embedded within bundled applets by placing them in a folder named Scripting Additions inside the bundles Contents/Resources/ folder. Note that Script Editor does not look for embedded scripting additions when editing bundled applets. Any required scripting additions must be properly installed in the normal locations during script development so that Script Editor can find them. [3314117]
AppleScript applets now handle incoming events in a first-in, first-out manner. Prior to AppleScript 1.9.2, applets handled incoming events in a last-in, first-out manner. [2553648]
The Idle handler return value can now be a real number. [3199911]
Real numbers can now be coerced to integers even if they have a non-zero fractional part. Rounding is used to do the coercion. [2849518]
The month constants can now be coerced to numbers. [2396328]
The date class now has a short date string property. The format of the short date string is specified by the International preference pane. [2396328]
Two new types were added: JPEG picture and GIF picture. [3251772]
The zone class has been removed since EPPC over AppleTalk is not supported in Mac OS X. [2967694]
When a non-URL machine name is specified, it is now assumed to be a Rendezvous name instead of an AppleTalk name. [3113390]
The choose application dialog box now allows an application to be selected by typing the first few characters of its name. [3064133]
The choose application dialog box now displays localized application names. [2970962]
The choose application dialog box now remembers its size and position. [3141005]
A choose color command has been added which displays the standard color picker dialog box and returns the selected color as a list of the RGB values. The default color parameter specifies the initial color. By default, the initial color is black. [3160380]
The choose file, choose file name, and choose folder commands now have a default location parameter that specifies which directory should be displayed in the dialog box. [3143207]
The choose file and choose folder commands now have an invisibles parameter that specifies whether invisible files and folders should be displayed. The default is true for choose file and false for choose folder. [2690829]
The choose file and choose folder commands now have a multiple selections allowed parameter that specifies whether multiple items can be selected. The default is false. [3254466]
The choose file and choose folder commands now support Unicode and styled text prompts. [2836896] [3318664]
The choose file and choose folder dialog boxes no longer use a default prompt. The dialog box will only contain a prompt if one has been specified using the with prompt parameter. [2519050]
The choose file name dialog box now has a new title and default prompt. [2519050]
The delay command now accepts real numbers. [2812515]
The display dialog command now supports Unicode and can now display more than 255 characters. [3077453]
The do shell script command now has an as parameter that specifies the desired type of the result. The default is to return the result as UTF-8 if possible. If the as parameter is not specified and the result is not valid UTF-8, the result will be returned as typeText. [3080630] [3157877]
Two new properties were added to the file information class. The kind property returns the items kind string. The bundle identifier property returns the items bundle identifier, if the item is a package. [2884166] [3274781]
The info for command now returns the short version and long version for packages. [2913766]
The load script command now supports the new bundled format for compiled scripts and applets. [3177719]
The offset command now ignores case by default and honors considering and ignoring statements with regards to case and diacriticals. As a result of these changes, the offset command now behaves the same as other AppleScript string comparisons with regards to case and diacriticals. In AppleScript 1.9.1 and earlier, the offset command always considers case and does not honor considering and ignoring statements. Scripts that are expecting offset to always consider case will need to add a considering case statement to maintain the previous behavior. [1068386]
The path to command now has a folder creation parameter that specifies whether the folder should be created if it does'’t exist. The default is to create the folder if possible. If without folder creation is specified, an error will be returned if the folder doesn’t exist. [3315615]
The path to command now has the following new folder constants: applications folder, documents folder, favorites folder, home folder, library folder, movies folder, music folder, pictures folder, public folder, shared documents, shared documents folder, sites folder, utilities folder. [2650692]
The path to command now has a Classic domain constant that can be used with the from parameter. [2836501]
The run script command now supports the new bundled format for compiled scripts and applets. [3177719]
The shutdown folder constant has been renamed shutdown folder to prevent confusion with the shut down Finder command. [2748241]
The store script command can now store into any format script file including the new bundled format script files. In addition, store script can now create a new script file in bundled format (compiled script or applet) or data-fork format (compiled script only). When creating a new script file, the filename extension determines which format is created. Resource-fork script files can no longer be created using store script but existing ones can be updated. When storing a script into an existing file, the file must be a script file; previously, the file could contain anything and an 'scpt' resource was simply added to the file. [3177719]
The store script dialog box is now resizable and moveable. [3148202]
The store script dialog box now has a new title and default prompt. [2519050]
The osacompile tool now supports the new bundled format for compiled scripts and applets. If the -o option is specified and the file does not already exist, osacompile uses the filename extension to determine what type of file to create. If the filename ends with .app, a bundled applet will be created. If the filename ends with .scpt, a bundled compiled script will be created. Otherwise, the resulting script will be placed in the resource fork and/or data fork of the output file depending upon what other options are specified. [3150246]
The osacompile tool now has a -s (stay open) option. This option is only valid when a new bundled applet is being created. The option specifies that the applet should stay open after running. [3231791]
The osacompile tool now has a -u (use startup screen) option. This option is only valid when a new bundled applet is being created. The option specifies that the applet should display a startup screen when launched. [3231800]
The osascript tool now supports the new bundled format for compiled scripts and applets. [3150246]
The osascript tool now reports character range information when an error occurs. [3310364]
In AppleScript 1.9.1 and earlier, pathnames of alias objects may have problems if they contain non-ASCII characters. This has been fixed. [2765349]
Coercing miles, yards, or feet to inches now produces the correct result. Coercing cubic yards or cubic feet to cubic inches now produces the correct result. [3251787]
Coercions from typeUnicodeText to typeText or typeStyledText now handle byte-order-mark characters correctly. [3115555]
Coercions from typeStyledText to typeUnicodeText now handle coercion failures and warnings correctly. As a result of this change, the example scripts can now be opened in Script Editor when the primary language is set to Korean. [3309458]
An empty with timeout statement no longer causes a crash or stack overflow. [2354124]
An empty considering or ignoring statement no longer causes a crash or stack overflow. [3243780]
The statement paragraphs 2 thru -1 of "" no longer causes a crash. [3342312]
Getting the characters of a very long string no longer causes a stack overflow. [3016960]
Getting the text items of a Unicode string now works correctly. [3136465]
Getting the text items or paragraphs of an empty Unicode string now returns {""} instead of {}. [3198302]
Getting the text items of a string now works correctly when the text item delimiters are set to {}. [3146794]
The arbitrary element reference form some item wasn’t very random. This has been fixed. [3044302]
The contains and ends with operators now work correctly on strings with more than 32,767 characters. Previously, they would always return false if they did not find a match within the first 32,767 characters of the string. [3126655]
The containment operators now work correctly on Unicode strings when used within an ignoring punctuation statement. Previously, they did not ignore punctuation marks correctly when doing the string comparisons. [3328867]
The containment and comparison operators now work correctly on Unicode strings when used within an ignoring hyphens statement. Previously, they did not ignore hyphens when doing the string comparisons. [3329084]
The containment and comparison operators now work correctly on Unicode strings when used within an ignoring white space statement. Previously, they did not ignore white space when doing the string comparisons. [3330635]
The containment operators are now much faster when used on Unicode strings. [3204625]
Constant Unicode strings that are specified using the data class (i.e. «data utxt
») can now be coerced to typeUnicodeText and no longer cause a crash when used with the & operator. [3222690]
In certain circumstances, a run script command within a tell application "Finder" statement would cause a crash in previous versions of AppleScript. This has been fixed. [3380899]
AppleScript can now compile URLs that begin with https. [3113313]
AppleScript now compiles numbers larger than 4294967295 correctly. Older versions of AppleScript compile numbers larger than 4294967295 to their value minus 4294967296. [3247815]
Exponent math is now correct when the power is greater than 32767 and less than 65536. [3396181]
Adding a negative number to any date between 1/1/1904 0:00:00 and 1/19/1972 3:14:07 now produces the correct result. [3160911]
Subtraction operations involving dates earlier than 1/1/1904 0:00:00 now produce the correct result. [2861317]
Date arithmetic involving date object specifiers now works as expected instead of reporting an error that says the object specifier cant be coerced to a date. [3187787]
If an error occurs while attempting to connect to a remote machine, the actual error is now reported. Previously, connection errors were converted into a generic message saying that the applications dictionary could not be read. [3209734]
If a compilation error occurs near the end of a long script (more than 32,767 characters) the correct line is now highlighted in the script editor. [3089998]
Backslashes in strings now work correctly on Japanese systems. [3390330]
If a script tells an application that is not running to quit, nothing will happen. In previous versions of AppleScript, the application would be launched and then immediately be told to quit. [2589455]
AppleScript no longer crashes while attempting to unload an OSAX written in Objective-C. [3193941]
A crash that would occur in certain circumstances after garbage collection has been fixed. [3369338]
Memory leaks have been fixed. [3254901]
A couple of incorrect error messages have been fixed and a missing error message has been added. [3020705] [3290768]
AppleScripts default formatting has been changed. [3032595] If you have already used AppleScript on a given machine, you wont notice this change unless you do any of the following: choose Use Defaults from the Formatting dialog box in Script Editor delete your AppleScript preferences set up a new user (or log in on a user account that has never used AppleScript) do a clean operating system install without saving or retaining user preferences
The display dialog dialog box now handles the Return, Enter, and Esc keys correctly. [3044290] [3096706]
The display dialog command now reports an error if the default button parameter is set to 0, a negative number, or a number that is greater than the total number of buttons. [3051124]
The display dialog command now reports an error if a record is specified as the text to display. [3142086]
do shell script with administrator privileges now distinguishes between a cancelled authentication and a failed authentication. [3070647]
do shell script with administrator privileges no longer reports an authentication error if the admin user has no password. [2882577]
The info for command no longer returns the folder window for packages. The visible property is now correct for items whose name begins with a period. [2884166]
The list folder command no longer crashes when given a file instead of a folder. [3267269]
list folder without invisibles no longer lists items whose name begins with a period. [2767663]
In certain situations, the open for access command would try to create a file that already existed which would result in a duplicate file name error. This has been fixed. [2827608]
The open for access command can now create a file whose name contains slashes or colons (whichever is not the native path separator for the path style in use). [3267270]
The path to command now works correctly with the following folder constants: startup, startup items, startup items folder. [2650692]
Scripts that use the path to frontmost application command will now get the correct path when run from the Script menu. Previously, the command would return the path to System Events. [3084984]
The read command now works correctly when the file contains Unicode text and the before, until, or using delimiter parameters have been specified. [3013987]
If the run script command encounters an error while compiling the script, it now reports the actual error instead of a generic script error. [2304013]
A problem that caused the say command to hang has been fixed. [3196145]
The set volume command now sets the volume level correctly. [3268130]
the clipboard now works correctly if the as parameter is specified. Previously, the as parameter was almost completely ignored. [3255134]
the clipboard now works correctly if the as parameter is not specified. If the clipboard contains only one item, that item is returned. If the clipboard contains multiple items and at least one of the items is text, the highest quality text item will be returned. Unicode text is preferred over styled text which is preferred over plain text. If the clipboard contains multiple items but none of the items is text, the items are returned as a record. [3334818]
Several errors in the Standard Additions dictionary have been fixed. [2696269] [3034675] [3152145] [3292454] [3311842]
AppleScript 1.9.1 is included with Mac OS X version 10.2.3 and requires Mac OS X version 10.2 or later.
A new modeFlag has been added to the OSA API:
When this modeFlag is set on a call to OSACoerceToDesc(), the resulting descriptor will be fully qualified, that is, it will have as its outermost container (innermost 'from' object) an application descriptor. Historically this function assumes all object specifiers are rooted at the current application, which is often incorrect. [2879211]
In AppleScript 1.0 through 1.9, coercions from strings to numbers (e.g. "12" as integer) would fail if the string contained leading or trailing white space characters (e.g. space, tab, return, linefeed). This has been fixed. [2849044]
In AppleScript 1.7, the paragraph element of strings was improved to recognize Mac-style, UNIX-style, and Windows-style line breaks. The same changes were not, however, made to the Unicode text class. This has been done in AppleScript 1.9.1. [3013979]
In AppleScript 1.6 through 1.9, getting a paragraph or text item of an empty Unicode string fails with an error. In AppleScript 1.9.1 an empty string is now returned as the result. [3044226]
With AppleScript 1.7 through 1.9, some script-editing applications cannot open their own scripting dictionaries. This has been fixed. [2688067]
In AppleScript 1.9, long scripts (from about 3,000 lines, depending on complexity) would cause an out of memory error when being displayed. This has been fixed. [3016146]
In AppleScript 1.0 through 1.9, a long script (greater than 32,767 characters) could cause a crash when being compiled. This has been fixed. [2800857]
In AppleScript 1.0 through 1.9, an execution error that occurred near the end of a long script (greater than 28,671 characters) could result in multiple lines being highlighted in the script editor instead of just the line that caused the error. This has been fixed. [1342368]
In AppleScript 1.9 and earlier, comparing two strings will fail if one string contains more than 32,767 characters, even if the strings are obviously different. This has been fixed. [2655090]
In AppleScript 1.9 and earlier, the length of a long literal string (greater than 32,767 characters) is considered to be its actual length mod 32,768. This has been fixed. [2731384]
In AppleScript 1.6 through 1.9, compiling a script might cause it to unnecessarily launch an application referred to in a tell block of that script. This has been fixed. [2838223]
In AppleScript 1.9 and earlier, canceling out of an EPPC authentication dialog can cause compilation errors. This has been fixed. [3006076]
In AppleScript 1.8 through 1.9, the POSIX path property of a file or alias object would return "//" for the startup disk object. While not technically incorrect this has been disturbing to those familiar with UNIX, and has been fixed. [3006675]
In AppleScript 1.6 through 1.9, recording a script would crash on relatively rare occasions. This has been fixed. [3006033]
In AppleScript 1.9 and earlier, an AppleScript Studio application would crash in certain circumstances. This has been fixed. [3024472]
A crash in AppleScript 1.6 and later that occurred when using Unicode text has been fixed in AppleScript 1.9.1. [3025031]
In AppleScript 1.0 through 1.9, the expression end of {} has caused a crash. This has been fixed. [3014615]
The expression get name of parent would crash AppleScript 1.9 and earlier in certain circumstances. This has been fixed. [2865830]
Because of changes in the Sound Manager in Mac OS X, multiple beeps produced by the beep command in Standard Additions 1.6 through 1.9 have sounded like one long beep. This has been fixed. [2812503]
When the display dialog command is used with three buttons and an icon, the dialog box is now tall enough to correctly display both the icon and the leftmost button. [3052663]
In Standard Additions 1.6 through 1.9, the mount volume command could occasionally crash when supplied with user name and/or password parameters. This has been fixed. [3025436]
AppleScript 1.9 is included with Mac OS X version 10.2 and requires Mac OS X version 10.2 or later. It contains several new features and enhancements, and corrects problems found with AppleScript 1.8.3 and earlier versions.
AppleScript 1.9 can use scripts developed for any version of AppleScript from 1.1 through 1.8.3, any scripting addition created for AppleScript 1.5 or later for Mac OS X, and any scriptable application for Mac OS 7.1 or later.
A script created with AppleScript 1.9 can be used by any version of AppleScript back to version 1.1, provided it does not use features of AppleScript, scripting additions, or scriptable applications that are unavailable in that version.
In AppleScript 1.7 and earlier, the OSASetProperty() call would fail frequently. This has been fixed. [2786611]
Object references of the form <class> <string> have historically been sent to applications as by name object specifiers. In AppleScript 1.5 through 1.8.3, if the <string> was typeUnicodeText the object specifier would be sent as formAbsolutePosition. In AppleScript 1.9 and later, object references using Unicode strings are always sent to applications using formName. (Note that all other scalar types, including typeUTF8, are sent as formAbsolutePosition). [2768306]
Developers can now define application scriptability using an XML description, rather than old-style 'aete' resources or Cocoa .scriptSuite and .scriptTerminology plist files. This makes it easier to write and edit an application terminology. A new developer tool, /Developer/Tools/sdp, converts XML files with the .sdef extension into either .r files (for Carbon applications) or .scriptSuite and .scriptTerminology files (for Cocoa). In the future, AppleScript will read .sdef files directly, making this conversion unnecessary. See the man pages for sdp and sdef for more information. Some sample .sdef files are supplied in /Developer/Examples/Scripting Definitions. [2912639] [2913622]
The choose URL command now displays SMB and Samba servers when the File servers pulldown menu is selected. [2810506]
The mount volume command can now connect to any file server that is supported by the Finders Connect To... command, including Windows (smb), Samba, and FTP servers. On some kinds of servers, the as user name and with password parameters may not bypass the login dialog, but encoding the name and password in the URL (e.g. smb://myname:passwd@server.domain.com/sharename) will mount it silently. [2855789]
The say command supports a new optional parameter, saving to, which specifies a file in which to save the spoken text. If this parameter is provided, the command will be silent and will instead create an audio file with the data of the spoken text. For best results, the file extension of this file should be .aiff, which will make it useable with iTunes and other audio applications. [2898296]
The Script menu menu extra that has been available for download from the AppleScript web page is now included with Mac OS X. To activate the Script menu, open the AppleScript folder (in the Applications folder of your startup disk) and double-click on the ScriptMenu.menu folder. The Script menu will appear on the right side of the menu bar in all applications.
Like Script Runner in previous versions of Mac OS X, the Script menu lets you execute any script while using any application. It lists all files that are present in the Scripts folder of the Library folder of both your startup disk and your Home directory. Unlike Script Runner, the Script menu will execute both OSA scripts (saved by Script Editor) and UNIX scripts (shell scripts, perl scripts, etc.).
Folder Actions are now supported in Mac OS X. Folder Actions let you attach a script to a folder, and when that folder is opened or closed in the Finder or files are changed in it, a handler in that script will be executed.
In Mac OS X, Folder Actions are handled by the System Events application, not a separate Folder Actions extension. A property in the System Events application turns Folder Actions on and off; when theyre on, System Events is added to your Login Items list and starts up when you log in. Folder Actions will not be performed if the System Events application quits.
Actions are attached and removed from folders by sending commands to System Events. The same events that work with the Folder Actions extension on Mac OS 9 will work the same with the System Events application in Mac OS X; in addition, System Events supports an object model for managing actions on a folder. See the System Events dictionary for the complete set of Folder Actions events and classes.
The action events that are sent to action scripts are the same as in Mac OS 9. Terminology for these events can be found in the Standard Additions scripting addition.
There are some functional differences between Folder Actions in Mac OS X from the Mac OS 9 version. In Mac OS X, actions are assigned to folders on a per-user basis, so different users of the same machine can have different sets of actions. That means that actions attached to removable or shared disks will not take effect unless that action has been assigned on your specific user account. This is a security precaution. This also means that actions attached to folders in Mac OS 9 will not take effect in Mac OS X unless they’ve been specifically attached for a particular user account in X.
Folder badging works differently in Mac OS X than in Mac OS 9. When an action is assigned to a folder, no badge appears in Mac OS X; folders that have had actions attached in Mac OS 9 will have the Folder Action badge, but wont execute their actions unless they’ve been assigned to that user.
The contextual menu that assigns, removes, and edits Folder Actions in Mac OS 9 is not present in this version of Mac OS X. Example scripts to assign and remove Folder Actions are supplied in the /Library/Scripts/Folder Actions directory, and can be used directly from the Script menu.
Because of changes in the Finder, many Folder Action scripts from Mac OS 9 do not work in Mac OS X. [2865598]
In AppleScript 1.8.2 and later, certain errors in handlers of scripts loaded via the load script command would cause a crash. In AppleScript 1.9 these errors produce error messages instead. [2891612]
Operations that create large AppleScript objects (such as lists with thousands of elements) may fail when trying to display the object (for example, in the Results or Log window of Script Editor), though the operation itself succeeds. In AppleScript 1.8.3 and earlier this usually crashes; in AppleScript 1.9 it will signal an out of memory error. [2897872]
AppleScript automatically converts any result value that is returned as Unicode text in UTF-8 format into Unicode text. To convert a string value to the UTF-8 format, use the coercion as «class utf8» [2936516]
The do shell script command in Standard Additions 1.8.3 and earlier could not handle file paths that contained accented or non-English characters. This has been fixed. [2848082]
In Standard Additions 1.8.2 and later, the display dialog command does not activate the default text field when the dialog is displayed, so the user must click in it before typing. This has been fixed. [2915953]
With Standard Additions 1.8.3 and earlier, the the clipboard command would return an erroneous value when the text on the Clipboard did not have style information. If passed to other applications, that erroneous value could cause those applications to crash. This has been fixed. [2811798]
AppleScript 1.8.3 for Mac OS X is available as an independent Software Update and requires Mac OS X version 10.1 or later.
In AppleScript 1.8.2 and earlier, operations using AppleScripts text item delimiters fail if the delimiters are set to Unicode string values. This has been fixed. [2895572]
In AppleScript 1.8.2 and earlier, converting a list of values to a Unicode string will ignore any text encoding information in those values, so the resulting Unicode string will not be correct. This has been fixed. [2895579]
In Standard Additions 1.6 through 1.8.2, the as parameter for the read and write commands was not handled correctly (especially if the value of the parameter was short or a list). This has been fixed. [2751784, 2892057]
AppleScript 1.8.2 for Mac OS X is included with the April 2002 Developer Tools Update and requires Mac OS X version 10.1 or later.
The do shell script command and the scriptable Terminal allow AppleScript scripts to execute strings of text as UNIX shell scripts. The UNIX shell interprets certain characters specially (including single-quote, double-quote, dollar sign, slash, and backslash). In order to pass text containing these characters to the shell, they need to be quoted to let the shell know to process them literally, rather than apply its special interpretation. The property quoted form has been added to the string and Unicode text classes. The value of this property is the text enclosed in single quotes, with any single quotes in the string (such as apostrophes in filenames) handled by concatenation. In general, all POSIX file paths and most text parameters provided to shell commands should be quoted. A common use of this is in commands like:
The dialogs for display dialog and choose from list are now moveable modal dialogs and can be moved by the user. [2845800]
The do shell script command has a new altering line endings optional parameter. When this optional parameter is omitted or true, the result of do shell script will have Mac-style line endings (CR, ASCII character 13) and always be terminated by a CR; with this optional parameter set to false (i.e. without altering line endings), the results will have UNIX-style line endings (LF, ASCII character 10) and may or may not have a terminating LF. The default results are compatible with AppleScript 1.8.1, while the without altering line endings form returns the unaltered output of the UNIX script. [2850410]
In AppleScript 1.8.1 and earlier, using text item delimiters to extract text items from Unicode text can cause the application to crash. This has been fixed. [2848981]
In AppleScript 1.6 through 1.8.1, a script comparing two Unicode strings could occasionally crash the application running the script. This has been fixed. [2885328]
In AppleScript 1.8.1 and earlier, certain applications executing scripts can become unstable when coercing identifiers to strings in tight loops. This includes FaceSpan and AppleScript Studio applications. This has been fixed. [2858324]
In AppleScript 1.8 and 1.8.1, the Use Startup Screen menu item in script applications does not work. This has been fixed. [2844978]
In AppleScript 1.8 and 1.8.1 for Mac OS X, getting the POSIX path property of a directory would omit the terminating colon. This has been fixed. [2851963]
In AppleScript 1.1 and later, loading any script would cause a small memory leak. This has been fixed. [2852866]
With AppleScript 1.8 and 1.8.1, some applications that create and/or execute scripts (such as Script Debugger) will occasionally crash when trying to get certain information about a script. This has been fixed. [2811897]
In AppleScript 1.8 and 1.8.1, some applications that execute scripts that target themselves will crash unexpectedly. This has been fixed. [2839367]
On some rare occasions in AppleScript 1.8 (often during recording), the name of an application in a tell statement is changed to AEServer. This has been fixed. [2822232]
In all versions of AppleScript 1.5.5 and earlier, using the some operator on a record to select a type that does not exist in the record (e.g. some string of {a:2, b:3, c:{5, 7, 11}}) would return the entire record, rather than an error. This was fixed in AppleScript 1.6 for Mac OS 9, but has not been fixed in Mac OS X until now. [2842496]
AppleScript 1.7 could not open scripts saved on Mac OS 9 by any version of AppleScript if those scripts contained references to applications on remote machines. AppleScript 1.8 can open those scripts, but omits the first two characters of the host name. AppleScript 1.8.2 and later will correctly read and display an application reference created on Mac OS 9. [2781523]
Many commands in Standard Additions 1.7 through 1.8.1 adopted a new style of processing input parameters that refer to files. This was found to fail when used inside application tell blocks with application objects (such as Finder file objects). Those commands have been modified to work harder to understand file references in applications. [2840037]
The display dialog command now recognizes a user-defined button with the button name Cancel as the cancel button when the computer is using a non-English system. [2765410]
In Standard Additions 1.7 through 1.8.1, using lengthy button titles in the display dialog command could cause the prompt text to be truncated. This has been fixed. [2844857]
The performance of the do shell script command has been significantly improved when executing lengthy shell scripts. [2853370]
Prior to Standard Additions 1.7, the list folder command had a special case to accept a path string as its direct parameter (though it is documented to accept an alias). In Standard Additions 1.7, this special case was omitted, causing scripts that used the form list folder "Macintosh HD:" to fail. This special case has been restored. [2850766]
In Standard Additions 1.7 through 1.8.1, the open for access command would not set the file type and creator of newly-created files. This has been fixed. [2836047]
The run script command in Standard Additions 1.5 through 1.8.1 did not handle the in parameter correctly when choosing an OSA scripting component. It would in fact select the first OSA scripting component that was not the one named. This has been fixed. [2889646]
In Standard Additions 1.7, the write command signals an error -50 (parameter error) when a script attempts to write an empty string to a file. This has been fixed. [2823197]
In AppleScript 1.7 through 1.8.1, the osascript tool truncates output text if it contains a null character. This has been fixed. [2827241]
AppleScript 1.8.1 is included with Mac OS X version 10.1.2 and requires Mac OS X version 10.1 or later.
In Mac OS X version 10.1 and 10.1.1, installing certain multimedia software (such as Roxio Toast or QuickTime 5) would cause all AppleScript applets to crash when launching. This has been fixed. [2785067]
AppleScript 1.8 for Mac OS X is included with the December 2001 Developer Tools Update and requires Mac OS X version 10.1 or later.
In Mac OS X v10.1 and 10.1.1, scripting additions would have their initialization function called at application launch time, but their termination functions would not be called when the application quit. Scripting additions that used system resources would not get a chance to release those resources. Every scripting addition termination function is now called when an application exits. [2811696]
To provide better access to Mac OS Xs underlying UNIX functionality, AppleScript 1.8 adds a new Standard Additions command (do shell script), a new file property (POSIX path), and a new object (POSIX file).
The new do shell script command and the scriptable Terminal allow AppleScript scripts to execute strings of text as UNIX shell scripts. Many interesting shell commands act on files, and require POSIX-style file paths as input parameters. To create POSIX-style file paths from AppleScript file objects, the property POSIX path has been added to the file and alias classes. All file types, including file specification and file reference, support this property. Its use is straightforward:
The do shell script command and the scriptable Terminal allow AppleScript to execute UNIX shell scripts and get the results as strings of text. Frequently these strings are the pathnames of files in the UNIX format, i.e. starting at root with directory names separated by forward slashes. To convert these POSIX paths into an AppleScript file object, you can use the new POSIX file object:
The new do shell script command takes a string as its direct parameter and executes that string in a UNIX shell. The text can be anything from a single command with parameters to a long script. The results of the script execution (standard out) are returned as the result of the command; if there is an error (or no output), the error output (standard error) are returned as the error message and can be processed in an AppleScript on error handler. Note that the environment in which a shell script is executed is a separate process in the users process group, and does not have a terminal set up, so commands that require interaction (vi, top) will not function. There is no way at present to direct any information to standard in of a shell script. Note also that do shell script uses the sh shell, which is different than the default tcsh shell used in the Terminal. Command paths and environment variables are different in sh; youll need to adjust your shell scripts accordingly.
The system attribute command has been extended to provide information on the users environment variables. These are set up at user login time and cannot be altered. If the direct parameter to system attribute is a four-character Gestalt code, it is executed as in Standard Additions 1.7; if not, it attempts to get an environment variable by that name, returning either the value of the variable or an empty string. (Note that system attribute now will not fail with an error; it simply returns an empty string.) If called with no parameters, system attribute returns a list of all currently-defined environment variables.
AppleScript 1.7 could not perform certain operations on file names or file paths that contain certain characters (such as accented characters like é). This has been fixed. [2816363]
In AppleScript 1.7, references to the process class of the Finder on a remote machine did not work. This has been fixed. Note that you need to be running Mac OS X v10.1 or later on the target machine, and Mac OS X v10.1.2 or later on the machine executing the script. [2775419]
With AppleScript 1.6 and 1.7, applications that attempted to convert Unicode text to plain text would get an error (though AppleScript itself could perform such conversions successfully). This prevented older applications from being able to use information (such as file names) that is now supplied as Unicode text. This has been fixed. [2816500]
Certain development environments can create scripts whose parent is an application object, rather than a top-level script. Attempting to get any parent properties of such objects (including the information returned by OSAGetScriptInfo) would cause AppleScript to crash. This has been fixed. [2755096]
With AppleScript 1.7 in Mac OS X v10.1, applets that are set to show their startup (splash) screens occasionally failed to do so. This has been fixed in AppleScript 1.8. The applications do not need to be recompiled or re-saved. [2756226]
In Standard Additions 1.7, the description of the choose application command stated that it allows users to choose a running application. On Mac OS X it allows users to choose any application, running or not. [2785713]
In Standard Additions 1.7, using the mount volume command with an AppleTalk server name in the on server parameter did not work. This has been fixed. [2656820]
In Standard Additions 1.7, if the path to command was requested to return the path of a folder that did not exist (such as scripting additions folder from local domain), it would fail. In previous versions, and now in 1.8 as well, it creates the folder and returns the path to the created folder. Note that if the user does not have authorization to create the folder (e.g. is not an administrator and requests a nonexistent folder in the System domain), the operation will still fail. [2751119]
In Standard Additions 1.7, the store script command would crash if no in parameter was supplied. This has been fixed. [2782590]
Previous versions of Standard Additions improperly list the parameters for the store script command. Both the direct parameter (the script) and the in parameter (the file) are optional. If the script is omitted, an empty script is stored in the file; if the in parameter is omitted, the user is prompted for a file name. [2784735]
The osacompile tool would fail if provided with a -i parameter specifying a nonexistent file. Its now more lenient and issues a warning, but continues compilation. [2796415]
AppleScript 1.7 is included with Mac OS X version 10.1 and requires Mac OS X version 10.1 or later.
The return value from the OSAScriptError() function historically returned an error range that was a record of two short integers, and therefore could not accurately report errors in scripts longer than 32K. AppleScript 1.7 returns a record of two typeLongInteger values. Existing code that gets these values as typeLongInteger will now work correctly; applications that asked for short integers will continue to get erroneous results on long scripts and should be revised to accommodate the new return value.
To support a wider variety of sources of script text, the compiler in AppleScript 1.7 accepts all three prevalent styles of line endings: Macintosh style (carriage return, ASCII 13), UNIX style (linefeed, ASCII 10) and Windows style (CRLF, ASCII 13-ASCII 10). Decompiled source will continue to be Macintosh-style.
Every event sent by AppleScript to an application or scripting addition now includes an enumConsidsAndIgnores ('csig') attribute whose value is a typeUInt32 bit field with bits set for every consideration or ignore currently in effect. Mask constants are defined in ASRegistry.h. This attribute obsoletes the older enumConsiderations attribute, which is difficult to interpret, incomplete, and is only sent with events that contain a whose clause.
The kAESave and kAEClose Apple events have been defined in the Apple Event Registry to accept a typeAlias value in their in and saving in parameters. This is technically inaccurate as scripters may specify files that do not exist for these parameters, and typeAlias cannot represent a file that does not exist. The historical solution has been to supply a typeFSS value (or a cFile value which is coerced to a typeFSS) and create the file using the file specification. In Mac OS X, however, file specifications are not valid values in Apple events, as they cannot represent long or Unicode file names and are not necessarily valid across processes. For AppleScript 1.7 and later, applications should get these parameters as typeFileURL and use the sample code provided in Tech Note TN2022 to find or create the file it represents.
Program Linking: Program Linking now works between Mac OS X machines as well as between Mac OS 9 and Mac OS X machines. When targeting applications running on a Mac OS X machine, you must use TCP/IP networking and addressing; AppleTalk is not supported. (In addition, AppleScript 1.7 now supports encoding the login name and password into the eppc URL.) For a Mac OS X machine to respond to Program Linking requests, Allow Remote Apple Events must be enabled in the Sharing panel of System Preferences.
SOAP and XML-RPC Support: AppleScript can now use Internet applications as targets of tell blocks. The URL for the application reference must be a correct URL for a SOAP (Simple Object Access Protocol) or XML-RPC (eXtended Markup Language Remote Procedure Call) Web server. The syntax is:
An alternate syntax is:
but this form will be converted to the form above when the script is compiled.
File Extensions: Like most other Mac OS X functions, AppleScript now supports file extensions (as well as the historical file types) on all the file kinds it deals with. The file types for AppleScript are:
Applets: Prior to AppleScript 1.4.3, script applications (applets) were stored in a universal format that worked on both 680x0-based and Power PC-based Macintosh models. Because that format was 680x0-based, it would not work on Mac OS X, so a Mac OS X applet format was introduced in AppleScript 1.4.3. With improvements in Mac OS X since that time, it is now possible to produce a script application that works on 680x0-based, Power PC-based Mac OS 9, and Mac OS X configurations. Script Editor 1.7 again offers only one choice for saving script applications. Older formats continue to work on the configurations they were saved for.
Command Line Tools: The osacompile and osascript tools now have an include option (-i) that allows you to specify application terminology to be used when compiling the given scripts. This frees you from having to specify applications in tell blocks in the script itself. You can also use this to specify the static terminology for an application with dynamic terms, so you can prevent that application from being launched when you compile the script.
In AppleScript 1.5 through 1.6, a scripts global variables could be lost under certain rare circumstances. If a script contains a tell block that targets a variable, and that variable specifies an application that does not exist, the Where is application AppName? dialog would be presented when the script is executed. After that point, further references to global variables in the handler that included the tell block would fail. This has been fixed.
In AppleScript 1.5 and 1.6 for Mac OS X, scripting additions behaved fundamentally differently than in Mac OS 9: they were only installed in certain applications that were AppleScript-aware. If a scripting addition command (such as display dialog) was sent to an application that was not AppleScript-aware, the event would instead be executed in the application running the script (e.g. Script Editor); that means the dialog would come up in the Script Editor layer, not the tell target application. In AppleScript 1.7 for Mac OS X, the scripting additions mechanism has been redesigned to behave more like Mac OS 9, and scripting addition commands sent to applications will be executed in the process space and window layer of the target application.
AppleScript 1.5 through 1.6 often launched applications unnecessarily in order to get their terminology, and often used the terminology of the script editing application (such as Script Debugger) instead of application terminology. This has been fixed.
In AppleScript 1.5 through 1.6 for Mac OS X, the version property of AppleScript or an application would be displayed as raw data rather than a string (unless the version property was explicitly converted to a string). This has been fixed.
In AppleScript 1.5 and 1.6 for Mac OS X, certain operations with file object specifiers (e.g. file "Mac OS X:Applications:Terminal.app:" as alias) would fail, when similar operations would succeed on AppleScript 1.3 through 1.6 for Mac OS 9. These operations now work in AppleScript 1.7 for Mac OS X. Note that, as always, while you can pass a file object specifier as a parameter to an event, or perform certain operations on it (like assignment and coercion), simply evaluating file "pathname" is itself an AppleScript error.
AppleScript 1.5 and 1.6 for Mac OS X could not target Mac OS 9 control panels running in the Classic environment. This has been fixed. Note that the Classic environment only supports a small number of control panels from Mac OS 9 (such as the Launcher).
Accessing paragraphs of AppleScript strings did not work correctly in AppleScript 1.5 through 1.6 if the line endings were Windows-style (CRLF). The result would be only the first half of the text paragraphs, interspersed with an equal number of blank strings. This has been fixed.
Occasionally with AppleScript 1.5 and 1.6, recompiling a script would get an end of file error reading an applications terminology. This has been fixed.
In AppleScript 1.6, under certain circumstances calling a handler in an applet that has not been launched could cause a Cannot continue error. This has been fixed.
In AppleScript 1.6, Unicode text values stored in script properties of a saved script could not be reloaded reliably. This has been fixed.
In AppleScript 1.6, Unicode text received from certain applications that included a Unicode byte-order mark would behave incorrectly; the text would appear to begin with the Euro symbol, and some operations would fail. AppleScript 1.7 handles Unicode text with byte-order marks correctly.
In somewhat rare circumstances, comparing two references to the same file for equality can fail even if both references refer to the same file. This is true in AppleScript 1.0 through 1.6 and has been fixed in AppleScript 1.7.
In AppleScript 1.5 and 1.6, a running AppleScript applet will become non-responsive to any events (except command-period) after processing more than one incoming event. This has been fixed.
All disks formatted as Enhanced Macintosh File System (HFS Plus) are able to store files with file names greater than 32 characters and stored as Unicode text. When older software accesses such files, those names are represented in an encoded form (with something like #28AF in the name). With AppleScript 1.6 and earlier, the results of many Standard Additions commands (like path to, info for, and list folder), as well as creation and display of alias objects, would require and return encoded names. In AppleScript 1.7, long and Unicode file names in aliases and for scripting additions are represented by styled or Unicode text. Encoded file names are no longer supported.
In Mac OS X v10.0 through 10.0.4, the choose file name command in Standard Additions 1.6 would crash if given an empty string ("") as the default file name. This has been fixed. In addition, on Mac OS X the default file name can be a Unicode string.
The choose from list command in Scripting Additions 1.4 through 1.6 allowed the scripter to create a situation where it would return an empty selection even if the scripter specifically disallowed that case. (This can be done by supplying a default item that does not appear in the list). In Scripting Additions 1.7 and later, the OK button will not be enabled in such cases.
In versions of Standard Additions prior to 1.7, the choose URL commands using editable URL parameter was present in the Scripting Additions dictionary but was nonfunctional (URLs were always editable regardless of the setting of the parameter). It now behaves correctly: if set to false, the user can choose a URL only by browsing, not by editing the URL in the text box.
In Mac OS X, the info for command now returns additional record items that provide information about the files extensions. The displayed name item returns the name of the item as the user sees it in the Finder or file dialogs, and the name extension item now returns the file extension (if any) that is on the indicated file (without the ., which is considered a separator, and not part of either the name or the extension). Both of these fields (along with the name field itself) are Unicode text values.
Mac OS 9.1 and Mac OS X Public Beta introduced the concept of a package, that is, a file composed of a folder of several files and folders, which is treated as an integral file by the Finder and other applications. The info for command in AppleScript 1.6 and earlier treated such packaged data application files as folders, not files, and would not return file- or application-related information about them. In Standard Additions 1.7 and later, getting the information for any directory (including package folders) returns an additional record item package folder (if this Boolean value is true, then the directory is a package), and the files type and creator.
In Standard Additions 1.6 and earlier, the info for scripting addition would fail if any piece of information in the requested file or directory was unavailable. On UFS (Mac OS X) disks and mounted NFS volumes, the file creation date is unavailable, and accessing it causes a -8850 error (in trying to convert it to Universal Time). Starting with Standard Additions 1.7, any missing piece of information in the info for result is provided as the value missing value without failure. In AppleScript 1.6 and earlier, magnitude comparisons (<, ≤, >, ≥) against the missing value would signal a coercion error for most types; in 1.7 and later, these comparisons always return false without error. These two changes ensure that scripts that use info for against UFS and NFS volumes do not fail, though they may not get correct results because any comparison to the creation date is always false.
In Standard Additions 1.6 on both Mac OS 9 and Mac OS X, the info for command would return an error -1401 for a nonexistent file, rather than the normal -35 returned in previous versions. In Standard Additions 1.7, trying to get the info for a nonexistent file (or a file in a nonexistent directory or inaccessible disk) will return the -35 error.
From AppleScript 1.1, the offset command has not worked correctly when the direct parameter is styled text. It also has not worked correctly with the newly-introduced Unicode text type. It now produces correct results with both styled and Unicode text.
Standard Additions 1.5 through 1.6 changed the way that the random number seed worked in the random number command. Older versions used the system clock as the seed value if no seed value (or a seed value of 0) was provided; Scripting Additions 1.5 and 1.6 always use a seed value of 0 in these cases. In Scripting Additions 1.7 the older behavior has been restored. In addition, the seed value is now taken from the 60Hz ticks counter rather than the system clock, because the increased speed of new machines makes it more likely that two consecutive random number calls may receive the same system clock time as their seed value.
The read command in Scripting Additions 1.6 had specific problems with the using delimiters parameter. In previous versions, read f as list using delimiters {tab} would return a list, but in AppleScript 1.6, it returns a list of one-item lists. In AppleScript 1.7 and later it behaves as it did prior to version 1.6
The read command in Scripting Additions 1.6 had specific problems with the before and until parameters if used in conjunction with the as parameter. Instead of returning a value of a given type, it would return random data or an error. This has been fixed.
For the osacompile and osascript tools, the requirement that they be invoked with full paths (i.e. /usr/bin/osacompile) has been eliminated. They can now be invoked with implicit paths like any other command-line tool.
In Mac OS X v10.0.0 through 10.0.4, the -l and -d options for the osalang tool did not work as documented. In Mac OS X v10.1 and later, -l prints the subtype, manufacturer, flags, and name; and -L also prints the description in parentheses after the name.
The osacompile and osascript tools previously had a limit of 32K of input text. This limit has been lifted in Mac OS X v10.1.
The osacompile and osascript tools execute as background applications; they cannot involve any user interface. If you want to call display dialog, choose from list, or other user-interface scripting additions from a script being executed by osascript, you must enclose it in a tell block targeting a running application (such as the Finder).
AppleScript 1.6 is included with Mac OS X version 10.0 and requires Mac OS X version 10.0 or later.
A new call, OSACopyScript(), will create an independent clone of an existing OSAID. OSACopyID(), by comparison, creates a new reference to an existing object.
Event handlers have always been able to accept an as parameter, but have had no way to indicate to AppleScript that they handled the coercion. This creates problems when the handler actually returns a list of the requested type -- AppleScript thinks the list needs to be coerced, and tends to either fail or do the wrong thing. The workaround has been to define a type list type and a coercion handler from that to a plain list that simply duplicates the descriptor. The Finders alias list type, for example, is implemented this way. There is now a better way: if you take an as parameter, and you do not want AppleScript to try to coerce your result, put a Boolean true value into the keyAppHandledCoercion parameter of the result. AppleScript will sense this parameter and leave the result unchanged.
Mac OS X does not support scripting additions (OSAXen) built for Mac OS 9. Because only applications can safely link to CarbonLib on Mac OS 9, scripting additions on 9 must link to InterfaceLib, which is not supported on Mac OS X. Scripting additions for Mac OS X come in two flavors: CFM and Mach-O. For CFM, follow the directions in Tech Note TN1164 to build it as a shared library, but link to CarbonLib instead of InterfaceLib.
Mach-O scripting additions are packaged as bundles. Using Project Builder, create a Bundle target, and make sure that it has either a CFBundleSignature of 'osax' or a name ending with .osax. The code layout is essentially the same as a CFM scripting addition, but instead of using the CFM initialization and termination routines plus the gAdditionReferenceCount global, AppleScript looks for three entry points: SAInitialize, SATerminate, and SAIsBusy, with the following prototypes:
additionBundle is a reference to your own addition; you may retain it for future use or ignore it and rely on your own bundle identifier. SAIsBusy is equivalent to testing for gAdditionReferenceCount not equal to zero.
It is possible to build a bundled scripting addition that contains both 9 and X versions, thus giving you a single file distribution, but you need to have AppleScript 1.6 and CarbonLib 1.3 installed on Mac OS 9.1 for it to work with Mac OS 9.
An important difference from Mac OS 9 is that in Mac OS X, scripting additions are loaded separately into each application that connects to AppleScript. This means that (1) there may be multiple instances of your addition running on the system, so be careful about shared resource management; and (2) you cannot assume that any random application has access to your addition, so sending raw AppleEvents to an application will not necessarily work. (e.g., sending syso/beep to the Finder will return not handled.) AppleScript has a workaround built into it so that scripts will still work, but applications that use AppleEvents directly may have trouble.
The Unicode text data type has been growing in functionality since AppleScript 1.3 and is now comparable in functionality with the string data type. Not only can Unicode text strings be received from and sent to applications, they display properly in the Results and Event Log windows of the Script Editor (and third-party editors); they can be accessed with the character, word, paragraph, and text item element classes and the first, last, middle, some, and every access forms; they can be operated on with the & (concatenation) operator; and they can be compared with the less than, greater than, less than or equal to, greater than or equal to, equals, contains, is contained by, begins with, and ends with operators. For text item elements of a Unicode string, the text item delimiters can be either string or Unicode text values. When comparing Unicode strings, the considering and ignoring constructs are supported for case, diacriticals and punctuation.
AppleScript 1.6 supports many changes in general system operation introduced in Mac OS X. It can use applications and scripting additions that are stored as bundles or packages for Mac OS X. It can load scripts and application terminologies from files that do not have traditional Mac OS resource forks. It accommodates the fact that many Mac OS X applications actually have a .app filename extension that is hidden from the user.
There are two new command line tools, osascript and osacompile, that let you execute and compile scripts from a Unix shell. For full details, see their respective man pages.
AppleScript 1.6 fixes a long-standing issue in AppleScript in which scripts may claim to run out of memory, even when plenty of memory is available.
AppleScript 1.4.3 and 1.5.5 had rare issues with applets losing track of global variables; these issues have been fixed in AppleScript 1.6.
AppleScript 1.6 returns more correct results from certain unusual operations (item 0 of a list, set text item delimiters to {}, strings of a string, strings of a list that doesn’t contain strings) where previous versions of AppleScript would return unhelpful results or fail to signal appropriate errors.
AppleScript 1.6 has improvements to the random number command, to make random numbers more evenly distributed and less predictable.
The read and write commands can now work with files greater than 2 GB in size. In addition, all of the issues introduced in the Read/Write commands in AppleScript 1.5 and 1.5.5 have been fixed, and several long-standing issues with reading and writing lists and records have been fixed.
Copyright © 2001-2007 Apple Inc.
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-31)
|