Sign in to follow this  
Followers 0
Guest RobK60

Please help me correct this

4 posts in this topic

This bit of code doesnt seem to be working properly... what i want it to do is search through the rectangle to look for a certain color. and click it ... the object moves thus the reason for doing it 4 times it ensures that the object gets clicked.

It seems to work.....untill the second time through the loop it will give me the error code: subscript used with non-array variable.

I dont understand... your help is appreciated

while 1
$a=0
$b=0
$c=0
$e=0

$a= PixelSearch(44,257,486,272,0x00FFFF)
mouseclick("left",$a[0],$a[1])

$b= PixelSearch(46,257,486,272,0x00FFFF)
mouseclick("left",$b[0],$b[1])

$c= PixelSearch(45,257,486,272,0x00FFFF)
mouseclick("left",$c[0],$c[1])


$e= PixelSearch(42,257,486,272,0x00FFFF)
mouseclick("left",$e[0],$e[1])

sleep(500)
mouseclick("left",589,529)
send("{PGUP}")
sleep(7000)
send("{PAUSE}")
sleep(60)
mouseclick("left",585,474)
mouseclick("left",508,279)
send("{PGUP}")
sleep(7000)
send("{PAUSE}")
sleep(10000

Share this post


Link to post
Share on other sites



Your mouse clicks assume that PixelSearch returns an array. However, if PixelSearch only returns an array if the color is found! (The help file says that PixelSearch returns numeric 1 and sets @error to 1 if it "fails.")

Try something like this:

$a= PixelSearch(44,257,486,272,0x00FFFF)
If IsArray($a) Then mouseclick("left",$a[0],$a[1])

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ok now its not saying its an array...so most likely is not finding the color, when doing pixel search for the 4 variables right left bottom and top should i be using the X vars on the window spy util to determine the area to search? im not clear on how that works

this is how i have it set up now using only X vars PixelSearch(44,257,486,272,0x00FFFF) what is it i should be doing? my whole screen?

Edited by RobK60

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0