Grape Posted June 1, 2009 Posted June 1, 2009 I'm trying to find the position of a control and then popping a message box to show the coordinates. When I run the script, I get an error: "Line -1: Error: Subscript used with non-Array variable." How do I get past this? Here's my script. Opt("WinTextMatchMode", 2) ;1=complete, 2=quick $map_title = "Map View" WinActivate ($map_title,"") $size = ControlGetPos($map_title,"","[CLASS:AfxFrameOrView80; INSTANCE:1]") ;MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3]) ;ControlClick($map_title,"","[CLASS:AfxFrameOrView80; INSTANCE:1]","right") MsgBox(0,"Coord",$size[0]) sleep(10000) exit
oMBRa Posted June 1, 2009 Posted June 1, 2009 you get that error becouse ControlGetPos failed to find the control
PsaltyDS Posted June 1, 2009 Posted June 1, 2009 Grape said: I'm trying to find the position of a control and then popping a message box to show the coordinates. When I run the script, I get an error: "Line -1: Error: Subscript used with non-Array variable." How do I get past this? Here's my script. Opt("WinTextMatchMode", 2) ;1=complete, 2=quick $map_title = "Map View" WinActivate ($map_title,"") $size = ControlGetPos($map_title,"","[CLASS:AfxFrameOrView80; INSTANCE:1]") ;MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3]) ;ControlClick($map_title,"","[CLASS:AfxFrameOrView80; INSTANCE:1]","right") MsgBox(0,"Coord",$size[0]) sleep(10000) exit What is the actual ClassNameNN of the control? Your "[CLASS:AfxFrameOrView80; INSTANCE:1]" is for AfxFrameOrView801, not AfxFrameOrView81. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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