Re: Shutdown/Restart computer

2009-09-17 Thread Heizer, Charles
I use a variation of this... http://developer.apple.com/mac/library/qa/qa2001/qa1134.html On Sep 14, 2009, at 5:59 PM, PCWiz wrote: How would I shut down and restart the computer using Objective-C code? Thanks ___ Cocoa-dev mailing list

Shutdown/Restart computer

2009-09-14 Thread PCWiz
How would I shut down and restart the computer using Objective-C code? Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at

Re: Shutdown/Restart computer

2009-09-14 Thread vinai
A call to the system command, like: system (sudo /sbin/shutdown -h now'); You'd have to make sure your user is authenticated to use shutdown via sudo ... I'm not sure if there's a cleaner way specific to OS X. The above should work a reasonable portion of UNIX and UNIX-type systems.

Re: Shutdown/Restart computer

2009-09-14 Thread Kyle Sluder
On Sep 14, 2009, at 6:14 PM, vinai for_use...@yahoo.com wrote: A call to the system command, like: system (sudo /sbin/shutdown -h now'); Nononono. This is entirely the wrong way to do this. ESPECIALLY for privileged operations. Read the section Application Responsibilities in Logout

Re: Shutdown/Restart computer

2009-09-14 Thread Nick Zitzmann
On Sep 14, 2009, at 6:59 PM, PCWiz wrote: How would I shut down and restart the computer using Objective-C code? Don't use the /sbin/shutdown command as previously recommended. That command will not give users the chance to save their work before the reboot/shutdown. Instead, send events