Rohwedder wrote: ↑03 Aug 2021, 01:50
You wrote about a problem with a F6 key suspension and the idea:
If I run secound label, first label can't work, after secound label is done, first label can work.
Since your script did not contain the F6 key, I followed that the problem was already solved and just implemented your idea.
If you want to have an on/off suspension with F6 key add:
Suspend disables only Hotkeys and Hotstrings and can thus prevent threads from starting. It has no effect on already started threads.
I had make this:
Code: Select all
Firstlabel:
Suspend
ToolTip % A_IsSuspended ? "Script is off" : "", 400, 0
return
SecoundLabel:
~t::
Suspend On
if (A_IsSuspended){
Hotkey, %FirstKey%, FirstLabel, Off
Loop
if (GetKeyState("Enter", "P") || GetKeyState("Escape", "P"))
break
}
Suspend Off
else if (!A_IsSuspended)
Hotkey, %FirstKey%, FirstLabel, On
return
But with this code is that problem, you click F6 everything works, you click t (run secound label), first label doesn't work (everythings fine), after secoundlabel is done if you want to click F6 and suspend script it work, unsuspend also work. But if script was suspended, and you run secound label you can use first label. How to prevent it? Do you now maybe?