Fload Posted September 16, 2011 Share Posted September 16, 2011 having trouble with a function i wrote, im fairly new to programming... First call of this function works fine however if i call it again i get this error.... C:\Program Files\AutoIt3\Include\PKtools.au3 (80) : ==> Subscript used with non-Array variable.: MouseClick ( "left" ,$coord[0] ,$coord[1]) MouseClick ( "left" ,$coord^ ERROR Func Check() ;Checks For Color does action according to result Local $coord[3] Local $var2 = "0x57C522" ;Color to check $coord = PixelSearch (404,507,406,509, $var2,20) ; Check for color If @error <> 1 Then Sleep(10) Else $coord = PixelSearch(450,226,570,346, "0x6CC462" ,10) ;find item MouseClick ( "left" ,$coord[0] ,$coord[1]) ;click item sleep(3000) MenuSelect("Flo") sleep(3000) MenuSelect("He") EndIf EndFunc Link to comment Share on other sites More sharing options...
AdamUL Posted September 16, 2011 Share Posted September 16, 2011 Your not error checking your second PixelSearch which re-declares $coord. If the function throws an error $coord = 0, a non-array variable, which is the error it is throwing. Adam Link to comment Share on other sites More sharing options...
Fload Posted September 16, 2011 Author Share Posted September 16, 2011 the only thing i dont understand is that i know that color is there... why would it throw an error? Link to comment Share on other sites More sharing options...
Syed23 Posted September 16, 2011 Share Posted September 16, 2011 Hmm... Have something like this before you handle some arrays..so you can avaoid errors mostly.. If IsArray($coord) Then MouseClick ( "left" ,$coord[0] ,$coord[1]) ;click item Else MouseClick ( "left" ,$coord) ;click item EndIf Note: i gave this option since i don't know complete picture of your program . Try with the above you may not face the previous error. Fload 1 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font] Link to comment Share on other sites More sharing options...
Fload Posted September 16, 2011 Author Share Posted September 16, 2011 thanks syed23 !! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now