AutoHotkey Community

It is currently May 26th, 2012, 5:10 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Loop until text is found
PostPosted: April 1st, 2008, 4:03 am 
Hi. I looked through the tutorial, but couldn't find all that I needed to perform this loop:
-Click x, y (50 times)
then -Click x2, y2 (50 times)
then -Click x3, y3 (50 times)
(with 1 second delays)

-if, at any click, "text" is found, abort loop and launch "alert.mp3"

I hope you understand what I want, and that I get an answer soon.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2008, 6:33 am 
Offline

Joined: April 1st, 2008, 4:23 am
Posts: 12
I'd really appreciate if someone could answer.
It's a simple one, really.
Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2008, 5:10 pm 
hello?

i just need a command to break the loop when "text" is found!! anyone?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2008, 6:28 pm 
Offline

Joined: March 19th, 2006, 5:52 am
Posts: 419
Code:
loop, 150
{
if (A_Index < 50)
  ;...
else if (A_Index < 100)
  ;...
else
  ;...
if (var == "text")
  break
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2008, 12:11 am 
Offline

Joined: April 1st, 2008, 4:23 am
Posts: 12
Thank you Irish.
Here's what I made of it. But I'm still having error messages when I enter delay times. I tried putting "Sleep, 1000" under Click but it didn't work. Also, I want it to break the loop and open file "alert.mp3"
Basically I want it to click 150 times, with 1-second intervals. If "routine" is found, it aborts and opens "alert.mp3"


Code:
loop, 150
{
if (A_Index < 50)
  Click 550, 627
else if (A_Index < 100)
  Click 447, 500
else
  Click 333, 627
if (var == "Routine")
  break
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2008, 2:59 am 
Offline

Joined: April 1st, 2008, 4:23 am
Posts: 12
all that i need left is incorporating 1-second delays into the above code.

when i tried putting "sleep 1000" under click, it started going crazy and kept clicking wildly and didn't stop until i closed autohotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2008, 4:19 am 
Offline

Joined: February 8th, 2008, 9:17 pm
Posts: 31
Location: VA
Add the delay at the end of the loop
can you explain were the text is so we can help we can help you incorporate it into the script. as of now it will not 'find' the text

Code:
loop, 150
{
if (A_Index < 50)
  Click 550, 627
else if (A_Index < 100)
  Click 447, 500
else
  Click 333, 627

var = ; Get Text
if (var == "Routine")
  break

Sleep 1000
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2008, 5:00 am 
Offline

Joined: April 1st, 2008, 4:23 am
Posts: 12
wow no1readthese!!


thank you for your help!!

now i'll just have to check for the "routine" eventually. i'm sure it'll work though.

thanks again! (both)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2008, 5:16 am 
Offline

Joined: April 1st, 2008, 4:23 am
Posts: 12
"routine" text doesn't work


it doesn't break the loop when "routine" is there


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Alpha Bravo, Google [Bot], mrhobbeys, oldbrother, poserpro, Yahoo [Bot] and 50 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group