display dialog "How many minutes until sleep?" default answer ""
set a to text returned of result
display dialog "Your computer will go to sleep in " & a & " minutes."
delay a * 60
tell application "Finder" to sleep
Model: Powerbook G4 Aluminum
AppleScript: ?
Browser: Safari 312
Operating System: Mac OS X (10.3.9)
If you have an older machine, one that shuts down the PCI bus, for which CPU sleep can be a disaster because one or more of the PCI cards (often a video card) won’t wake up properly (screen stays black), then you can still power off your display and spin down your drives with this:
do shell script "sudo pmset dim " & a & " spindown " & a password "YourPasswordHere" with administrator privileges -- do not use sudo here with OS X 10.4 (Tiger)
where “a” above is already in minutes, 0 means “Never”, and 1 is the minimum setting (sleep display/drives in one minute).
If you don’t like your password in the clear, see the code exchange item on passwords.