Hottest Free Downloads - DownloadPipe.com Over 197,000 downloads! Bookmark Now!
DownloadPipe.com - New Downloads Every Minute
 SEARCH:
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Using Applescript to Sleep Computer

 
   Mac (Home) -> Apple Scripts RSS
Next:  ------------------Iolo System Shield 3 Internet S..  
Author Message
Jackie Jones

External


Since: Jun 30, 2006
Posts: 2



(Msg. 1) Posted: Sat Oct 11, 2008 12:18 am
Post subject: Using Applescript to Sleep Computer
Archived from groups: alt>comp>lang>applescript (more info?)

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?
Back to top
Login to vote
Daniel Schaffner

External


Since: Oct 22, 2008
Posts: 1



(Msg. 2) Posted: Wed Oct 22, 2008 10:18 pm
Post subject: Re: Using Applescript to Sleep Computer [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

Jackie Jones schrieb:
> 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?
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Can Applescript tell if computer is online? - Hi there, I would like to write a conditional Applescript. The script would trigger itself every few hours and if the computer is not connected to the Internet I would like it to execute some code. I have a bit of experience with AS but have no idea how....

update applescript - I am only now practiced enough in Applescript that some anomalies in the language are bugging me. In looking for work-arounds, one of the first documents I read was the Apple web page listing all the bugs in version 1.9.1. I have version 1.9.1 on os...

Please help with this applescript code - The line below is part of an Applescript macro that works fine for converting Appleworks documents to RTF format. Can anyone please tell me how I amend this line of code to save Appleworks documents in ASC (Ascii) text format. (ASC is one of the 'Save As...

Help with a BBEdit AppleScript - I need to insert Quark tags into a text file that is exported from a classified ads application. I just can't seem to get the syntax right to have a font tag <f"LegalNews-Bold> inserted at the beginning of the line before the date tag. For...

New AppleScript features in 10.5 - On this page <http://www.apple.com/applescript/> (which is formatted in a very un-Apple manner) there's a list of the new features in AppleScript, with each on a clickable link. Some look interesting and I don't want to torpedo any fun discussio...
       Mac (Home) -> Apple Scripts All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows Forums
 Game Forums
 Linux Forums
  Mac Forums
 PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact