| View previous topic :: View next topic |
| Author |
Message |
Hassoun Guest
|
Posted: Tue Apr 01, 2008 3:03 am Post subject: Loop until text is found |
|
|
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
|
Posted: Tue Apr 01, 2008 5:33 am Post subject: |
|
|
I'd really appreciate if someone could answer.
It's a simple one, really.
Thanks |
|
| Back to top |
|
 |
hassou n Guest
|
Posted: Tue Apr 01, 2008 4:10 pm Post subject: |
|
|
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
|
Posted: Tue Apr 01, 2008 5:28 pm Post subject: |
|
|
| Code: | loop, 150
{
if (A_Index < 50)
;...
else if (A_Index < 100)
;...
else
;...
if (var == "text")
break
} |
|
|
| Back to top |
|
 |
hassoun
Joined: 01 Apr 2008 Posts: 12
|
Posted: Tue Apr 01, 2008 11:11 pm Post subject: |
|
|
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 |
|
 |
hassoun
Joined: 01 Apr 2008 Posts: 12
|
Posted: Wed Apr 02, 2008 1:59 am Post subject: |
|
|
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 |
|
 |
no1readsthese
Joined: 08 Feb 2008 Posts: 31 Location: VA
|
Posted: Wed Apr 02, 2008 3:19 am Post subject: |
|
|
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 |
|
 |
hassoun
Joined: 01 Apr 2008 Posts: 12
|
Posted: Wed Apr 02, 2008 4:00 am Post subject: |
|
|
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 |
|
 |
hassoun
Joined: 01 Apr 2008 Posts: 12
|
Posted: Wed Apr 02, 2008 4:16 am Post subject: |
|
|
"routine" text doesn't work
it doesn't break the loop when "routine" is there |
|
| Back to top |
|
 |
|