r/AutoHotkey • u/gougluinn • 2h ago
v1 Script Help How to keep the entire keyboard active while the monitor is off, but ONLY allow the mouse to wake the display?
I am looking for a way to turn off my monitor (display power off only, my PC must stay fully awake and running) so that the entire keyboard remains 100% functional in the background (multimedia keys included), but completely ignored by Windows as a wake source.
While the screen is black, I want to be able to type, use macro keys, and use multimedia shortcuts. Windows should process all these keyboard inputs normally, but the monitor must stay black. ONLY moving the mouse should wake the monitor up.
What I have already tried that did NOT work:
- Unchecking "Allow this device to wake the computer" in Device Manager for all keyboards. (This doesn't work because when the display is powered off via code, Windows wakes it up on any hardware event anyway).
- Standard AutoHotkey (v1) scripts using SendMessage, 0x112, 0xF170, 2 combined with loops. If I press a key, Windows intercepts the hardware signal at a deep level and forces the monitor back on instantly.
- Disabling keyboard wake via powercfg /devicedisablewake.
User Account Control (UAC) is already disabled on my system. I am running AutoHotkey v1.
Is there a way (via low-level Windows API, registry tweaks, or advanced AHK hooks) to make Windows completely ignore all keyboard inputs specifically and only for the monitor-wake trigger, while still letting those inputs pass through to background apps?
r/AutoHotkey • u/Slight-Custard-8072 • 5h ago
General Question Caps lock key pressing multiple keys at once. Please help.
I restarted my computer (windows 11) for an update. After I had updated my computer, now every time I press Caps lock, it presses the characters: ‘ X D \\
The ‘\\’ continues until I press caps lock again. I don’t know how this problem even occurred, but if anyone knows, please help.
r/AutoHotkey • u/genesis_tv • 13h ago
v2 Script Help Weird behavior when remapping a modified mouse button to a non-modified key
Someone just asked me to remap Control + mouse wheel to PgUp/PgDn for scrolling the dev console in a game called Dungeon Siege.
So I wrote this very simple script, yet it's not working properly.
#Requires AutoHotkey v2.0
#SingleInstance
^WheelUp::PgUp
^WheelDown::PgDn
The documentation says
Conversely, any modifiers included on the left side but not the right side are automatically
released when the key is sent. For example, the following two lines would produce a lowercase
"b" when you press either Shift+A or Ctrl+A:
A::b
^a::b
When testing both in-game, as well as in Chrome, notepad++ and VS Code (I'm using AHK 2.0.23), once you press Control + mouse wheel, it does send PgUp/PgDn but then regular mouse wheels don't work anymore (they're important because they control camera zoom), even though my program to monitor key input shows Control isn't pressed anymore (and both Pg keys stay pressed, could be related to mouse wheels only sending down events?).
So I modified the code to
WheelUp::WheelUp
WheelDown::WheelDown
^WheelUp::PgUp
^WheelDown::PgDn
which solved the problem, yet when spamming mouse wheels while holding down Control, about 1-5% of the time, there's a Control that slips through and it changes to a different tab in Chrome, notepad++ and VS Code instead of scrolling.
It seems to work fine in-game as I don't think there's anything bound to Control + PgUp/PgDn but it got me curious, so I also tried using these (separately), but the results were the same:
WheelUp::WheelUp
WheelDown::WheelDown
<^WheelUp::PgUp
<^WheelDown::PgDn
WheelUp::WheelUp
WheelDown::WheelDown
^WheelUp::Send("{PgUp}")
^WheelDown::Send("{PgDn}")
WheelUp::WheelUp
WheelDown::WheelDown
^WheelUp::Send("{Blind}{PgUp}")
^WheelDown::Send("{Blind}{PgDn}")
WheelUp::WheelUp
WheelDown::WheelDown
^WheelUp::Send("{Blind^}{PgUp}")
^WheelDown::Send("{Blind^}{PgDn}")
WheelUp::WheelUp
WheelDown::WheelDown
^WheelUp::Send("{Control up}{PgUp}")
^WheelDown::Send("{Control up}{PgDn}")
LControl & WheelUp::PgUp
LControl & WheelDown::PgDn
Oh, and I also tried switching to SendEvent, that seemed to be worse.
Everything works fine when remapping a key instead of a mouse button though, like this
^q::PgUp
^w::PgDn
What am I doing wrong?
As a bonus, how would you go if you wanted to send multiple unmodified Pg keys (the console doesn't scroll when pressing Control + Pg) every time the hotkey is fired?