| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Mon Jul 12, 2004 5:18 pm Post subject: Stopping a script |
|
|
Hi
I have a script that moves the mouse around the screen. If I want to cancel it, I can try moving the mouse to the tray to try and click exit or pause, but the script takes over the mouse and I never get chance. I have created another hotkey that EXITs the script, but it closes the script completely. I would like a way to end all the threads that are running in the script.
Thanks
Mike |
|
| Back to top |
|
 |
Beastmaster
Joined: 15 Apr 2004 Posts: 182
|
Posted: Mon Jul 12, 2004 6:50 pm Post subject: |
|
|
| Why not assign a Sleep, 60000 instead of an exit command to the hotkey. In this case you'll be able to Pause the script via its TrayContextMenu manually. |
|
| Back to top |
|
 |
Jon
Joined: 28 Apr 2004 Posts: 373
|
|
| Back to top |
|
 |
Atomhrt Guest
|
|
| Back to top |
|
 |
Pallie
Joined: 05 Jul 2004 Posts: 57 Location: London
|
Posted: Mon Jul 12, 2004 8:26 pm Post subject: |
|
|
Thanks for all your replies. I clearly don't understand threads - I thought these would be no good as they would open up a new thread and pause, sleep ot exit that new thread, so it would just go back to the first thread. I tried it and that is not the case.
Still, the immediate problem is solved, I just need to re-read the thread documentation!
Thanks again
Mike |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10465
|
Posted: Mon Jul 12, 2004 10:12 pm Post subject: |
|
|
Threads are only "quasi threads" and do not run concurrently; they merely give that illusion under certain conditions. As a result, when the current thread is paused, any interrupted threads beneath it stay in a dormant state.
In this case, pressing a hotkey whose action is "pause" creates a new thread, interrupting the old thread. The old thread is thus beneath the " current thread", and since the current thread is instantly paused by the Pause command, everything is dormant, including timers. But now if you press yet another hotkey, it will run as a new thread until completion, at which time the icon will become red again because the paused thread has been uncovered.
I try to explain this on the Threads page, but I'm open to suggestions as to how to clarify it (without being too wordy): http://www.autohotkey.com/docs/misc/Threads.htm |
|
| Back to top |
|
 |
|