hrabikk Posted July 14, 2013 Share Posted July 14, 2013 Hello, what should i change in this code to make it work? $firstpixel=PixelSearch(100,100,100,200,0xFFFFFF,0,0) If Not @error Then $secondpixel=PixelSearch(200,$firstpixel[1]200,$firstpixel[1],0xFFFFFF,0,0) If Not @error Then MsgBox(0, "X and Y are:", $pixel1[0] & "," & $pixel1[1]) EndIf EndIf I want the 2nd pixelsearch starts from the firstpixel[1] Y array but it keeps getting errors that firstpixel[1] is used without being declared or smthing like that. Link to comment Share on other sites More sharing options...
JohnOne Posted July 14, 2013 Share Posted July 14, 2013 The error is more likely to be that $pixel1 is being used without being declared, and that would be because you are trying to use it, without declaring it. Meaning there is no such variable. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
hrabikk Posted July 14, 2013 Author Share Posted July 14, 2013 $firstpixel=PixelSearch(237,553,237,700,0xFEFEFE,0,0) If Not @error Then sleep(50) $2ndpixel=PixelSearch($firstpixel[0]+2,$firstpixel[1]-5,$firstpixel[0]+2,$firstpixel[1]+5,0xFFFFFF,0,0) If Not @error Then ToolTip("X and Y are:", $2ndpixel[0] & "," & $2ndpixel[1],0,0) EndIf EndIf And now error: Subscript used with non-Array variable.: ToolTip("X and Y are:", $2ndpixel[0] & "," & $2ndpixel[1],0,0) ToolTip("X and Y are:", $2ndpixel^ ERROR >Exit code: 1 Time: 4.119 So where is the mistake this time? Link to comment Share on other sites More sharing options...
Developers Jos Posted July 14, 2013 Developers Share Posted July 14, 2013 (edited) $firstpixel=PixelSearch(237,553,237,700,0xFEFEFE,0,0) If Not @error Then sleep(50) $2ndpixel=PixelSearch($firstpixel[0]+2,$firstpixel[1]-5,$firstpixel[0]+2,$firstpixel[1]+5,0xFFFFFF,0,0) If Not @error Then ToolTip("X and Y are:", $2ndpixel[0] & "," & $2ndpixel[1],0,0) EndIf EndIf And now error: Subscript used with non-Array variable.: ToolTip("X and Y are:", $2ndpixel[0] & "," & $2ndpixel[1],0,0) ToolTip("X and Y are:", $2ndpixel^ ERROR >Exit code: 1 Time: 4.119 So where is the mistake this time? Check the PixelSearch details in the helpfile, esspecially the part that talks about when the Function fails to find the pixel. The example shows what to do to test for this. Jos Edited July 14, 2013 by Jos 0xdefea7 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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