Applescript for Toggling Energy Saver Presets

Joined
Mar 16, 2008
Messages
1
Reaction score
0
Points
1
Hello everybody, I'm a somewhat of a poweruser seeking to realize the full potential of my MacBook. After experimenting w/ Linux, I was wondering if it were possible to set OS X to lock my screen upon pressing ctrl + alt + L (without causing the "Require pass word to wake this computer from sleep or screen saver" setting to checked in the Security Preference Pane). After spending some time googling, I was able to do so by setting a Trigger in Quicksilver to run a Applescript file with the following contents:

activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
repeat with i from 1 to number of menu bar items of menu bar 1
tell menu bar item i of menu bar 1
click
try
if name of menu item 1 of front menu is "Lock Screen" then
click menu item "Lock Screen" of front menu
exit repeat
end if
end try
end tell
end repeat
end tell
end tell

As it turns out, the script performs this function as if I had moused over to the lock menubar item and selected "Lock Screen", complete w/ the item's visibility for a brief moment. In light of this, I was wondering if it were also possible for Applescript to toggle between two Energy Saver presets, also for the purpose of being used for a Quicksilver Trigger. Basically, I want to tell my OS the following "Click on the battery icon in the menubar. If Normal is checked, click Custom. If Custom is checked, click Normal". Is this possible? If so, what do I need to put in an Applescript file in order for it do this? Thanks in advanced to anyone who takes the time to read this and/or tries to help. A break down of what each line of text does would also be appreciated for educational purposes.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top