When creating multiple AhkThread(), the combination of some keys that are pressed by an AhkThread() will be combined with other keys that are pressed in the other AhkThread(), or if you press manually while an AhkThread() is being read (example below). The question is, is there any safe way to mount the script to avoid this combination that can cause multiple errors?
Code: Select all
Gui, +AlwaysOnTop
Gui, Font, s30
Gui, Add, Button, w200 h100 vStart gStart, START!
Gui, Show
return
toggle := 0
Start:
toggle := !toggle
if (toggle) {
GuiControl,, Start, STOP!
VarCrit := CriticalObject({})
script:="
("
VarCrit := CriticalObject(A_Args[1])
Loop {
Send, {F4}
ToolTip, The loop is pressing F4. If you press Alt it will combine and close.
}
)"
Dll:=AhkThread(script,&VarCrit)
} else {
Dll.ahkTerminate.1
GuiControl,, Start, START!
}
return
ESC::ExitApp
GuiClose:
ExitApp
Code: Select all
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#MaxThreads 20
Process, Priority, , A
#KeyHistory 0