PDA

View Full Version : Disabling 'Nap mode' via AppleScript - problems




Will Cheyney
Jan 6, 2006, 05:51 AM
So, I want to disable 'Nap mode' automatically on start up on my G5.
I came across the following AppleScript code but can't get it to work!

do shell script "hwprefs cpu_nap=1"

I have also tried the variation of that:
do shell script "hwprefs cpu_nap=false"

I compiled them and saved as an application, but get this error message whenever they are set to run:

hwprefs: PERMISSION DENIED: effective user id MUST be root user to run


Can anyone offer a helping hand?
Thanks



Nermal
Jan 7, 2006, 06:13 AM
I'm pretty sure you need root privileges, which means typing your password. This would be a nightmare if the script is running on boot, so I can't offer any suggestions :(

Wes
Jan 7, 2006, 06:25 AM
Yeah you need to be root user so:

do shell script "sudo hwprefs cpu_nap=false"

But then as Nermal says you are going to need to enter your password... I'm sure there is a way to build it into the script though.