Numkeys not working after firing a NumLock-composed Hotkey

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
[+]
Posts: 5
Joined: 18 Nov 2022, 10:59

Numkeys not working after firing a NumLock-composed Hotkey

Post by [+] » 03 Jun 2023, 16:14

I'm trying to launch CMD using a hotkey composed of NumLock. During the hotkey firing, the NumLock toggling beep can be heard. After the hotkey fired, the NumLock LED is ON but Numkeys can't be pressed (which may suggest that the OS currently perceives the NumLock being OFF.)
I'm haven't had much success with issuing additional SetNumLockState or SendInput {NumLock n}.
I think that the NumLock does toggle despite omitting ~, which might explain the beep, but does so at a low-level such that SetNumLockState and SendInput {NumLock}'s can't modify. Could be wrong though.

Code: Select all

#NoEnv
#SingleInstance Force
SendMode Input
SetBatchLines -1
SetWorkingDir %A_ScriptDir%
#Persistent
return

; LWin + NumLk
<#NumLock::
	SavedNumLockState := GetKeyState("NumLock", "T")
	SendInput {Blind}{LWin Up}{NumLock Up}						; {Blind} gets rid of the unknown {LCtrl} being fired.
	Run explorer.exe %A_ComSpec%
	return

User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Numkeys not working after firing a NumLock-composed Hotkey

Post by mikeyww » 03 Jun 2023, 16:38

Code: Select all

#Requires AutoHotkey v1.1.33
<#NumLock::
Run % A_ComSpec
Send {NumLock}
Return

[+]
Posts: 5
Joined: 18 Nov 2022, 10:59

Re: Numkeys not working after firing a NumLock-composed Hotkey

Post by [+] » 03 Jun 2023, 23:46

mikeyww wrote:
03 Jun 2023, 16:38

Code: Select all

#Requires AutoHotkey v1.1.33
<#NumLock::
Run % A_ComSpec
Send {NumLock}
Return
This code results in the described behavior on my keyboard: while NumLock state is on, the NumLock toggling beep can be heard, the NumLock LED stays on, but Numkeys can't be pressed.

User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Numkeys not working after firing a NumLock-composed Hotkey

Post by mikeyww » 04 Jun 2023, 06:24

It worked here. This may vary by keyboard, but I wonder if you are running some other software that is also attempting to manage the same keys. Others may have some additional ideas for you.

Post Reply

Return to “Ask for Help (v1)”