Help With Macro to Automate High/Low Power Mode

The following is my attempt at putting together a macro which changes to Low/High Power Mode when my MacBook is plugged/unplugged.

I've used the following resource to write the Shell scripts:

Macro doesn't return errors though it does not seem to effective at the moment. Any help much appreciated.

Turns out this is completely redundant as there's a way to achieve the same in System Preferences. Should have just looked better before doing all the research! I suspect the scripts didn't work because System Preferences was taking priority in setting the power modes, thus ignoring the shell commands. I'd still be curios to know the reason!

Auto Power Mode · PASSWORD REMOVED.kmmacros (32 KB)

I suspect your script was working, but System Preferences isn't reflecting the "new reality" -- if, instead, you look at "Power" section of System Information you'll see lowpowermode updating when your macro runs.


Thanks! Which one of these voices indicates the current state?


You're on AC power ("Charging: Yes") and running in LowPowerMode (AC section's LowPowerMode is not 0). When you unplug you'll remain in low power mode (Battery section's lowpowermode = 1).

Different hardware has different capabilities (see yours with pmset -g cap) -- I'm guessing that's why you have "lowpowermode: 2" available on your machine, while trying it on mine returns an error.

Thanks. Still useful to be able to assign this to a keyboard shortcut when the fan noise get's annoying.

By the way, to avoid storing your password in KM you can add the shell script to Shortcuts (check Run as Administrator) and trigger it from KM.