Thorsten71 Posted January 17, 2020 Posted January 17, 2020 Hi there, I'm trying to create a small tool that inserts text blocks (broadly speaking) into an editor window after a hotkey is pressed. In order not to collide with predefined shortcuts, I use {pause] as an hotkey to activate all hotkeys, so that I can e.g., press {pause} "a". My problem is that I wan't to delete the hotkeys for any key pressed (after {pause}) regardless if the key is a hotkey or not ... Any suggestions? Global $hKeyArray[4][2] = [ _ ["c", "_addControl"], _ ["i", "_addIf"], _ ["e", "_addEndrep"], _ ["n", "_neueFrage"] _ ] HotKeySet("{PAUSE}", "_toggleHotkeys") Func _toggleHotkeys() If ($awaitingShortut) Then _deactivateHotkeys() Else _activateHotkeys() EndIf EndFunc Func _activateHotkeys() For $i = 0 To (UBound($hKeyArray) - 1) Step 1 HotKeySet($hKeyArray[$i][0],$hKeyArray[$i][1]) Next $awaitingShortut=true ConsoleWrite("waiting for hotkey" & @CRLF) EndFunc Func _deactivateHotkeys() For $i = 0 To (UBound($hKeyArray) - 1) Step 1 HotKeySet($hKeyArray[$i][0]) Next $awaitingShortut=false ConsoleWrite("disable hotkeys" & @CRLF) EndFunc Best Thorsten
Nine Posted January 17, 2020 Posted January 17, 2020 Seems alright to me, you just need to initialise $awaitingShortcut = True, and make a [While 1 sleep (100) WEnd] loop so the script doesn't exit immediately. You may also want to define a hotkey to exit your script. Of course, the 4 hotkey functions need to be included in the script “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (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 Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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