Witmarquzot Posted April 30, 2013 Share Posted April 30, 2013 Is there a way to get window position using the window ID, such as WinGetPos([iD:1383830]) Link to comment Share on other sites More sharing options...
water Posted April 30, 2013 Share Posted April 30, 2013 AutoIt is designed to work perfectly with windows and controls. So no need to get the window position if you want to automate an application. Can you please describe what you want to do? Maybe there is a better way to do what you want. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
jdelaney Posted April 30, 2013 Share Posted April 30, 2013 (edited) Seems like the ID would be associated with a control...not a window. I suppose you can get all windows, and then loop through them to see which one has that control id (could be several, could be none), and then get the position of the window, conditionally Try this, else tell us what you need $iControl = 1383830 $aWin = WinList () For $i = 1 to UBound($aWin)-1 If StringLen($aWin[$i][0])>0 Then $hControl = ControlGetHandle($aWin[$i][1], "", $iControl) If IsHWnd($hControl) Then $array = WinGetPos($aWin[$i][1]) _ArrayDisplay($array) EndIf EndIf Next Edited April 30, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Witmarquzot Posted April 30, 2013 Author Share Posted April 30, 2013 Setting up a smoke test for an application written in .net As so the classes are as so [WindowsForms10.window.8.app.0.29e8405] and the children windows are not set up to be activated so I need to be able to move the mouse in position based on the window location on the screen. I can not get it to always grable the handle of the window I am interested in. There is a very good chance that I am at the end of my good thinking wits and way over thinking this and missing something simple. So right now it keeps grabbing the position/handle of the main window, but I need the postion of the control window. Instance changes and for some reason WinGetPos("[NAME:DataGridView1]") does not work. >>> Window <<<< Title: Route Manager - Stark Industries Class: WindowsForms10.window.8.app.0.29e8405 Position: -8, -8 Size: 1382, 754 Style: 0x17CF0000 ExStyle: 0x00050100 Handle: 0x00000000002307F8 >>>> Control <<<< Class: WindowsForms10.window.8.app.0.29e8405 Instance: 14 ClassnameNN: WindowsForms10.window.8.app.0.29e840514 Name: DataGridView1 Advanced (Class): [NAME:DataGridView1] ID: 4267914 Text: Position: 265, 96 Size: 1095, 579 ControlClick Coords: 435, 88 Style: 0x56010000 ExStyle: 0x00000000 Handle: 0x0000000000411F8A >>>> Mouse <<<< Position: 708, 215 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< ToolStrip1 ToolStrip1 BindingNavigator1 Active Only Inventory List MenuStrip1 Link to comment Share on other sites More sharing options...
abberration Posted April 30, 2013 Share Posted April 30, 2013 Maybe this? #include <array.au3> $i = WinGetPos("[CLASS:WindowsForms10.window.8.app.0.29e8405]", "") _ArrayDisplay($i) Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
water Posted April 30, 2013 Share Posted April 30, 2013 WindowsForms applications are hard to automate. Never done it myself but IIRC there are a lot of threads about this subject on the forum. Search for "windows forms" and you will get a lot of hits. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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