A simple repeating task in Windows
January 5, 2022 1:26 PM   Subscribe

I have a task that I do every day on Windows, and would like to automate it and assign it to a button.

In WIndows, I usually go to bed with the "Power & Sleep" plugged-in screen setting set to 1 minute, and then, when I'm fully awake, change it to 2 hours for the rest of the day. I do this at least twice a day, and the easiest I can make it is to leave the Power & Sleep setting panel up all day so that I can easily change it, but it's irritating to see that panel hanging around all day for such a simple task. I would love to have a button, preferably on my task bar, that I could simply push to toggle the setting. Is there a simple way to accomplish this?

I don't mind downloading something (including a new language) to help with this, but I don't want to pay anything. I'm pretty handy with scripting languages such as JavaScript and Ruby, but I don't know anything about the architecture of Windows. For instance, I imagine I could do this by altering a register value somewhere but I don't know which one, and I don't know how to do it programmatically (i.e., as opposed to using regedit).

Thanks for your help!
posted by ubiquity to Computers & Internet (5 answers total) 4 users marked this as a favorite
 
You're looking for AutoHotkey.
posted by mhoye at 1:34 PM on January 5, 2022 [1 favorite]


Best answer: A couple of 1 line batch files:

Powercfg /Change -monitor-timeout-ac 1

Powercfg /Change -monitor-timeout-ac 120

Save those somewhere and create a shortcut to them.
posted by Lanark at 2:00 PM on January 5, 2022 [3 favorites]


Also you could create a scheduled task to automatically run them at the same time each day.
posted by Lanark at 2:01 PM on January 5, 2022


You can add the relevant settings dialog as a start menu item, to access it easily.
posted by Artifice_Eternity at 2:07 PM on January 5, 2022


Response by poster: Wow, that was fast! Lanark's answer is exactly what I wanted, and more, because it pointed me to a good place to learn about MS Power commands. Thanks again!
posted by ubiquity at 2:24 PM on January 5, 2022


« Older Bad Cataract in One Eye. What Now?   |   My webcam suddenly looks wrong and I hate it. Hope... Newer »
This thread is closed to new comments.