Welcome to DssW. We make saving energy easy. Our Power Manager software will reduce the running costs of your Macs.
Jackie Jones - 10 October 2008
In OS 10.4.11, I used this simple script to sleep the computer:
tell application "Finder" to sleep
In OS 10.5.5, this script has a long delay before the computer sleeps. Is there a better way to script sleep?
Daniel Schaffner - 22 October 2008
I tell it application "System Events". also run 10.5.5 and have no delay.
I use this:
--pmset changes and reads power management settings such as idle sleep timing wake on administrative access automatic restart on power loss, etc.
set current_mode to do shell script "pmset -g | grep mode" --look for current hibernate mode
if current_mode contains "3" then set the current_name to "sleep" if current_mode contains "1" then set the current_name to "safe sleep"
display dialog "I'm in " & current_name & " mode. Set new mode!" buttons {"sleep", "safe sleep", "cancel"} default button 3 set new_name to button returned of result
if new_name is "sleep" then set new_mode to "3" if new_name is "safe sleep" then set new_mode to "1"
do shell script "pmset -a hibernatemode " & new_mode with administrator privileges
display dialog "Go to " & new_name & " now?" buttons {"yes", "no"} default button 2
if button returned of result is "yes" then tell application "System Events" to sleep
Welcome to DssW. We make saving energy easy. Our Power Manager software will reduce the running costs of your Macs.
| Related Subjects |
|---|
Power-Button on PowerBook G4 FW800“I want a direct shutdown (shutdown now -h) instead off the finders shutdown dialog. I run os 10.4.11 on this machine.”
17 messages — Last update 13 May 2008
|
sleep from terminal“is there a built-in shell command to make the computer sleep from terminal?”
32 messages — Last update 4 January 2006
|
"Sleep" over network“Is there a way to tell my Mac to go to sleep without having physical access to it?”
7 messages — Last update 8 July 2003
|
use and privacy policies - support@dssw.co.uk - http://www.dssw.co.uk
Dragon Systems Software Limited, 3rd Floor Suite, 41-43 Broad Street, Hereford, HR4 9AR, United Kingdom
Copyright © 1997 — 2008 Dragon Systems Software Limited (DssW). All rights reserved.