Page 1 of 1

which function can exit thread in ahk_h beta3?

Posted: 07 Feb 2022, 06:24
by qingyaoyao79
In ahk_h beta3 , I tried to use ahkterminate , but it seems don't work . Is there any other function to exit the thread?

Re: which function can exit thread in ahk_h beta3?

Posted: 07 Feb 2022, 08:31
by HotKeyIt
It is still ahkTerminate, I forgot to add it to docs, updated now, see NewThread.

Code: Select all

ahk:=NewThread("MsgBox 'Thread'")
Sleep 1000
ahk.ahkterminate()
MsgBox 'End'

Re: which function can exit thread in ahk_h beta3?

Posted: 07 Feb 2022, 21:29
by qingyaoyao79

Code: Select all

script1 := "
(
#NoTrayIcon 
Persistent    
loop
{
ToolTip "s1-" A_index, 100, 150
sleep 50

}
)"

script2 := "
(
#NoTrayIcon 
Persistent    
Loop
{
ToolTip "s2-" A_index, 200, 150
sleep 50
}
)"

F1::
{

MyThread1:=NewThread(script1)
MyThread2:=NewThread(script2)
}

F2::
{
 
  if (IsSet(MyThread1)) 
 MyThread1.ahkterminate()
 if(IsSet(MyThread2))
MyThread2.ahkterminate()
}
press F1 run the script , and then press F2 , the script still running , not stopped .

Re: which function can exit thread in ahk_h beta3?

Posted: 08 Feb 2022, 21:45
by HotKeyIt
This has been fixed now.

Re: which function can exit thread in ahk_h beta3?

Posted: 13 Feb 2022, 02:35
by qingyaoyao79
Thanks.It is ok now.
I try the ahkassign example, it doesn't work, it works well in version (1.1.33.10).