Re: Restarting OSX through applescript
Re: Restarting OSX through applescript
- Subject: Re: Restarting OSX through applescript
- From: Sander Tekelenburg <email@hidden>
- Date: Sat, 6 Apr 2002 03:58:23 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 18:17 +0100 UTC, on 30-03-2002, I wrote:
[...]
>
This brings me to something I had been planning to ask about: When you have
>
items in the Shutdown Items folder that activate an app, they will cancel
>
the restart/shutdown. I'm trying to work around that by making use of the
>
Finder's "get execution state". My approach is to have a stay-open applet
>
in the Shutdown Items folder. It asks the Finder for its execution state,
>
then waits until all processes that are launched from the Shutdown Items
>
folder have quit, and then tells the Finder to resume what it was doing.
[...]
>
2) My approach works perfectly well with "restarting", but it does not work
>
with "quitting". After all other Shutdown Items have quit, this stay-open
>
applet just stays open and the machine is never shut down.
>
>
Tested under both Mac OS 9.2.1 and 9.1 (both with AppleScript 1.6) with the
>
exact same results.
>
>
Here is the script:
>
>
(* start script *)
[...]
>
on QuitReboot()
>
try
>
if (theState as string) = "restarting" or ((theState as string) =
>
"+constant ****ese6;") then
>
tell application "Finder" to restart
>
else if (theState as string) = "quitting" or ((theState as string) =
>
"+constant ****ese7;") then
>
tell application "Finder" to shutdown
I found the culprit. It should be "shut down", not "shutdown"... That's
'all'. The script works perfectly fine now.
So why does "shutdown" compile as a Finder keyword (clearly indicated as such
by Script Editor's syntax colouring) if it isn't understood by the Finder in
the first place? And why doesn't the Finder return an error, if it doesn't
understand what it is being told?
Might this be... a bug? ;)
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <
http://www.pgp.com>
iQA/AwUBPK5WOesywKfXgqKdEQLGVQCgh3nIJRoTkriLFpwPNzhI5mqtP1AAoLD4
cWACLfjBZcokXapMm3aTPe0c
=RLAW
-----END PGP SIGNATURE-----
--
Sander Tekelenburg, <
http://www.euronet.nl/~tekelenb/>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.