Sign in to follow this  
Followers 0
Grape

Having issues with ControlGetPos

3 posts in this topic

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

Share this post


Link to post
Share on other sites



you get that error becouse ControlGetPos failed to find the control

Share this post


Link to post
Share on other sites

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

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