Ok, I'll try to make this somewhat coherent, as I am not the best writer.
I have an AHK script which uses SendMessage command to send code 0x112, 0xf170, 2 to call WM_SYSCOMMAND which responds to SC_MONITORPOWER and 2 is the Power off function. This results in my monitor going to sleep, which is nice. However, as this is an AHK script, it requires actual buttons to be pressed, buttons like "a" "s" "d" and such. What I am looking for is how could I reprogram a button or two from arduino Leonardo to send that code directly, and put the monitors to sleep.
I am not a coder, and can pretty much only edit code in its simplest form.
Do you guys have any suggestions?
If all you need is to turn off the monitor then you can use
nircmd.exe monitor off
. This tool also supports sendmsg and postmsg commands.Regarding AHK, the auto-execute section runs without a hotkey.
This web controlled AHK solution might also be of interest to you...