How do I prevent monitor from turning on.. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

How do I prevent monitor from turning on..

22 Feb 2018, 01:15

Okay notice the code. The code turns the monitor off when I press down Lbutton and then click Rbutton. And turns it on again when I press Lbutton and click Rbutton for the second time.

Here is my problem:- Everything is fine with the script. BUT. The monitor reactivates when I move my mouse. I thought this would be prevented by blockinput, mousemove but that apparently does not work (blocks mouse-movements, but hardware mouse-movements still reactive the monitor). How do I prevent mouse-movements from my hardware mouse from turning my screen back on? I'm not using the keyboard in this just the mouse. And I need the rest of the mouse buttons if that somehow plays as a factor.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Blockinput, mousemove
;Disables mouse-movements when script is active

Number = 1
;value for toggling monitor

LButton & Rbutton::

Number++

Suspend, On
Sleep 2000
Suspend, Off
;suspend to make sure the script triggers only once 

If (Mod(Number, 2) = 0) ; if even
{
SendMessage, 0x112, 0xF170, 2,, Program Manager
}
;turn off monitor 

Else 
{
SendMessage, 0x112, 0xF170, -1,, Program Manager
}
;turn on monitor

return

I am your average ahk newbie. Just.. a tat more cute. ;)
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: How do I prevent monitor from turning on..  Topic is solved

22 Feb 2018, 03:40

Any input from an installed mouse takes your monitor out of stand by, no matter which logical events that input is translated into. You can disable the mouse in device manager so input isn't processed any more preventing the monitor from waking, but that also disables any mouse hotkeys until you re-enable the mouse again.

If it's an external monitor you may be able to turn it on/off through DDC/CI instead.
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: How do I prevent monitor from turning on..

22 Feb 2018, 04:45

Quick question: Is there any way I can imagesearch/pixesearch when the monitor is on standby?
I am your average ahk newbie. Just.. a tat more cute. ;)
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: How do I prevent monitor from turning on..

22 Feb 2018, 05:16

All of this is so complex haha. I'll try it later
I am your average ahk newbie. Just.. a tat more cute. ;)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CuriousDad, rc76 and 232 guests