Code: Select all
Gui, Add, CheckBox, x5 y20 w40 h20 vsample ghunt, test
Gui, Add, Text, x5 y40 w60 h20, F1: start
Gui, Show, x100 y100 h100 w100, test
Return
GuiClose:
ExitApp
return
F1 ::
if (sample = 1)
{
error_sample: = AhkThread (script_sample)
}
return
F2 ::
ExitApp
return
hunt:
gui, submit, nohide
script_sample =
(%
ParentThread: = AhkExported ()
Random, action, 0, 1
infinite:
Loop
{
sample: = ParentThread.AhkGetVar.sample
if (sample = 1)
{
break
}
}
Loop
{
sample: = ParentThread.AhkGetVar.sample
if (sample = 1)
{
break
}
}
Loop
{
sample: = ParentThread.AhkGetVar.sample
if (sample = 1)
{
break
}
}
Loop
{
sample: = ParentThread.AhkGetVar.sample
if (sample = 1)
{
continue, infinite
}
}
return
)
if (sample = 0)
{
error_sample.ahkterminate []
}
return
The above code is an example of a code that occurs when the auto hotkey stops working or suddenly turns off after a certain period of time (10 minutes to 1 hour if it is longer) after creating a thread.
As you can see in the code, if you press the F1 key while the gui checkbox is checked, an error_sample thread is created. However, if you look at the error_sample thread code above, you can escape the infinite loop statement into a break and continue to return to the first infinite loop statement. This is a simple script that does the work. Don't ask why you wrote the code that way. The code above is an example code, and the actual low-cost code is code that needs to be written that way. The code above is an example code that causes a bug. Error_sample thread When I look at the code of, I don't understand why. But when I write the code like that, AutoHotkey is turned off unconditionally. I don't know why. So the conclusion I made is that this is a bug in the AutoHotkey_H version. Please help this hotkeyit
Below are the specifications of the computer I am using and the AutoHotkey version.
Operating system: Windows 10 pro
Autohotkey version: autohotkey_h 1.1.30.03 x64 release MD
cpu: intel i5-4690
memory: 8GB
Graphics card: NVIDIA GeForce GTX 1050
For reference, I would like to understand that the word or sentence may be awkward or difficult to understand using the Google Translator, and there was no problem when the code in the error_sample thread was used as the main script above. I have a problem when I put it in. I want to know why this is happening