|
|
Applescript --> Sleep
Can anyone help me with this? Its a pretty simple question, but I've looked all over and can't find an answer. I'm trying to write an applescript that will wait x minutes, and then put the computer to sleep. Any ideas? thanks
|
set A to display dialog "How many minutes do you want to wait before sleep?" with icon note buttons {"Cancel", "OK"} default button "OK" default answer ""
set A to the text returned of A try set A to A as number on error error "This is not a number." end try delay (A * 60) tell application "Finder" sleep end tell (12) |
For some reason, when ever I run this, it brings up an error: "The variable sleep is not defined"
thanks |
Is this a workaround for the OS 9.1 Insomnia that seems to be plaguing so many of us? I'm being driven insane.
------------------ "The only consistant people I know are dead." iMac DVSE 400/128/13 OS 9.0.4 |
The sleep command needs to be inside the tell block to work. If it still doesn't work, replace sleep with «event fndrslep».
(13) |
It keeps bringing up an error that says:
"Finder got an error: Can't continue <<event fndrslep>>" I have tried this both in X and in 9, but to no avail. Any other ideas? Thanks again. |
got something for it, but now i'm at school working on pc http://forums.macnn.com/cgi-bin/frown.gif
gonna write it down from my computer (the program has a stop process button too). I use it when i go to bed, but don't want to stop music yett. -c |
hi, I found it, here it comes:
--how many minutes set antw to display dialog ("time in minutes till activation sleep mode") default answer ("10") set tijd to (text returned of antw) as integer --stop proces possibility set a to display dialog {"proces started"} buttons {"stop"} giving up after (tijd * 60) if gave up of a is true then tell application "finder" to sleep end if --made by caifara /the end it works for me, hope it works for you too, let me know something -caifara |
| All times are GMT -5. The time now is 02:46 PM. |
|
Copyright © 2005-2007 MacNN. All rights reserved.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.