The issue was that when using multiple hotkeys with functions which took some time to process, the first hotkey function would not complete if a subsiquent hotkey was pressed until the second hotkey function had finished.
You end up with actions which could run out of sequence.
The code below will queue the Hotkeys and run them in order One at a time. You can set hotkeys that are allowed to queue. If you use the standard HotkeySet method then this/these hotkeys will interupt the queue.
If you try the below code and type abababababababab follewed by the c key you will see in the Scite console pain the hotkeys are buffered and the each function will not run until it's turn
If you run the script again and type abababababababab then the esc key you will see the esc key will jump the queue and exit the script, if the esc key performed another action other than exit then this would be performed and then the queue would be continued
Plain Text
#include "HotKeyBuffer.au3" _HotKeySet("a","MyaFunc") _HotKeySet("b","MybFunc") _HotKeySet("c","MycFunc") HotkeySet("{esc}","_quit") While 1 Sleep(100) WEnd Func MyaFunc() ConsoleWrite("This is my a function" & @crlf) Sleep(2000) EndFunc Func MybFunc() ConsoleWrite("This is my b function" & @crlf) Sleep(2000) EndFunc Func MycFunc() Msgbox(0,"","C key all done") Exit EndFunc Func _quit() Exit Endfunc
Edited to make this a UDF for ease of use
Attached Files
Edited by ChrisL, 20 March 2008 - 09:14 PM.








