I'm trying to write a script to scan a website for links and save them into an excel spreadsheet for me. So far i haven't done any loops and the program can login and create the correct search parameters... anyway long story short.
THIS is my first attempt at a loop.
Sleep 5000
x=0
while x < 1 imagesearch Zx, Zy, 189, 304, 780, 352
P:\Users\blahblahblah\Desktop\pics4program\The picture.bmp
iF ErrorLevel SendEvent down SendEvent down
Else
X+1
MouseMove, Zx ,Zy
Sleep 700
Click
Error at line 3:
P:\Users\blahblahblah\Desktop\pics4program\The picture.bmp
The leftmost character above is illegal in an expression
I am a complete and utter noob. I bow to the great forum gods and offer this smilee emoji as a token of my apprectiation.
ImageSearch in a loop.
Re: ImageSearch in a loop.
Try this:
Notice Blocks and keeping things on the right lines. If you want your ImageSearch broken up on two lines, you can do
As a comma as the first character tells AHK to treat that as a continuation of the previous line.
Code: Select all
Sleep 5000
x:=0 ; it's often better to use the assign operator and leave = for comparing values
while x < 1
{
imagesearch, Zx, Zy, 189, 304, 780, 352, P:\Users\blahblahblah\Desktop\pics4program\The picture.bmp
If ErrorLevel
{
SendEvent {down 2}
}
else
{
x++
MouseMove, Zx, Zy
Sleep 700
Click
}
}
return
Code: Select all
imagesearch, Zx, Zy, 189, 304, 780, 352
, P:\Users\blahblahblah\Desktop\pics4program\The picture.bmp
Re: ImageSearch in a loop.
hey thanks a lot. I have very little coding education and am just kind of stumbling through. But yeah I see how keeping everything neat makes things less prone to bug.
Who is online
Users browsing this forum: doodles333, Frogrammer and 259 guests