Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Possibly fix sleep problems associated with AirPort' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Possibly fix sleep problems associated with AirPort
Authored by: johnsawyercjs on Jan 16, '09 06:19:26AM
Here's a little Applescript that I wrote to put a Mac to sleep, and make it go back to sleep if it wakes up (via a "repeat" loop), unless you tell it to stay awake by pressing the Return key, or clicking the app's "Cancel" button. Paste this into Script Editor, and save it as an Application; in Script Editor's "Save" dialog, de-select the options "Run Only" and "Stay Open":

repeat
	display dialog "Cancel sleep? (auto-sleep after 40 seconds)
	
	(hold down Return key to cancel)" buttons {"Cancel", "Sleep"} default button 1 giving up after 40
	(*You can vary the time to something other than 40 seconds,but less time than 20 seconds often makes*)
	(*the script put the Mac to sleep even if you press the Cancel button or Return key immediately after wake*)
	set the button_pressed to the button returned of the result
	if the button_pressed is "" or the button_pressed is "Sleep" then
		tell application "System Events" to sleep
	end if
end repeat


[ Reply to This | # ]