Changing a System Preferences setting

Hi,

I would like to chage a System Preferences setting, for example disabling the battery status icon.

I’m able to do that, but I would like to know if it’s possible to do it in an invisible way, so no System Preferences window appear in all the process.
Is that possible?

My applescript looks like this:

tell application id “com.apple.systempreferences”
set current pane to pane id “com.apple.preference.energysaver”
activate
tell application “System Events”
tell process “System Preferences”
if (value of checkbox “Show battery status in the menu bar” of window 1 is 1) is true then
if (exists checkbox “Click the lock to make changes.” of window 1) is true then
click checkbox “Click the lock to make changes.” of window 1
–WAIT UNTIL USER & PASSWORD HAS BEEN ENTERED
repeat until (count of every window) is not 0
delay 1
end repeat
end if
click checkbox “Show battery status in the menu bar” of window 1
end if
end tell
end tell
quit
end tell

Thnaks in advance!

If you can figure out what plist stores the choice, you could do it there with “defaults write”.

Hi,

yeah, that’s really what I was looking for! It took me some minutes to find out the plist file:

users/xxxxxx/Library/Preferences/com.apple.systemuiserver.plist

Thanks for your help!