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 

Help me with understanding loops please!

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



Joined: 10 Oct 2009
Posts: 6

PostPosted: Sat Oct 10, 2009 9:22 pm    Post subject: Help me with understanding loops please! Reply with quote

Hello, I made a really simple script for myself but want it to repeat it as many times until I press a button to stop it.

How would I make it loop for ever, and how would I add a stop button Razz

I'm sorry if the answer is obvious, I don't get this stuff yet
Back to top
View user's profile Send private message
Wandery
Guest





PostPosted: Sat Oct 10, 2009 9:44 pm    Post subject: Re: Help me with understanding loops please! Reply with quote

jason786 wrote:
Hello, I made a really simple script for myself but want it to repeat it as many times until I press a button to stop it.

How would I make it loop for ever, and how would I add a stop button Razz

I'm sorry if the answer is obvious, I don't get this stuff yet


This isn't a 'proper' way to do it, but it'd work for what you need I imagine
Code:
N = 1
B = 0
Loop, 10 ; makes it loop ten times, leaving it absolutely blank would make it loop forever
 {
   Msgbox, This is msg number %N%
   N++
   If B = 1
   Break
  }
Msgbox, It's Done
Return

B::
B = 1
Return
Back to top
jason786



Joined: 10 Oct 2009
Posts: 6

PostPosted: Sat Oct 10, 2009 9:50 pm    Post subject: Re: Help me with understanding loops please! Reply with quote

Wandery wrote:
jason786 wrote:
Hello, I made a really simple script for myself but want it to repeat it as many times until I press a button to stop it.

How would I make it loop for ever, and how would I add a stop button Razz

I'm sorry if the answer is obvious, I don't get this stuff yet


This isn't a 'proper' way to do it, but it'd work for what you need I imagine
Code:
N = 1
B = 0
Loop, 10 ; makes it loop ten times, leaving it absolutely blank would make it loop forever
 {
   Msgbox, This is msg number %N%
   N++
   If B = 1
   Break
  }
Msgbox, It's Done
Return

B::
B = 1
Return


thank you very much Smile
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 5336
Location: San Diego, California

PostPosted: Sat Oct 10, 2009 9:51 pm    Post subject: Re: Help me with understanding loops please! Reply with quote

Wandery wrote:
This isn't a 'proper' way to do it, but it'd work for what you need I imagine


It also didn't address the request.

@ jason786 , please look here, a 'perfect' example

http://www.autohotkey.com/docs/FAQ.htm#repeat

also, please read :
Tutorial for Newbies
http://www.autohotkey.com/forum/viewtopic.php?t=47791
Back to top
View user's profile Send private message
jason786



Joined: 10 Oct 2009
Posts: 6

PostPosted: Sat Oct 10, 2009 9:53 pm    Post subject: Re: Help me with understanding loops please! Reply with quote

Leef_me wrote:
Wandery wrote:
This isn't a 'proper' way to do it, but it'd work for what you need I imagine


It also didn't address the request.

@ jason786 , please look here, a 'perfect' example

http://www.autohotkey.com/docs/FAQ.htm#repeat

also, please read :
Tutorial for Newbies
http://www.autohotkey.com/forum/viewtopic.php?t=47791


thank you for this Smile
Back to top
View user's profile Send private message
Display posts from previous:   
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