v1rtu0s1ty Posted July 27, 2005 Posted July 27, 2005 (edited) I've been having a hard time figuring out why I'm getting different coordinate values of an active window. AutoIT Window Info tells me the correct values however, wingetpos doesn't. Here is the scenario. WinGetPos returns me 300,200 for the X & Y coordinates while AutoIT Window Info gives me 199, 123. WinGetPos gives me 66,22 for the height and width which is weird but AutoIT Window Info gives 626,456. Here is the code: AutoItSetOption("WinTitleMatchMode", 4) if WinExists("classname=rek20006c0000002","") Then WinActivate("Rekon 2000"); this activates the parent along with the child sitting on it AutoItSetOption("WinTitleMatchMode", 4) $Dimension = WinGetPos("classname=rek20006c0000002") msgbox(0,"Dimensions", $Dimension[0] & ", " & $Dimension[1] & ", " & $Dimension[2] & ", " & $Dimension[3]) endif Any ideas? Thanks! Edited July 27, 2005 by v1rtu0s1ty
seandisanti Posted July 27, 2005 Posted July 27, 2005 I've been having a hard time figuring out why I'm getting different coordinate values of an active window. AutoIT Window Info tells me the correct values however, wingetpos doesn't.Here is the scenario. WinGetPos returns me 300,200 for the X & Y coordinates while AutoIT Window Info gives me 199, 123. WinGetPos gives me 66,22 for the height and width which is weird but AutoIT Window Info gives 626,456.Here is the code:AutoItSetOption("WinTitleMatchMode", 4) if WinExists("classname=rek20006c0000002","") Then WinActivate("Rekon 2000"); this activates the parent along with the child sitting on it AutoItSetOption("WinTitleMatchMode", 4) $Dimension = WinGetPos("classname=rek20006c0000002") msgbox(0,"Dimensions", $Dimension[0] & ", " & $Dimension[1] & ", " & $Dimension[2] & ", " & $Dimension[3]) endifAny ideas?Thanks!<{POST_SNAPBACK}>not sure what causes this, but FYI, your image isn't legible...
v1rtu0s1ty Posted July 27, 2005 Author Posted July 27, 2005 (edited) not sure what causes this, but FYI, your image isn't legible...<{POST_SNAPBACK}>It is legible. If you are using IE, then you have to hover the mouse on top of the image and wait for the icon at the bottom right. Once it appears, click it, it will enlarge or view the actual image size. You have to do this after you have clicked the link in autoit.This is one thing I hate in IE most especially when a new browser is loaded and not maximized. Edited July 27, 2005 by v1rtu0s1ty
seandisanti Posted July 27, 2005 Posted July 27, 2005 It is legible. If you are using IE, then you have to hover the mouse on top of the image and wait for the icon at the bottom right. Once it appears, click it, it will enlarge or view the actual image size. You have to do this after you have clicked the link in autoit.This is one thing I hate in IE most especially when a new browser is loaded and not maximized.<{POST_SNAPBACK}>oops, sorry, normally when i click a thumbnail it comes up actual size(i think).
seandisanti Posted July 27, 2005 Posted July 27, 2005 I've been having a hard time figuring out why I'm getting different coordinate values of an active window. AutoIT Window Info tells me the correct values however, wingetpos doesn't.Here is the scenario. WinGetPos returns me 300,200 for the X & Y coordinates while AutoIT Window Info gives me 199, 123. WinGetPos gives me 66,22 for the height and width which is weird but AutoIT Window Info gives 626,456.Here is the code:AutoItSetOption("WinTitleMatchMode", 4) if WinExists("classname=rek20006c0000002","") Then WinActivate("Rekon 2000"); this activates the parent along with the child sitting on it AutoItSetOption("WinTitleMatchMode", 4) $Dimension = WinGetPos("classname=rek20006c0000002") msgbox(0,"Dimensions", $Dimension[0] & ", " & $Dimension[1] & ", " & $Dimension[2] & ", " & $Dimension[3]) endifAny ideas?Thanks!<{POST_SNAPBACK}>the specs you're listing from the autoit info are coming from the 'control under mouse' listing... try using ControlGetPos instead of WindowGetPos
v1rtu0s1ty Posted July 27, 2005 Author Posted July 27, 2005 the specs you're listing from the autoit info are coming from the 'control under mouse' listing... try using ControlGetPos instead of WindowGetPos<{POST_SNAPBACK}>It doesn't work. Reading the manual, ControlGetPos will only be applicable to a control inside the window.I tried this and it gave me different numbers.$Dimension = ControlGetPos("classname=rek20006c0000002","","")
seandisanti Posted July 27, 2005 Posted July 27, 2005 It doesn't work. Reading the manual, ControlGetPos will only be applicable to a control inside the window.I tried this and it gave me different numbers.$Dimension = ControlGetPos("classname=rek20006c0000002","","")<{POST_SNAPBACK}>try this... i'm not sure why there is no control id given, but i put in a 0 to make sure right number of arguments... if this doesn't work , try with "" instead of 0ControlGetPos("Rekon 2000","Rekon2000",0)
v1rtu0s1ty Posted July 27, 2005 Author Posted July 27, 2005 try this... i'm not sure why there is no control id given, but i put in a 0 to make sure right number of arguments... if this doesn't work , try with "" instead of 0ControlGetPos("Rekon 2000","Rekon2000",0)<{POST_SNAPBACK}>Both didn't help. I'm stucked! Could it be an autoIt bug though?Thanks for the help though.
seandisanti Posted July 27, 2005 Posted July 27, 2005 Both didn't help. I'm stucked! Could it be an autoIt bug though?Thanks for the help though. <{POST_SNAPBACK}>i'd be hesitant to call it a bug, more likely the program just has a style that doesn't expose control id's... could be wrong, it wouldn't be the first time (today)...
buzz44 Posted July 28, 2005 Posted July 28, 2005 I confirm this behaviour. When running D2 in a window with the co-ordinates and w/h I get... X: 2 Y: -18 W: 806 H: 618 from AutoIt Window Tool which is correctand I get this from WinGetPos()...X: -32000 Y: -32000 W: 160 H: 24 It is quite obvious that the X and Y positions of my window arn't -32000. I would report this as a bug if you haven't already done so. qq
v1rtu0s1ty Posted July 28, 2005 Author Posted July 28, 2005 (edited) I confirm this behaviour. When running D2 in a window with the co-ordinates and w/h I get...X: 2 Y: -18 W: 806 H: 618 from AutoIt Window Tool which is correctand I get this from WinGetPos()...X: -32000 Y: -32000 W: 160 H: 24It is quite obvious that the X and Y positions of my window arn't -32000. I would report this as a bug if you haven't already done so.<{POST_SNAPBACK}>Cool! I hope this can be fixed soon. I used Spy++ and it's able to get the x, y and size properly.Btw, I don't know how to report it. Can you report it please?Thanks for doing some test too! Edited July 28, 2005 by v1rtu0s1ty
Valik Posted July 28, 2005 Posted July 28, 2005 X: -32000 Y: -32000 W: 160 H: 24Those are coordinates for a minimized window. How positive are you guys that you don't have the window minimized when calling WinGetPos() or that its not finding another window? By the way, I know from experience that Diablo II in windowed mode will automatically minimize whenever it loses focus and obviously to run a script in full-screen mode, you have to alt+tab out which also minimizes it. Unless you are inserting a sleep delay before the call to WinGetPos() or invoking it via a hotkey, you will not get the coordinates of the Diablo II window because it will be minimized. That is not a bug.v1rtu0s1ty, I suspect in your case that there are more than one window in the system with that classname and its finding a different one than you think it is.I highly doubt there is a bug in AutoIt.
v1rtu0s1ty Posted July 28, 2005 Author Posted July 28, 2005 (edited) Those are coordinates for a minimized window. How positive are you guys that you don't have the window minimized when calling WinGetPos() or that its not finding another window? By the way, I know from experience that Diablo II in windowed mode will automatically minimize whenever it loses focus and obviously to run a script in full-screen mode, you have to alt+tab out which also minimizes it. Unless you are inserting a sleep delay before the call to WinGetPos() or invoking it via a hotkey, you will not get the coordinates of the Diablo II window because it will be minimized. That is not a bug.v1rtu0s1ty, I suspect in your case that there are more than one window in the system with that classname and its finding a different one than you think it is.I highly doubt there is a bug in AutoIt.<{POST_SNAPBACK}>I downloaded a vb api that enumerates all windows including handles, caption and classnames. I looked for the classname rek20006c0000002 and saw one, however, I saw 3 other classes in classname=rek20006c000000. And I'm very sure that the classname is rek20006c0000002 by hovering the mouse on that window. I have actually attached a screenshot at the beginning of this thread and you will see it there. The class rek20006c000000 is the parent window. And the classname for the workspace underneath rek20006c0000002 window is rek20006c0000001.To really verify this, I had to manually run the application and execute this code:It gave me a result of (300,200) coordinates and (66,22) for the height and width.WinActivate("Rekon 2000") AutoItSetOption("WinTitleMatchMode", 4) $Dimension = WinGetPos("classname=rek20006c0000002","") msgbox(0,"Dimensions", $Dimension[0] & ", " & $Dimension[1] & ", " & $Dimension[2] & ", " & $Dimension[3])However, if I do the code below, it gets the dimension and coordinates of the parent windowWinActivate("Rekon 2000") AutoItSetOption("WinTitleMatchMode", 4) $Dimension = WinGetPos("","") msgbox(0,"Dimensions", $Dimension[0] & ", " & $Dimension[1] & ", " & $Dimension[2] & ", " & $Dimension[3])Please look at the new attachments.The left attached is the parent window. The right pic attached is the child window that I really want to get working. New addtion:I added this and it showed a SIZE of 1 but the Title was blank. I did this to make sure there is no other classname=rek20006c0000002 which proved it.$winvar = WinList("classname=rek20006c0000002") Msgbox(0,"","SIZE:" & $winvar[0][0]) For $i = 1 to $winvar[0][0] MsgBox(0, "Details", "Title=" & $winvar[$i][0] & @LF & "Handle=" & $winvar[$i][1]) NextThanks for looking into this.N Edited July 28, 2005 by v1rtu0s1ty
Moderators SmOke_N Posted July 28, 2005 Moderators Posted July 28, 2005 (edited) You must be really fast with your screen shots, even the seconds are the same between the Parent and the Child. BTW, couldn't be as easy as cheking AutoInfo in the Options / Coord Mode and making sure that your getting Windows Coords since your using WinGetPos() could it? Just a thought. Edit: Maybe try adding the text to it? $Dimension = WinGetPos("classname=rek20006c0000002","Rekon2000") Hope you get it working, gary had to help me w/ WinGetPos() a couple of days ago. Edited July 28, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Valik Posted July 28, 2005 Posted July 28, 2005 The class name is "classname=rek20006c000000", no trailing 2. The 2 is the instance number for a control. The instance number is something invented by AutoIt that allows it to identify which control the mouse is over, it is not part of the real class name. If you are trying to get the coordinates for the main parent window itself, then you need to use the class name as posted above, without any trailing instance number.
v1rtu0s1ty Posted July 28, 2005 Author Posted July 28, 2005 You must be really fast with your screen shots, even the seconds are the same between the Parent and the Child.BTW, couldn't be as easy as cheking AutoInfo in the Options / Coord Mode and making sure that your getting Windows Coords since your using WinGetPos() could it?Just a thought.Edit:Â Maybe try adding the text to it?$Dimension = WinGetPos("classname=rek20006c0000002","Rekon2000")Hope you get it working, gary had to help me w/ WinGetPos() a couple of days ago.<{POST_SNAPBACK}>I've done that. Didn't help. WinGetTitle("classname=rek20006c0000002") and WinGetText("classname=rek20006c0000002") returns 1WinList("classname=rek20006c0000002") gives out a size of 1I know, there is a possibility that is is a bug! How else can I test? However, WinClose or WinKill, WinSetState doesn't do anything to the window.I've wasted many days just for this coordinate and size.Lastly, VB handle enumerator shows only 1 instance of rek20006c0000002.
v1rtu0s1ty Posted July 28, 2005 Author Posted July 28, 2005 The class name is "classname=rek20006c000000", no trailing 2. The 2 is the instance number for a control. The instance number is something invented by AutoIt that allows it to identify which control the mouse is over, it is not part of the real class name. If you are trying to get the coordinates for the main parent window itself, then you need to use the class name as posted above, without any trailing instance number.<{POST_SNAPBACK}>I want to get the coordinates of the child window. It's the window that contains the error.
Valik Posted July 28, 2005 Posted July 28, 2005 ControlGetPos("classname=rek20006c000000", "", "rek20006c0000002")
v1rtu0s1ty Posted July 28, 2005 Author Posted July 28, 2005 ControlGetPos("classname=rek20006c000000", "", "rek20006c0000002")<{POST_SNAPBACK}>Here is my latest code and it fails:AutoItSetOption("WinTitleMatchMode", 4) if WinExists("classname=rek20006c0000002","") Then WinActivate("Rekon 2000") WinActivate("classname=rek20006c0000002") $Dimension = ControlGetPos("classname=rek20006c000000", "", "rek20006c0000002") msgbox(0,"Dimensions", $Dimension[0] & ", " & $Dimension[1] & ", " & $Dimension[2] & ", " & $Dimension[3]) endifPlease see attachment.Thanks for helping out!
Moderators SmOke_N Posted July 28, 2005 Moderators Posted July 28, 2005 (edited) AutoItSetOption("WinTitleMatchMode", 4) If WinExists("classname=rek20006c0000002","") Then WinActivate("Rekon 2000") WinActivate("classname=rek20006c0000002") $Dimension = ControlGetPos("classname=rek20006c000000", "", "rek20006c0000002") If IsArray($Dimension) Then msgbox(0,"Dimensions", $Dimension[0] & ", " & $Dimension[1] & ", " & $Dimension[2] & ", " & $Dimension[3]) Else MsgBox(0, "Error", "") EndIf Endif Edit: Forgot Code Tags Edited July 28, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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