Applscript changes in 9.1 technotes
Applscript changes in 9.1 technotes
- Subject: Applscript changes in 9.1 technotes
- From: Michelle Steiner <email@hidden>
- Date: Fri, 19 Jan 2001 12:35:28 -0800
http://devworld.apple.com/technotes/tn/tn2010.html
>
AppleScript Changes
>
>
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 (r. 2472105). For example, the script
>
>
tell application "Finder" to get the titled of window 1
>
>
would be compiled as:
>
>
tell application "Finder" to get the resizable of window 1
>
>
>
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 (r. 1670530). For example:
>
>
>
tell application "Finder"
>
get creator type of every process
>
--> {+class COBA;, +class apae;, +class 3615;, +class Mrr2;,
>
+class FMP3;, +class ToyS;, +class XPR3;}
>
beep
>
end tell
>
>
This command has been updated so it will always return a list of four
>
character strings as shown here:
>
>
tell application "Finder"
>
get creator type of every process
>
--> {"XPR3","FMP3", etc.}
>
beep
>
end tell
>
>
>
The "put away" now has an optional "without asking" parameter (r.
>
1673117) that can be used as shown in the following listing:
>
>
tell application "Finder"
>
set theDisk to disk "Scratch"
>
put away theDisk without asking
>
end tell
>
>
>
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."
>
>
Scripts, such as the one shown below, attempting to retrieve the names of
>
all ejectable disks no longer fail (r. 2244621). 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."
>
>
tell application "Finder"
>
name of every disk of desktop whose ejectable is true
>
end tell
>
>
>
It is now possible for scripts to determine if they are being called as
>
part of the shutdown sequence or the restart sequence (r. 2275596). To
>
discover the current execution state scripts can use the Finder's
>
"execution state" property as shown below:
>
>
tell application "Finder"
>
if execution state is restarting then
>
beep 1 -- the machine is being restarted
>
else if execution state is starting up then
>
beep 2 -- starting up the machine
>
else if execution state is running then
>
beep 3 -- functioning perfectly
>
else if execution state is rebuilding desktop then
>
beep 4 -- currently rebuilding the desktop file
>
else if execution state is copying then
>
beep 5 -- performing a copy operation
>
else if execution state is quitting then
>
beep 6 -- powering down the machine
>
end if
>
end tell
And here is one that has been vexing more than just a few of us:
>
Since Mac OS 8.5, scripts using modification and creation date properties
>
associated with files did not work (r. 2279739). 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 and it is now possible to use scripts such as
>
the following:
>
>
tell application "Finder"
>
set the backup_list to every item of the entire contents of the startup
>
disk whose modification date is greater than x
>
end tell
>
>
tell application "Finder"
>
set the backup_list to every item of the startup disk whose -
>
creation date is greater than the (current date)
>
end tell
>
>
tell application "Finder"
>
set the backup_list to every item of the startup disk whose -
>
modification date is greater than the (current date)
>
end tell
----------------------------------------------------------------------
| Michelle Steiner | Hard as it may be to believe, my |
| email@hidden | life has been based on a true story. |
----------------------------------------------------------------------