Re: Shut down computer running 10.1.3
Re: Shut down computer running 10.1.3
- Subject: Re: Shut down computer running 10.1.3
- From: brian mather <email@hidden>
- Date: Sun, 15 Sep 2002 02:29:59 -0400
Aggregating responses from the digest I just rec'd:
Thanks for the replies.
In an effort to help you help me here's more info.
Paul Berkowitz wrote:
>
Assuming you used real date types in your real code, did you actually test
>
for it being _exactly_ 11:00:00 pm? It's never going to be that. Test for it
>
being later than 11, and run it every 30 minutes.
>
>
And why arte you giving us pseudo-code for such a short script? Chances are
>
it's an error in your scripting. How can we help if you don't provide the
>
real code. Dates are tricky. You might also want to go to a quit handler to
>
do the shutting down. You know the Finder always asks if you want to quit
>
open apps, save documents, etc?
>
>
--
>
Paul Berkowitz
The script wasn't handy when I posted originally and as I'm actually more
interested in cron'ing the shut down event or having someone point out that
the energy saver *does* still have my beloved feature I quickly tried to
give you gist. My apologies for incomplete info.
Here's the true code
on idle
set now to (current date) as string
set the_hour to word 5 of now
set am_pm to word 8 of now
set right_now to the_hour & am_pm
if right_now = "10PM" then
tell application "Finder"
shut down
end tell
end if
return 3600
end idle
Mr Tea wrote:
>
Also, I think this will be necessary...
>
>
ignoring application responses
>
tell application "Finder"
>
shut down
>
end tell
>
end ignoring
>
>
...otherwise the Finder will wait to see if it has quit before shutting
>
down, and finding that it hasn't, won't.
Excellent point. When I executed this script from script editor:
ignoring application responses
tell application "Finder"
shut down
end tell
end ignoring
It shut my machine down quitting all running apps along the way. Before I
resign myself to making this a stay open app and merge this with the on idle
code above I feel compelled to repeatthat I'd prefer to execute this as a
cron job. It just semms less likely to fail (can't be quit inadvertently,
doesn't clutter the dock, the gee-whiz UNIX factor has me in it's grasp,
etc)
However, when I executed it from the terminal with the command
/usr/bin/osascript ~/Library/AppleScripts/test
Terminal persisted in throwing up a dialog box. I assume I need to ignore
app responses from terminal as well as the finder - how would I do that?
This was my blunt instrument approach, but I net an execution error when I
run it from script editor
tell application "Finder"
set running_stuff to every process
repeat with each in running_stuff
quit each
end repeat
shut down
end tell
--> error "Finder got an error: Application isn't running." I assume I
can't tell the finder to shut down as it isn't running any longer. Clearly I
need to be more surgical in my efforts. Any thoughts?
And Rob Jorgensen wrote:
>
I notice in Jaguar that there's a shutdown command in the System
>
Events dictionary. I wonder if this provides benefits over using the
>
Finder.
>
>
--
>
>
Rob Jorgensen
Upgrading is of course an option if the desired behavior could be achieved.
_______________________________________________
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.