Monday 20 November 2017

windows 7 - Is there a way to execute a program on power events?


I'm basically looking for a way to execute an application when my laptop transitions to battery power and, similarly, when it returns to AC.


Is there a built-in hook in Windows or a third-party application that will allow me to respond to such events?


EDIT


I've looked into the TaskScheduler trying to fire off a task on a "power" event, but no event seems to be logged when switching to battery.



Answer



I wrote an application (http://batterysaver.codeplex.com/) that will listen for a power mode change message and execute actions based on an XML configuration.


If someone else can use it, or extend it, then awesome. If there's something better, then please post it.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...