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 

How do you make a script repeat without turning itself off?

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



Joined: 05 Sep 2007
Posts: 5

PostPosted: Tue Oct 09, 2007 5:00 pm    Post subject: How do you make a script repeat without turning itself off? Reply with quote

I've created a simple script that automatically sends a print command to the print dialog box window. After it is used once it's turning itself off and will not work a second time. I turned it into an exe and had the same results. I need to have this script run continuously on my computer. Is there a way to loop this script so it is continuously running? Any help would be appreciated, thanks.

Barry
Code:

WinWaitActive, Print, ,
{
Send, {Enter}
return
}
Back to top
View user's profile Send private message Send e-mail
MarkyMark



Joined: 28 Sep 2007
Posts: 26

PostPosted: Tue Oct 09, 2007 6:17 pm    Post subject: Reply with quote

Does adding this help?

Code:
#Persistent
Back to top
View user's profile Send private message
Barry



Joined: 05 Sep 2007
Posts: 5

PostPosted: Tue Oct 09, 2007 6:49 pm    Post subject: Reply with quote

Adding #Persistant didn't seem to help. The script continues running, but doesn't control the window more than once. Any other ideas would be appreciated. Thanks.
Back to top
View user's profile Send private message Send e-mail
tonne



Joined: 06 Jun 2006
Posts: 1249
Location: Denmark

PostPosted: Tue Oct 09, 2007 7:05 pm    Post subject: Reply with quote

Code:
Loop
{
  WinWaitActive, Print, ,
  {
    Send, {Enter}
  }
}

_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
Barry



Joined: 05 Sep 2007
Posts: 5

PostPosted: Tue Oct 09, 2007 7:14 pm    Post subject: Reply with quote

Thanks tonne, That works great! Thank you very much for the help, I really appreciate it.
Back to top
View user's profile Send private message Send e-mail
engunneer



Joined: 30 Aug 2005
Posts: 6856
Location: Pacific Northwest, US

PostPosted: Wed Oct 10, 2007 2:27 am    Post subject: Reply with quote

also look into settimer, though loop is a bit more straightforward.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Barry



Joined: 05 Sep 2007
Posts: 5

PostPosted: Wed Oct 10, 2007 2:01 pm    Post subject: Reply with quote

Thanks engunneer, I appreciate the input.
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