Popular Post Nine 1,505 Posted February 14, 2021 Popular Post Share Posted February 14, 2021 This is based on this topic. With this UDF, you can define all the HotKeySet you want on any of the keyboards. The keys registered as HotKeySet are not sent to the active window. I also created a "Event-driven" mode for lengthy procedure. There is still the immediate action mode for short procedure. Note that in Event-driven mode, you will need to create an close loop to intercept the HotKey events. Events are asynchronous. In Event-driven mode only one procedure can be running at a given time. But immediate action procedure can interrupt a Event-driven procedure. All procedures are declared as actual function (without quotes). It is important that lengthy procedure should be declared as Event-driven, otherwise the system may become unstable. Here an example. As usual if you have any suggestion, I would be very interested to hear them. #include "MKHKS-UDF.au3" Example() Func Example() HotKeySet("{ESC}", _Exit) _MKHKS_Initialize () _MKHKS_Register_HotKey("+g", _Long, 1, True) ; declared on kb 1 as event-driven _MKHKS_Register_HotKey("^h", _Short, 0, False) ; declared on kb 0 as immediate action While True Sleep(50) _MKHKS_WaitForEvent() WEnd EndFunc Func _Exit() Exit EndFunc ;==>_Exit Func _Long() ConsoleWrite ("Key Pressed _Long" & @CRLF) For $i = 1 to 2000 Sleep(10) Next ConsoleWrite ("Long terminated" & @CRLF) EndFunc Func _Short() ConsoleWrite ("Key Pressed _Short" & @CRLF) EndFunc MKHKS-UDF.au3 Zmy, argumentum, EskoFIN and 2 others 4 1 Not much of a signature but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search content in au3 files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to post Share on other sites
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