kjpolker Posted June 30, 2023 Share Posted June 30, 2023 (edited) Is there a way to check if a hotkey is currently registered within AutoIt? Looking for a way to Pause a hotkey so I can bypass AutoIt and temporarily utilize the key until I decide to resume. Something like: HotKeySet("{PAUSE}", "Pause") Func Pause() If HotKeyRegistered("{F1}") Then HotKeySet("{F1}") Else HotKeySet("{F1}", "Toggle") EndIf EndFunc Yes I am being lazy, but also curious because I did not find anything relatable. I know I could probably set a variable indicating it's on or off. Edited June 30, 2023 by kjpolker Link to comment Share on other sites More sharing options...
Solution Andreik Posted June 30, 2023 Solution Share Posted June 30, 2023 (edited) HotKeySet('a', 'Test') ConsoleWrite(IsHotkeyRegistered(0x41) & @CRLF) ; vKey for letter A ConsoleWrite(IsHotkeyRegistered(0x42) & @CRLF) ; vKey for letter B Func IsHotkeyRegistered($vkCode) Local $aCall = DllCall('user32.dll', 'bool', 'RegisterHotKey', 'hwnd', Null, 'int', 1, 'uint', 0x4000, 'uint', $vkCode) If $aCall[0] = 0 Then Return True Else DllCall('user32.dll', 'bool', 'UnregisterHotKey', 'hwnd', Null, 'int', 1) Return False EndIf EndFunc Func Test() ConsoleWrite('Yayyy!' & @CRLF) EndFunc Edited June 30, 2023 by Andreik kjpolker 1 Link to comment Share on other sites More sharing options...
argumentum Posted June 30, 2023 Share Posted June 30, 2023 43 minutes ago, kjpolker said: Yes I am being lazy ..I can relate, I don't like reading nor thinking myself mikell and kjpolker 1 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now