How to terminate specific thread(hotkey) with another hotkey? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
fiendhunter
Posts: 133
Joined: 24 Jul 2019, 15:27

How to terminate specific thread(hotkey) with another hotkey?

Post by fiendhunter » 11 Aug 2022, 14:18

I couldnt make it work. I cant add anything in main thread.
I just want to terminate main thread with an hotkey.

Code: Select all

!F1::           ; main thread
loop
{
sleep 1000
number++
tooltip, %number% , 500,500
}
return

F2::               ; Terminate !F1 with F2 hotkey
Exit, !F1
return


kaiserwilli
Posts: 3
Joined: 01 Aug 2022, 15:59

Re: How to terminate spesific thread(hotkey) with another hotkey?

Post by kaiserwilli » 11 Aug 2022, 14:51

You could have the first thread check if the second thread has called for it to terminate, then have the first thread terminate itself.

Code: Select all

!F1::           ; main thread
terminate := false
loop
{
sleep 1000
if %terminate%
	break
number++
tooltip, %number% , 500,500
}
return

F2::               ; Terminate !F1 with F2 hotkey
terminate := true
return

fiendhunter
Posts: 133
Joined: 24 Jul 2019, 15:27

Re: How to terminate spesific thread(hotkey) with another hotkey?

Post by fiendhunter » 11 Aug 2022, 15:48

kaiserwilli wrote:
11 Aug 2022, 14:51
You could have the first thread check if the second thread has called for it to terminate, then have the first thread terminate itself.

Code: Select all

!F1::           ; main thread
terminate := false
loop
{
sleep 1000
if %terminate%
	break
number++
tooltip, %number% , 500,500
}
return

F2::               ; Terminate !F1 with F2 hotkey
terminate := true
return
its not doable with supercomplex, 4million+ line script.

Post Reply

Return to “Ask for Help (v1)”