Jump to content

Help with Array errors


Fload
 Share

Recommended Posts

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

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 :graduated: . Try with the above you may not face the previous error.

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...