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 

New Command Request: LoopUntil

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Harmor



Joined: 06 Nov 2005
Posts: 183

PostPosted: Fri Jan 18, 2008 2:25 pm    Post subject: New Command Request: LoopUntil Reply with quote

Perhaps there's a better way to do this, but I would like to Loop until a key is pressed or condition is occurs.


LoopUntil [,Expr] [,Count]

After before and after each line in the loop the Expr is checked. If it is true then the next line of the loop continues, otherwise the loop breaks.

Example:
Code:
Loop
{
  if(x=5)
    break;
  MouseClick, left, 222, 333
  if(x=5)
    break;
  Sleep 200
  if(x=5)
    break;
  MouseClick, left, 444, 555
  if(x=5)
    break;
  Sleep 200
}

LoopUntil Example of above:

LoopUntil, x=5
{
  MouseClick, left, 222, 333
  Sleep 200
  MouseClick, left, 444, 555
  Sleep 200
}



Again, perhaps theres another way to do this, but I haven't found a way.


Thanks.
_________________
//TODO: Create kewl sig...
Back to top
View user's profile Send private message
TheIrishThug



Joined: 19 Mar 2006
Posts: 363

PostPosted: Fri Jan 18, 2008 2:53 pm    Post subject: Reply with quote

Every language I've seen only have loops that check the break condition once (at the beginning or the end). I've also never needed a loop that had the possibility to break after every line.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Titan



Joined: 11 Aug 2004
Posts: 5026
Location: imaginationland

PostPosted: Fri Jan 18, 2008 4:38 pm    Post subject: Reply with quote

AutoHotkey Planned Features wrote:
New syntax: 1) While-loops and Do-Loops (to improve script readability and maintainability); 2) A simple select/switch/case structure as an alternative to a series of ""else if"" statements.

_________________

RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
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 -> Wish List 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