Hi,
I have searched many posts about this but the solution is not feasible for some of my more complicated scripts. I understand that there is no global 'Exit' command to kill ALL threads and leave the script active.
Most workarounds involve assigning a break = 1 variable to a hotkey. While the loop is constantly checking to see if break = 1 to then exit the thread. Which is fine if your loop has only a few lines. But my loop contains HUNDREDS of tasks. I want to be able to kill that thread instantly. The workaround that I have put in place is silly. I have a Check(Break) function every few lines or so to basically take a quick peek to see if its ok to continue. Is there a way to check if Break = 1 with every new line of code?
Or at least may I offer an 'Exit, All' suggestion. Or a 'soft reload' so to speak.
Kill Underlying Thread with Hotkey
-
- Posts: 3
- Joined: 26 Jul 2017, 19:58
- Masonjar13
- Posts: 1555
- Joined: 20 Jul 2014, 10:16
- Location: Не Россия
- Contact:
Re: Kill Underlying Thread with Hotkey
I'm not aware of anything besides what you've mentioned, but you may consider running them on literally different threads using AutoHotkey_H's multi-threading DLL. I have an implementation you may use here: threadMan.ahk
-
- Posts: 3
- Joined: 26 Jul 2017, 19:58
Re: Kill Underlying Thread with Hotkey
Thanks Masonjar I was after a more vanilla solution without needing extra libraries.
Re: Kill Underlying Thread with Hotkey
Using a command would achieve the same effect.
Code: Select all
reload
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
Re: Kill Underlying Thread with Hotkey
Thank you TAC109 for your post! This achieves the functionality that I've been looking for.
I was expecting there to be/hoping for (as mangoninja said) a "global 'Exit' command to kill ALL threads and leave the script active", but I hadn't found anything.
FYI, here's my post below
https://autohotkey.com/boards/viewtopic ... 73#p166273
I was expecting there to be/hoping for (as mangoninja said) a "global 'Exit' command to kill ALL threads and leave the script active", but I hadn't found anything.
FYI, here's my post below
https://autohotkey.com/boards/viewtopic ... 73#p166273
Re: Kill Underlying Thread with Hotkey
A 'soft reload' can be achieved by dumping any variables you want to keep to an ini file and then reloading the script. The script can then read the ini file and go from there.
See:
https://www.autohotkey.com/docs/commands/IniRead.htm
https://www.autohotkey.com/docs/commands/IniWrite.htm
See:
https://www.autohotkey.com/docs/commands/IniRead.htm
https://www.autohotkey.com/docs/commands/IniWrite.htm
Who is online
Users browsing this forum: Google [Bot] and 306 guests