|
|
Applescript --> Sleep
|
|
|
|
Forum Regular
Join Date: Nov 2000
Location: RI, USA
Status:
Offline
|
|
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
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Feb 2001
Status:
Offline
|
|
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)
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Nov 2000
Location: RI, USA
Status:
Offline
|
|
For some reason, when ever I run this, it brings up an error: "The variable sleep is not defined"
thanks
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Jun 2000
Status:
Offline
|
|
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
|
Indeed, I tremble for my country when I reflect that God is just.
iMac Core2Duo 2.16GHz/3G RAM/250G HD OSX 10.6.6
Various Peripherals
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Feb 2001
Status:
Offline
|
|
The sleep command needs to be inside the tell block to work. If it still doesn't work, replace sleep with �event fndrslep�.
(13)
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Nov 2000
Location: RI, USA
Status:
Offline
|
|
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.
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Jan 2001
Location: Bruges, Belgium
Status:
Offline
|
|
got something for it, but now i'm at school working on pc
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
|
-c
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Jan 2001
Location: Bruges, Belgium
Status:
Offline
|
|
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
|
-c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|