Friday, March 21, 2008

Autohotkey Script to Put Monitor on Standby

This is a bit of a rehash of a larger article I wrote months ago highlighting my main Autohotkey scripts, but I saw in the search stats that some people were specifically looking for an autohotkey script to put one's monitor on standby.

Here it is, the way that I use it. It puts the monitors on standby by hitting Win+M:

#m:: ; Win+M hotkey that turns off the monitor.
Sleep 1000 ; Give user a chance to release keys (in case their release would wake up the monitor again).
; Turn Monitor Off:
SendMessage, 0x112, 0xF170, 2,, Program Manager ; 0x112 is WM_SYSCOMMAND, 0xF170 is SC_MONITORPOWER.
; Note for the above: Use -1 in place of 2 to turn the monitor on.
; Use 1 in place of 2 to activate the monitor's low-power mode.
return
Don't ask me for a line by line explanation more than what's already annotated in the script itself; I have no idea.

I can't find the original Autohotkey forum post in which I found this specific script, but this forum post has more info.

p.s. - for those of you not in the know, Autohotkey is an extremely versatile program that lets you write scripts as simple as automating windows tasks (like moving a mouse, or opening a folder with a keystroke), to writing full on programs and mods.

Related Posts by Categories



Widget by Hoctro | Jack Book

4 comments:

Luke said...

This is great, thanks.
Works perfectly in Win2003.

Anonymous said...

This is the forum post where you got the script, and there is more information there on how it works etc.
http://www.autohotkey.com/forum/topic2142-15.html&sid=03353c828374aac9dc8e1682c9ebe1e7

Kau279 said...

Awesome! Works perfect
This is what, I need!
First time known about AHK it's interesting-Thanks for that too.

Anonymous said...

Thank you.

I set it to Win+Z.

You can also put the ".ahk" file in the startup folder and have it run every time you start the PC (it will wait for that key combination), and you can also add "#NotrayIcon" to the script, so that it doesn't take up any space in the system tray.


PS: Using "1" instead of "2" doesn't do anything on Windows 10. At least not on my machine.