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 

Pause On/Off

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



Joined: 20 Apr 2005
Posts: 22
Location: Princeton NJ USA

PostPosted: Tue Apr 26, 2005 6:19 pm    Post subject: Pause On/Off Reply with quote

Hi...Suppose you have set Pause On. How can you set Pause Off by clicking the Enter key (or some other key)? I assume no code can run during Pause On. Am I correct? Thanks. Playfullscientist
_________________
I am a playful scientist
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
TeknoMusicMan



Joined: 14 Apr 2005
Posts: 188
Location: Wisconsin, USA

PostPosted: Tue Apr 26, 2005 6:24 pm    Post subject: Reply with quote

Code:
Pause::Pause, on

{Enter}:: Pause, off

p::Pause, toggle


I think if I am remembering correctly if the hotkey is executing the pause command while the script is pause ahk will still let it run.

Check the Pause Command
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Apr 26, 2005 6:36 pm    Post subject: Reply with quote

As stated in the documentation, "New hotkeys can still be launched while the script is paused." This means that the currently running thread will be paused, as well as any threads waiting to run after it, but new threads can still be launched by the user. For instance, this script will show the first msgbox, then once you close it, it will pause until you press Space, at which time it will show the second one.

Code:
msgbox,MsgBox 1
pause,on
msgbox,MsgBox 2
exitapp

~space::pause,off


And this one will allow you to delay the coming off each msgbox; they will follow each other instantly unless you close one with Space. Press space again to unpause and continue execution.

Code:
msgbox,MsgBox 1
msgbox,MsgBox 2
msgbox,MsgBox 3
msgbox,MsgBox 4
msgbox,MsgBox 5
msgbox,MsgBox 6
exitapp

~space::pause


Experiment with it on your own, you never know what you might learn.
Back to top
View user's profile Send private message
playfullscientist



Joined: 20 Apr 2005
Posts: 22
Location: Princeton NJ USA

PostPosted: Tue Apr 26, 2005 6:40 pm    Post subject: Pause On/Off Reply with quote

Hi...I tried this script:


Pause On
Enter::Pause Off

It seems to work fine. However, when I place it in two different point in the same script, the program fails to compile. Do I have to write this pair of lines in a subroutine? Thanks. Playfullscientist
_________________
I am a playful scientist
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Apr 26, 2005 7:43 pm    Post subject: Reply with quote

Could you post the script, please?
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5390
Location: /b/

PostPosted: Tue Apr 26, 2005 7:50 pm    Post subject: Re: Pause On/Off Reply with quote

playfullscientist wrote:
Pause On
Enter::Pause Off

It seems to work fine. However, when I place it in two different point in the same script, the program fails to compile. Do I have to write this pair of lines in a subroutine? Thanks. Playfullscientist

That's strange, I never known scripts to work when they don't if compiled. Maybe you'll find the following useful: #Persistent, #UseHook, #InstallKeybdHook.
_________________

Back to top
View user's profile Send private message Visit poster's website
playfullscientist



Joined: 20 Apr 2005
Posts: 22
Location: Princeton NJ USA

PostPosted: Tue Apr 26, 2005 7:55 pm    Post subject: Pause On/Off Reply with quote

Hi...Let me explain more carefully. If I use the lines

Pause On
Enter::Pause Off

only once in the script, then it works fine. If
I use the same two lines a second time elsewhere
in the program, it fails to compile (Error Message).
Thanks. Playfullscientist
_________________
I am a playful scientist
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Titan



Joined: 11 Aug 2004
Posts: 5390
Location: /b/

PostPosted: Tue Apr 26, 2005 7:58 pm    Post subject: Re: Pause On/Off Reply with quote

You'll obviously get an error message if you assign a routine to the same hotkey more than once. You could use #Persistent, the hotkey once anywhere in the script and the Pause command itself wherever.
_________________

Back to top
View user's profile Send private message Visit poster's website
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