| View previous topic :: View next topic |
| Author |
Message |
guessed Guest
|
Posted: Wed Apr 13, 2005 10:42 pm Post subject: hotkey for emergency exit |
|
|
I want to create an emergency hotkey which exits all or selected threads but keeps the script alive
so far my understanding is that Exit just kills its on thread and ExitApp kills the whole script - any idea (maybe a PostMessage)? Thanx! |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Wed Apr 13, 2005 11:22 pm Post subject: |
|
|
Although there's no easy way to do this, you could assign a hotkey to pause and unpause all threads:
^!p::Pause ; Press it once to pause all threads, and again to unpause.
If you still need a way to kill all other threads, probably the only solution is to set a global variable that each thread is responsible for checking periodically. Each thread should exit when it sees the variable change to a pre-arranged stop-signal. |
|
| Back to top |
|
 |
TeknoMusicMan
Joined: 14 Apr 2005 Posts: 188 Location: Wisconsin, USA
|
Posted: Thu Apr 14, 2005 12:01 pm Post subject: |
|
|
You could try the Reload command for stopping all threads
The only problem with that is if you have any dynamic variables they would be cleared out.
Allthough a way around that would be to write the all the values of all your variables to a txt file before executing the reload command and then having your script read the file on load.
Just a thought |
|
| Back to top |
|
 |
niwi
Joined: 27 Feb 2005 Posts: 128 Location: Heidelberg, Germany
|
Posted: Thu Apr 14, 2005 12:07 pm Post subject: |
|
|
Hi,
maybe this will work:
You create everey thread in an own ahk file. Than you write a launcher script which will execute all these scripts. And every pre-selected script react on the hotkey.
NiWi. |
|
| Back to top |
|
 |
Sephra
Joined: 11 Apr 2005 Posts: 4 Location: So-Cal
|
Posted: Fri Apr 15, 2005 6:43 pm Post subject: |
|
|
| Chris wrote: | Although there's no easy way to do this, you could assign a hotkey to pause and unpause all threads:
^!p::Pause ; Press it once to pause all threads, and again to unpause. |
That makes it seem like the puase command affects all threads. Does it? I didn't think so... _________________ "Truly great madness cannot be achieved without significant intelligence." --Henrik Tikkanen |
|
| Back to top |
|
 |
TeknoMusicMan
Joined: 14 Apr 2005 Posts: 188 Location: Wisconsin, USA
|
Posted: Fri Apr 15, 2005 7:08 pm Post subject: |
|
|
| Quote: | | Unlike Suspend -- which disables hotkeys -- pause will freeze the current thread (and as a result, all interrupted threads beneath it will lie dormant). |
|
|
| Back to top |
|
 |
|