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 

Loop until text is found

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





PostPosted: Tue Apr 01, 2008 3:03 am    Post subject: Loop until text is found Reply with quote

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.
Back to top
hassoun



Joined: 01 Apr 2008
Posts: 12

PostPosted: Tue Apr 01, 2008 5:33 am    Post subject: Reply with quote

I'd really appreciate if someone could answer.
It's a simple one, really.
Thanks
Back to top
View user's profile Send private message
hassou n
Guest





PostPosted: Tue Apr 01, 2008 4:10 pm    Post subject: Reply with quote

hello?

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



Joined: 19 Mar 2006
Posts: 419

PostPosted: Tue Apr 01, 2008 5:28 pm    Post subject: Reply with quote

Code:
loop, 150
{
if (A_Index < 50)
  ;...
else if (A_Index < 100)
  ;...
else
  ;...
if (var == "text")
  break
}
Back to top
View user's profile Send private message Visit poster's website AIM Address
hassoun



Joined: 01 Apr 2008
Posts: 12

PostPosted: Tue Apr 01, 2008 11:11 pm    Post subject: Reply with quote

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
}
Back to top
View user's profile Send private message
hassoun



Joined: 01 Apr 2008
Posts: 12

PostPosted: Wed Apr 02, 2008 1:59 am    Post subject: Reply with quote

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



Joined: 08 Feb 2008
Posts: 31
Location: VA

PostPosted: Wed Apr 02, 2008 3:19 am    Post subject: Reply with quote

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
}
Back to top
View user's profile Send private message
hassoun



Joined: 01 Apr 2008
Posts: 12

PostPosted: Wed Apr 02, 2008 4:00 am    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message
hassoun



Joined: 01 Apr 2008
Posts: 12

PostPosted: Wed Apr 02, 2008 4:16 am    Post subject: Reply with quote

"routine" text doesn't work


it doesn't break the loop when "routine" is there
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