which function can exit thread in ahk_h beta3?

Ask for help, how to use AHK_H, etc.
qingyaoyao79
Posts: 3
Joined: 27 Dec 2021, 02:29

which function can exit thread in ahk_h beta3?

07 Feb 2022, 06:24

In ahk_h beta3 , I tried to use ahkterminate , but it seems don't work . Is there any other function to exit the thread?
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: which function can exit thread in ahk_h beta3?

07 Feb 2022, 08:31

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'
qingyaoyao79
Posts: 3
Joined: 27 Dec 2021, 02:29

Re: which function can exit thread in ahk_h beta3?

07 Feb 2022, 21:29

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 .
qingyaoyao79
Posts: 3
Joined: 27 Dec 2021, 02:29

Re: which function can exit thread in ahk_h beta3?

13 Feb 2022, 02:35

Thanks.It is ok now.
I try the ahkassign example, it doesn't work, it works well in version (1.1.33.10).

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 4 guests