AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Stopping a script

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Mon Jul 12, 2004 5:18 pm    Post subject: Stopping a script Reply with quote

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

PostPosted: Mon Jul 12, 2004 6:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
Jon



Joined: 28 Apr 2004
Posts: 373

PostPosted: Mon Jul 12, 2004 7:11 pm    Post subject: Reply with quote

This any good?

http://www.autohotkey.com/docs/commands/Pause.htm
Back to top
View user's profile Send private message Send e-mail
Atomhrt
Guest





PostPosted: Mon Jul 12, 2004 7:45 pm    Post subject: Reply with quote

I had a similar question in this tread and a method is posted:
http://www.autohotkey.com/forum/viewtopic.php?t=284
Back to top
Pallie



Joined: 05 Jul 2004
Posts: 57
Location: London

PostPosted: Mon Jul 12, 2004 8:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Mon Jul 12, 2004 10:12 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group