Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cancel Sleep



Andrew James writes
The users are 100% fine with the idea and all i want to know is if its possible and if so how, it seems no matter where i ask this question i am confronted with other developers views and not a solution

There are several fully supported approaches toward this end.


The easiest is to go to System Preferences, to Energy Saver, and to disable sleep.

I'd expect you could probably toss an AppleScript after the preferences, too. Here are some related articles to that end:

http://macscripter.net/articles/468_0_10_0_C/
http://www.apple.com/applescript/features/system-prefs.html

Or you could fully manage the user's environment and settings, establish the requisite settings, and lock out access to the Energy Saver preferences. This is often best in a production-oriented environment, as it avoids dealing with changes to the run-time.

And then there is the pmset tool available at the shell. See man pmset for details on that. Here are some details from the Darwin source pool:

http://www.opensource.apple.com/darwinsource/10.5/PowerManagement/
http://www.opensource.apple.com/darwinsource/10.5/IOKitUser/pwr_mgt.subproj/
http://www.opensource.apple.com/darwinsource/10.5/xnu/iokit/IOKit/pwr_mgt/

Off-hand, I don't know if there's a way to capture an (asynchronous) change in the user's preferences settings. That might well be massively useful here. With the change notification, you could react appropriately at run time. And regardless of the preferences settings, I'd still tend to code to expect to see a sleep request at run-time. The "big sleep" here being a hard power-down, and that's something you still have to plan for.

When it is difficult or impossible to find official documentation within a particular area of an operating system, there's usually a reason for the omission. One of those can be a wish to avoid support costs. (That's as close as I'll come to expressing a view here.)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden


This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.