Saturday, December 20, 2014

#1 2001-09-22 10:13:49 am

Bill Cheeseman
Administrator
Registered: 2006-06-29
Posts: 158

AppleScript 1.5.5 (Mac OS 9.1)

NEW BUGS IN MAC OS 9.1

There are a number of reported new AppleScript bugs in Mac OS 9.1.

The announcement of AppleScript 1.5.5 from The AppleScript Team noted that certain operations on Unicode text (concatenation, equality testing, word or character access) will cause an error or crash. This will be fixed when Mac OS X is released (scheduled for March 24, 2001). See Unicode AppleScript Text Coercions May Fail (TIL #106096 1/4/01, updated 1/16/01).

The same announcement reported that, [d]ue 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. This, too, will be fixed when Mac OS X is released. Chris Nebel addressed this issue as early as October 24, 2000 in a message to the AppleScript-Users mailing list, reporting that read/write is fundamentally broken in a number of ways, especially when it comes to reading and writing lists and records as binary data. I think it works for flat lists, but nothing else. A workaround is to use Sigma's Coercions or some other third-party solution.

Mac OS 9.1: Dialog Box Does Not Cancel on First Attempt (TIL #106091 12/19/00, updated 1/9/01) reports that in Mac OS 9.1 the AppleScript dialog box asking you to locate an application if the application cannot be found reopens after you click Cancel. The workaround is to click Cancel three or four times. This problem reportedly also existed in AppleScript 1.4.3 (Mac OS 9.0.4). I have found at least one other dialog that behaves in this fashion, in an Apple scripting addition, so I wonder if it may be a CarbonLib bug. 2/28/01

A number of users have reported that the Path To command in the Standard Additions scripting addition has problems when invoked inside a Finder tell block, at least with respect to the Startup Disk special folder. Workarounds include moving the Path To command outside the Finder tell block and using the Finder's own command for obtaining the path to the startup disk.

A number of users have reported that the File or other menu titles in Script Editor sometimes flash rapidly. Mr. Tea pointed out that what triggers this misbehavior is the use of a command-key equivalent to exercise a menu command. The flickering stops when you switch to another application and back. It appears to be harmless, if somewhat distracting. Contrary to my earlier belief, it is not cured if you install CarbonLib 1.2 or 1.2.5. I have seen it happen in other Carbonized applications, as well. Some report that it is caused by an interaction with Leonard Rosenthol's OSA Menu; he is working on an update. 2/28/01

On January 19, 2001, Chris Nebel confirmed on the AppleScript-Users mailing list a reported bug in Mac OS 9.1 in which the Status property in the Remote Access configuration class defined in Network Setup Scripting does not work correctly.

On October 7, 2000, Chris Nebel confirmed on the AppleScript-Users mailing list a reported bug in Mac OS 9.0.4, which persists in Mac OS 9.1, causing your Mac to appear to freeze (actually, to slow down significantly) if you click on the menu bar after double-clicking an already-running applet. On December 10, 2000, Chris indicated that this was actually a pair of bugs, one in the applet shell and one in the default active proc, which he expects to fix for the upcoming release of AppleScript to coordinate with Mac OS X. If you encounter this obscure bug, workarounds are to let the applet's run handler complete or terminate the applet with command-period.

There have been reports of problems using Apple Data Detectors (ADD) in Mac OS 9.1, at least on newer computers. ADD works correctly for me on a PowerBook G3 Series (Wallstreet). 1/23/01

Apple's Chris Nebel reported that the improved random number generator in 1.5.5 also changed the seed behavior, so the manual is incorrect. In 1.5.5, if you use 'with seed 0', it actually resets the seed to zero. Also, it used to be that if you didn't supply a seed at all, it would use the current time as the initial seed; now it uses zero.... [Y]our best bet is to use the time as seed.  In the startup of your script, say 'random number with seed time of (current date)'. Then use just 'random number' (i.e., with no seed) when you need a random number. 9/22/01

Chris Nebel gave some details on formatting bugs that plague the use of long prompt strings in the Choose From List command in Standard Additions. The real problem is that choose from list doesn't use anything even resembling a line-breaking algorithm to figure out how many lines the prompt is: it just calls StringWidth and divides by the width of the dialog (which depends on how long the list items are; see below.) This means that (1) depending on how the word wrapping works out, you might lose a couple of words off the end, and (2) because StringWidth considers carriage returns to take up no space, you get completely incorrect results if the prompt contains one. On a related point, Chris stated that the maximum visible number of items in the list depends on your screen size, actually. AppleScript 1.4 always used a list big enough for 12 items, no matter how many items you gave it. 1.5.5 adjusts the height of the dialog to show all the items that will fit.... It doesn't take the prompt height into account, so a very long prompt combined with lots of short items will push the buttons off the bottom of the screen. Chris indicated that these problems would persist in AppleScript 1.6 but might be resolved in a later versioin. 9/22/01

Some reported issues aren't really bugs:

Some users have complained of errors when using commands in Standard Additions or other scripting additions. Others have reported, however, that this is merely a side effect of disabling the various security-related extensions that now must be active in the Extensions folder. These extensions are: Security Cert Module, Security Library, Security Manager, Security Policy Module, and Security Storage Module. Reportedly, only the Security Library must be enabled to make Standard Additions work correctly. 1/23/01

Jon Pugh has noted that the old trick of placing a dummy ObjectSupportLib folder in your extensions folder, to prevent ill-behaved installers from installing an unneeded copy of the library file, prevents installation of Mac OS 9.1. If you use this trick, remove or rename the folder before installing Mac OS 9.1, then reinstate it.

Two of the special folders recognized by the Path To command in the Standard Additions scripting addition are still named At Ease applications folder and At Ease documents folder, although At Ease has been eliminated (or renamed) in favor of the more general multiuser capability. Path to At Ease applications folder returns an alias to the Applications (Mac OS 9) folder under Mac OS 9.1, and path to At Ease documents folder returns an alias to the Documents folder, both at the root level of your startup disk. 1/28/01

I have noticed that use of the Finder's Computer command apparently now sometimes requires placing it in parentheses to avoid a runtime error. For an example, see the script for testing system versions in the Testing Whether AppleScript 1.5.5 is Installed section, above.

Offline

 

#2 2001-09-22 10:16:10 am

Bill Cheeseman
Administrator
Registered: 2006-06-29
Posts: 158

Re: AppleScript 1.5.5 (Mac OS 9.1)

APPENDIX (RELEASE NOTES)

The following is the full text of the announcement of AppleScript 1.5.5 from The AppleScript Team to the AppleScript-Users mailing list on January 9, 2001:

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 today's 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:

Applescript:


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.

Offline

 

#3 2001-09-22 09:53:29 am

Bill Cheeseman
Administrator
Registered: 2006-06-29
Posts: 158

Re: AppleScript 1.5.5 (Mac OS 9.1)

PRODUCT UPGRADES FOR MAC OS 9.1 COMPATIBILITY

Products relating to AppleScript that have been upgraded or released to work with new and changed features of Mac OS 9.1 are listed here:

Late Night Software's Script Debugger 2.0.4 is an upgrade released on January 18, 2001, making this high-end AppleScript editor and debugger compatible with Mac OS 9.1 and adding new features and bug fixes.

A report that Facespan 3.5 will no longer save a project as run-only under Mac OS 9.1 is incorrect. 1/23/01

Offline

 

#4 2001-09-22 09:55:21 am

Bill Cheeseman
Administrator
Registered: 2006-06-29
Posts: 158

Re: AppleScript 1.5.5 (Mac OS 9.1)

NEW FEATURES IN APPLESCRIPT 1.5.5
Like many of its predecessors, AppleScript 1.5.5 contains both bug fixes and a significant number of new features. The following new features in or affecting AppleScript 1.5.5 are notable (many of the descriptions in this note are paraphrased or quoted from the Mac OS 9.1 Technote, but they are rearranged for convenience and sometimes provided with additional commentary from me; others derive from other sources and my own investigations):

The Process Manager is at long last entirely written in native PowerPC code. This reduces task swapping overhead and improves overall system performance. In particular, switching between applications and Apple events performance has been improved. The speed increase may not be noticeable to the unaided eye, however.

A number of scripting changes in Finder 9.1 have been introduced, as described in The Scriptable Finder, below.

Several files in the core AppleScript family have been updated, including Script Editor 1.5.5, Folder Actions 1.5.5, Folder Actions Menus 1.5.5, and Standard Additions 1.5.5. In addition, some but not all of the Folder Action Scripts in the Scripts folder have been updated from version 1.0 to version 1.4 (but I haven't discovered the reason). 1/23/01

AppleScriptLib has now been folded into the System file and should no longer be present in your Extensions folder as a separate file.

There is a new scripting addition application, Sound Scripting, which allows you to control many settings available through the Sound control panel. You can get a list of your Mac's alert sounds and set a new alert sound, list available sound input and output devices and sources and set them, get and set the input gain and output volume, and enable and disable playthrough. The Set Volume command still exists in the Standard Additions scripting addition, but the new Sound Scripting osax lets you get as well as set the volume. On my PowerBook, Sound Output Device and Sound Output Devices return no result, although the built-in speakers work just fine.

The Startup Disk control panel application is now scriptable, allowing you to get or set the startup disk as well as the startup system folder on a disk having more than one system folder. It can also be used to determine whether your machine started up from the network (NetBoot) or locally. Unfortunately, as many have reported, Script Editor won't compile any of the Startup Disk application properties, even though it can read the Startup Disk dictionary. Using the raw class codes within chevrons does not cure the problem and doesn't appear to be a workaround. Oddly, at least one third-party editor, Scripter 2.5, will compile and run Startup Disk scripts correctly, although the Localboot property returns no value.

A copy of WhatRoute 1.7 is included with Mac OS 9.1. This is a free scriptable application by Bryan Christianson based on the UNIX traceroute command. Using AppleScript, you can query, ping or trace IP addresses or domain names, using a simple command such as 'trace http://www.macsurfer.com.' Unfortunately, this apparently only triggers the operation, rather than returning a usable result; you have to examine the result in the application's window. The Mac OS 9.1 installation CD contains WhatRoute in the WhatRoute subfolder of the CDExtras folder. If you download the Mac OS 9.1 updater, you can obtain WhatRoute by using Apple's unsupported TomeViewer utility to extract it from the Mac OS 9.1 system software tome file, or, if you prefer, by downloading it from The WhatRoute Page. The WhatRoute documentation is useful, but it says nothing about AppleScript support. 2/6/01

The Mount Volume scripting addition command will now look in the Keychain to see if there is a password for the requested server. Note, however, that it will only find passwords associated with the particular connection protocol invoked. I have found a few problems with this feature, particularly when a server has multiple volumes. 2/11/01

In AppleScript 1.5 and later, Unicode string functionality is extended so that Unicode text can be displayed in script editors if the appropriate fonts are installed in the system. In addition, AppleScript correctly converts Unicode strings of mixed languages to the appropriate language-specific characters if the necessary Language Kits are installed. However, certain operations on Unicode text can cause AppleScript to crash or hang, and Apple therefore advises that you convert Unicode text to a string before attempting to manipulate the text in any way. See Unicode AppleScript Text Coercions May Fail (TIL #106096 1/4/01, updated 1/16/01). In the announcement of AppleScript 1.5.5 from The AppleScript Team, this was elaborated: Unicode support 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. This will be fixed when Mac OS X is released (scheduled for March 24, 2001).

As of AppleScript 1.5 and later, a script saved as a Mac OS X Applet will work on Mac OS X Public Beta and later. This feature did not work in earlier versions of Script Editor because the format of Mac OS X applets was subsequently changed in Mac OS X Public Beta.

Command-clicking the title of a background script window within Script Editor now lets you move the window without bringing it in front of other Script Editor windows, in accordance with Macintosh user interface guidelines for command-dragging background windows. The anomalous behavior of AppleScript 1.4.3 bringing up a menu showing the path to the script has been removed with respect to background windows. 1/23/01

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 command 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. Note, however, that the dictionary still describes the result as an integer in the description of the File Information class. If you get the Class of the size property for any item, however, it correctly returns Real. (The Size and Physical Size properties in the Finder also return real numbers, but both the Finder dictionary and the Class property incorrectly describe them as integers. This bug in the Finder has existed for some time and is not fixed in Mac OS 9.1.)

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.

Apple System Profiler has numerous AppleScript-related improvements, as well as some minor dictionary changes described in the Dictionary Changes section, below.

There are additional changes relating to Mac OS 9 packages and other features that relate primarily to use of AppleScript in Mac OS X. However, even on Mac OS 9 it is interesting to note that packages are supported by Script Editor.

USB Printer Sharing now requires an AppleScript to set the network neighborhood. Setting the neighborhood via entries in the Search Domain area of the TCP/IP control panel no longer works with the new version 1.1.3 of NSL. The required AppleScript lives in the Mac Help folder; open the Sharing a USB printer topic and click the diamond-shaped icon labeled Set my network neighborhood to run this script (it is saved as run-only, so you can't examine it). See Mac OS 9.1: Changes to USB Printer Sharing 1.0.1 (TIL #106104 1/8/01, updated 1/10/01). This apparently extends beyond USB Printer sharing to Services Location Protocol issues generally. See Mac OS 9.1: Services Location Protocol (SLP) Changes (TIL #106106 1/8/01, updated 2/2/01). 2/11/01

Paul Berkowitz pointed out that the dialog posed by the Choose From List command in the Standard Additions scripting addition sports an attractive new appearance. The dialog expands vertically to accommodate very long prompts. Very long list items are accommodated by widening the dialog and compressing the text.

I understand that iTunes, the splashy new MP3 utility available as a separate download from Apple, will be scriptable in its next release. It is derived in part from SoundJam from Casady & Greene, which was scriptable. Several users have pointed out that you can script iTunes if you know the raw event codes from SoundJam. 2/11/01

My personal favorite new feature of the full Mac OS 9.1 install disk is WorldText 1.0, a fully-Unicode capable text editor with a Typography Palette that gives you access to all of the typographic features of ATSUI, the font tools from the old QuickDraw GX. I am pleased to report that WorldText is scriptable. I am not pleased to report that its dictionary is nothing more than the standard dictionary installed by the development environment that was used to create WorldText. You can do generic things like getting the name of the first window, but you can't do much else with WorldText using AppleScript. If you make use of WorldText, be sure to install the new Unicode-ready version of Key Caps and the keyboards in the Unicode folder of CD Extras on the installation CD. 2/11/01

Offline

 

#5 2001-09-22 10:11:52 am

Bill Cheeseman
Administrator
Registered: 2006-06-29
Posts: 158

Re: AppleScript 1.5.5 (Mac OS 9.1)

FIXED BUGS

Important AppleScript-related bug fixes in Finder 9.1 are described in the discussion of The Scriptable Finder, above.

Dragging the proxy icon on a Script Editor window's title bar, a feature introduced in AppleScript 1.4.3, now correctly moves a saved script file to the indicated destination.

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, providing similar large numbers as the seed parameter to the Random Number scripting addition command would would consistently produce the same initial random value. In AppleScript 1.5 and later, large seed values, such as the system date and time, produce more evenly distributed initial values.

The Randum Number command also now always produces a result within the designated range. Formerly, it could occasionally return a result slightly larger than the upper bound of the range.

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. This has prevented people from using tricky constructs such as items 1 thru 0 of a list. However, a construct like items 1 thru -2 of {1, 2, 3} still correctly generates a result of {1, 2}.

In AppleScript 1.4.3 and earlier, creating a script object with neither an explicit nor an implicit Run handler, but having as its parent property a script with an implicit Run handler, would work in the Script Editor but crash if the script were saved as an applet. 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 ColorSync 3.0.3, it is now possible to set the device model property of a profile by way of AppleScript commands. These commands existed before, however they did not work as expected.

In PlainTalk, a problem where the effects of the Make this application speakable speakable command would not be recognized until speakable items was quit and restarted has been corrected.

AppleScript documentation erroneously reports the effective range of AppleScript integers.... In AppleScript 1.3 through 1.4.3, integer addition and subtraction handled arithmetic operations at the extremes of this range incorrectly.... In AppleScript 1.5 and later, operations on large-magnitude integers will be promoted to reals....

Apple's Chris Nebel reported to the AppleScript-Users mailing list on January 11, 2001 that the bug that could cause Idle handlers to crash has been fixed. Reports have suggested that there may have been more than one bug with idle handlers, and he didn't explain exactly which bug is fixed. 1/28/01

Apple's Chris Nebel reported to the AppleScript-Users mailing list on December 29, 2000 that he believed Mac OS 9.1 fixes the bug of the last few versions of the Finder wherein the Set Position command to reposition icons did not function in windows whose View Options were set to Always snap to grid. And I have verified that it is so. So much for all the rationalizations suggesting that this View Options setting should logically preclude setting an icon to an off-grid position (even Revision 2 of Technote 1176 suggested that the Always snap to grid exception was a deliberate design change in the Finder's behavior). Scripts that need to work under earlier versions of the Mac OS must still use either of the known workarounds: temporarily turning off the Always snap to grid setting, or using the Set Bounds command, instead.

There are many other bug fixes in Mac OS 9.1, most of limited interest to scripters. For example, the bug in Mac OS 9 that prevented the Temporary Items folder from being cleaned out at startup is fixed in Mac OS 9.1. A number of AppleScripts and other utilities to work around this problem appeared after the release of Mac OS 9, and they are no longer needed. See Mac OS 9: Temporary Items Not Deleted at Startup (TIL #25134 3/13/00, updated 1/10/01).

One bug that was still not fixed: The Desktop Printer Manager's 'SIZE' resource is still set to Sizeand Min size of 131072, rather than 200000 as recommended in Mac OS 8.6: Out of Memory running an AppleScript (TIL #31064 7/27/99, updated 7/30/99). It is therefore possible that scripts using the Desktop Printer Manager will continue to fail with out-of-memory errors under Mac OS 9.1 unless users follow the instructions in the TIL article.

Offline

 

#6 2001-09-22 09:58:01 am

Bill Cheeseman
Administrator
Registered: 2006-06-29
Posts: 158

Re: AppleScript 1.5.5 (Mac OS 9.1)

DOCUMENTATION FOR NEW APPLESCRIPT FEATURES
The following sources of information about AppleScript 1.5.5 are available:

Mac OS 9.1 (Technote 2010, 1/18/01) discusses changes and corrections in Mac OS 9.1, including detailed information about AppleScript 1.5.5 and scriptable components of the Mac OS.

An announcement from The AppleScript Team to the AppleScript-Users mailing list on January 9, 2001. This announcement is equivalent in format and detail to the Release Notes that are sometimes published with new versions of AppleScript; much of it's content is nearly identical to the Mac OS 9.1 Technote. Since it is apparently not officially available on the web at this time, it is reproduced in full as an Appendix to this note.

This readme document is installed in a Mac OS 9.1 upgrade:

The About AppleScript document in the AppleScript subfolder of the Apple Extras folder now located in a new Applications (Mac OS 9) folder describes AppleScript generically without describing any of the new features of AppleScript 1.5.5.

The AppleScript CD Extras folder in the CD Extras folder of the full Mac OS 9.1 installation disk includes the AppleScript Factsheet.pdf document from March 2000, which of course does not mention Mac OS 9.1. One of its most delightful statements is this: 2/6/01

Your investment in AppleScript using Mac OS 9 is secure and enhanced with Mac OS X. AppleScript is completely integrated into Mac OS X. Customers used to the high level of scriptability of Mac OS 9 will find AppleScript support in Mac OS X to be an evolution of the capabilities in Mac OS 9.

Most existing scripts will continue to work as expected. Scripts can run between the Cocoa, Carbon, and Classic environments.

The Help files for AppleScript used with the Apple Help Viewer have been updated to add some information about what's new in AppleScript 1.5.5. To read about some of the new features, open AppleScript Help in the Help Center, then open the Getting Started topic, then open What's New. The information there describes what's new in AppleScript 1.5.5 and 1.4, supplementing the information in the What's New in AppleScript 1.3 topic. 2/11/01

Offline

 

#7 2001-09-22 10:01:23 am

Bill Cheeseman
Administrator
Registered: 2006-06-29
Posts: 158

Re: AppleScript 1.5.5 (Mac OS 9.1)

TESTING WHETHER APPLESCRIPT 1.5.5 IS INSTALLED

Before using new features of AppleScript, careful writers of scripts intended for public distribution will want to determine which version of AppleScript is present on the user's machine. How to do this is explained in the article on AppleScript 1.3.4. However, in AppleScript 1.5.5, it now appears to be necessary to enclose 'computer ascv' in parentheses. The revised script skeleton, which will also work with older versions of the Mac OS, is as follows:

Applescript:


tell application "Finder"
   if(computer "ascv") is greater than or equal to 17826133 then
           --your script statements
       else
           --report an error
       end if
end    tell

The number to test for to determine whether AppleScript 1.5.5 is installed is this:

AS 1.5.5 = 17826133 (01100155)


Filed under: Finder

Offline

 

#8 2001-09-22 10:05:02 am

Bill Cheeseman
Administrator
Registered: 2006-06-29
Posts: 158

Re: AppleScript 1.5.5 (Mac OS 9.1)

APPLESCRIPT-RELATED SYSTEM SOFTWARE COMPONENTS

Installed Components
A few new scriptable components are provided with Mac OS 9.1, as described in the New Features section, above.

In addition, a standard Mac OS 9.1 installation places these AppleScript-related items in the Apple Extras folder on your hard disk now in the new Applications (Mac OS 9) folder:

In the AppleScript folder, the new Script Editor 1.5.5 and a short About AppleScript document describing AppleScript generically.

Script Editor was the first Carbonized application from Apple. CarbonLib, the library that contains the Carbon code, is still undergoing rapid evolution. Mac OS 9.1 installs the then-latest CarbonLib library file in your Extensions Folder, version 1.1.1, but the Mac OS 9.1 Technote strongly urges everybody to upgrade to CarbonLib 1.2, which is now available for download from the Apple Software Updates site. AppleScripters are particularly urged to do this, because there have been reports that typing in Script Editor is slow with earlier versions of CarbonLib.

The Mac OS 9.1 CD contains additional optional items related to AppleScript in the CD Extras folder that are not installed automatically by the standard Mac OS 9.1 installation or the update but can be dragged from the CD. I don't know that any of the CD Extras items is different than those provided with Mac OS 9. They include, in the Palm Extras subfolder of the Palm Desktop folder, an AppleScripts folder containing several folders of scripts. And in the OTExtras subfolder of the Network Extras folder, a Sample AppleScripts folder. And in the Remote Access subfolder of the Network Extras folder, another Sample AppleScripts folder containing several scripts to control Remote Access. These use the Network Setup Scripting commands, not the discontinued Remote Access Commands scripting addition. In the Place in AppleScript Stacks subfolder of the HyperCard Update folder is the old HyperCard AppleScript Reference stack from 1997. The AppleScript CD Extras folder contains a self-mounting disk image containing OSA Menu lite, iDo Script Scheduler, and a demo version of FaceSpan, all eleven of the AppleScript GuideBook Apple Help modules, a wealth of Example Scripts for use with OSA Menu, and three additional Folder Actions scripts. 2/28/01

Dictionary Changes
Several changes have been made to scriptable components of the Mac OS that have been updated from their Mac OS 9.0.4 versions.

Apple Remote Access control panel application
Mac OS 9.1 updates Apple Remote Access to version 4.0. The old Remote Access Commands scripting addition is not installed with Mac OS 9.1 because it is not compatible with Remote Access 4.0. However, it is not automatically removed when updating from an earlier version of Mac OS, so you may want to remove it manually if it still exists in your System.

Scripts using any of the commands provided by Remote Access Commands should be rewritten to use Network Setup Scripting, instead. Examples can be found in the Open Transport (Networking) AppleScript Guidebook module. Apple's Chris Espinosa has been widely quoted as saying,

We moved the functionality of the Remote Access Commands scripting addition into Network Setup Scripting several versions ago, in Mac OS 8.6. As with most product obsolescence plans, we staged its removal from the OS.

As noted below in the New Bugs in Mac OS 9.1 section, however, the Status property in the Remote Access configuration class defined in Network Setup Scripting does not work correctly in Mac OS 9.1.

The Protocol property of the Remote Access configuration class in Network Setup Scripting still refers to ARAP, although the ARAP capability has been removed from Apple Remote Access 4.0.

Apple System Profiler application
The Apple System Profiler contains these terminology changes: AtEase is now At Ease, MultipleUses... is now Multiple Users..., StartupDisk is now Startup Disk..., and ...logicboard... is now ...logic board....

Finder
There are some minor and major changes to the Finder's dictionary:

Class Application now includes a new element, View Options Window, and there is a new View Options Window class to go with it.

Class Application now also includes a new Execution State property which may assume any of these values: starting up, running, rebuilding, desktop, copying, restarting, and quitting.

There is a new optional parameter to the Put Away command, asking, which specifies whether or not to present a dialog to confirm putting this item away.

Folder Actions system extension
In the Folder Actions system extension 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.

Sherlock 2 application
The Sherlock 2 dictionary was changed to eliminate the Get and Set commands. This does not affect Sherlock's scriptability, but only conforms to the change made some time ago whereby Get and Set were made built-in AppleScript commands, no longer to appear explicitly in dictionaries.

Sound Scripting scripting addition application
This new scriptable application in the Scripting Additions folder is described in the New Features section, above.

Standard Additions scripting addition
The Choose Application command takes two new optional parameters, multiple selections allowed, and as to specify the type of the result to be returned (application, alias to the application or file of the application).

The old New File command has been renamed as Choose File Name, with the same parameters. This makes it possible for the first time to tell the Finder to make new file and get the same behavior as make file.

In AppleScript 1.5 and later, the Round command now can take an additional enumerated parameter: as 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.

Startup Disk control panel application
The Startup Disk control panel application is now scriptable, as described in the New Features section, above.

USB Printer Sharing control panel application
The USB Printer Sharing control panel application is new in Mac OS 9.1. It has a dictionary, and you can in fact do things like get name of front window. But it appears to be one of those applications that has only the generic scriptability supplied automatically by the development environment in which it was created. You apparently cannot script anything specifically relating to sharing your USB printer.

WhatRoute 1.7 application
The WhatRoute application is a new optional feature, as described in the New Features section, above.

WorldText 1.0 application
The WorldText 1.0 application is a new optional feature, as described in the New Features section, above. 2/6/01

The Scriptable Finder
These new AppleScript-related features in Finder 9.1 are described in the Mac OS 9.1 Technote:

The 'put away' [command] now has an optional 'without asking' parameter.... The effect of the optional 'without asking' parameter is to inhibit any alerts that may appear during processing of the command such as 'This disk will re-appear when you next start the machine.'
It is now possible for scripts to determine if they are being called as part of the shutdown sequence or the restart sequence. To discover the current execution state scripts can use the Finder's execution state property. The property includes these states: restarting, starting up, running, rebuilding desktop, copying and quitting. This feature implements a couple of long-requested improvements that many scripters will welcome. John Baxter spoke for all of us when he said on the MACSCRPT list on January 19, 2001, A script running from the Shutdown Items folder can now (one might say finally...one will say THANKS) tell whether Finder is trying to shut down or restart the machine.

One other, more minor, change in the Finder's dictionary is described above in the Dictionary Changes section.

Scripters who work with the Finder should note that, in Mac OS 9.1, changing the name of a file or folder will change the modification date of the enclosing folder. This is a departure from previous behavior. It should make it easier for a script to identify folders whose contents have changed. 2/11/01

Several long-standing bugs in the scriptable Finder, including some remaining from at least Mac OS 8.1, have finally been fixed in Mac OS 9.1. I listed and ranked what I regarded as the eleven most important Finder bugs in the note on AppleScript 1.3.7 in Mac OS 8.6. One of these, the duplicate in place bug (no. 2 in importance, by my ranking) was fixed in Mac OS 9. Three more of these are fixed in Mac OS 9.1 (nos. 1, 6, and 9 in importance, by my ranking). All-in-all, Mac OS 9.1 is an excellent system release for Finder scripting. (Of course, scripts that may run on earlier systems must still apply workarounds to cope with these fixed bugs, as well as the old bugs that have not been fixed.)

The following AppleScript-related bug fixes in Finder 9.1 are mentioned in the Mac OS 9.1 Technote:

The Finder will now properly activate windows that it opened in response to Apple events from other applications while running as a background application when the Finder is switched to the front most application.
Items found in the temporary items folder at system startup are, once again, moved to the rescued items folder in the trash. This cures a bug in Mac OS 9 that had led to the creation of many AppleScripts and other utilities designed to work around the problem.
A problem, that has existed since Mac OS 8.5, where the 'titled' property of a Finder window was compiled into scripts as the resizable property has been corrected.
In previous versions of the Finder, asking for a list of creator types of all the active processes would return a list of object references instead of a list of four letter strings. This problem appears in Mac OS 8 through Mac OS 9.0.4 and was not present in Mac OS 7.x.... This command has been updated so it will always return a list of four character strings....
Scripts ... attempting to retrieve the names of all ejectable disks no longer fail. In the past, such scripts would abort with an error such as 'Finder got an error: Can't get name of every disk of desktop whose ejectable = true.'
Since Mac OS 8.5, scripts using modification and creation date properties associated with files did not work. This problem appears in Mac OS 8 through Mac OS 9.0.4 and was not present in Mac OS 7.x. This problem has been corrected.... This is the longstanding bug where comparisons of some creation dates and modification dates produced erroneous results. It also affected comparisons of other numeric values (AppleScript dates are numbers). Now, all of these comparisons appear to work, allowing scripters once again to use the very fast Finder filter reference form (whose clause) to create lists of qualifying files and other Finder items. For example, every item of folder Test folder where size of it < 5000.0.

There is one fix to the Finder which I had hoped, on first reading, would resolve a longstanding Finder AppleScript bug. The Finder now supports redirection (by way of the Folder Manager APIs) of the Desktop Folder to volumes other than the startup volume. The Finder now relies entirely on the Folder Manager to determine the location of the Desktop Folder and makes no assumptions about its actual location. Unfortunately, using AppleScript to obtain the path to an item that was dragged to the desktop from a non-startup disk still reports that it resides on the startup disk.

Some have reported that, although the long-standing bug in which the Finder's entire contents property fails on large containers still exists, it now generates an error when it fails. The error message is reportedly garbled, but the error number is reportedly -108 (out of memory). Others report a different error number. Still others assert that this behavior has existed through several revisions of the Finder, and that the generation of a testable error remains hit or miss. In the absence of confirmation from Apple, the prudent course is to assume that the Finder's behavior is unchanged and to use the entire contents property as carefully as you can, if at all. Most report that it works reliably on relatively small containers, but not everybody accepts the about 250 items upper bound of the safe zone reported by some.

Offline

 

#9 2001-09-22 08:52:21 am

Bill Cheeseman
Administrator
Registered: 2006-06-29
Posts: 158

Re: AppleScript 1.5.5 (Mac OS 9.1)

AppleScript 1.5.5 is included with Mac OS 9.1 (code name Fortissimo). Mac OS 9.1 was not announced by Steve Jobs in his Keynote Address at Macworld Expo in San Francisco on January 9, 2001, but it was released that day nonetheless. It follows AppleScript 1.4.3, which was released in May 2000 with Mac OS 9.0.4, and AppleScript 1.5, which was released later in the year 2000 with Mac OS X Public Beta.

According to Apple, AppleScript 1.5.5 requires Mac OS 9.1; it will not work under earlier versions of the Mac OS. Kirk Kerekes reports, however, that it appears to work properly on Mac OS 9.0.4, if you keep the Mac OS 9.0.4 version of the AppleScriptLib library in the Extensions folder (in Mac OS 9.1, AppleScriptLib has been incorporated into the System file). 1/28/01

In addition to the usual bug fixes and new features, an important goal of AppleScript 1.5.5 is, in the words of an announcement from The AppleScript Team to the AppleScript-Users mailing list, 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.

This note describes the Mac OS 9.1 updater available online for downloading as well as the full installation CD, which includes additional features in a CD Extras folder and elsewhere. The Mac OS 9.1 updater available for download does not include all of the system components that are on the Mac OS 9.1 full install CD. There are at least a couple of items of interest to AppleScripters which will apparently be updated to the latest versions only if you install them from the full install CD. These include:

ColorSync 3.0.3, including the sample scripts installed in the AppleScript Files subfolder of the ColorSync Extras folder in the Apple Extras subfolder of Applications (Mac OS 9), and English Speech Recognition 2.0.4, including the Speech Listener scripting addition application and the many speech recognition scripts. 2/28/01

Like the notes on AppleScript 1.4, AppleScript 1.3.7, AppleScript 1.3.4 and AppleScript 1.1.2, this note is based on information obtained from various sources, including official Apple publications and the AppleScript mailing lists, and my own investigations.

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.034 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)