birbird Posted June 29, 2015 Author Share Posted June 29, 2015 Can you please tell us which application you try to automate?I could provide all the infomation of the application to you.But now I just need make a progress. And I have already found some hope from the document, https://www.autoitscript.com/autoit3/docs/intro/controls.htmIt says we can identify a control by position and size. But this piece of code just not work$hWnd = WinWait("[W:423; H:323]") ConsoleWrite($hWnd & @CRLF) Local $sText = ControlGetText($hWnd, "", "[ID:323]") ConsoleWrite($sText & @CRLF) Local $sText2 = ControlGetText($hWnd, "", "[X:150; Y:70; W:50; H:16]") ConsoleWrite($sText2 & @CRLF)Could you please tell me what is the right way to do this. Thanks a lot. Link to comment Share on other sites More sharing options...
water Posted June 29, 2015 Share Posted June 29, 2015 You do not try to access the same controls as you have posted in the screenshots?What is the value of @error after calling ControlgetText. 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...
JohnOne Posted June 29, 2015 Share Posted June 29, 2015 I cannot get it to work either, just returns empty string and sets @error to 1 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...
water Posted June 29, 2015 Share Posted June 29, 2015 This works for me:#include <Array.au3> $aPos = WinGetPos("Unbenannt - Editor") ; Get the position of the Window _ArrayDisplay($aPos) $hWnd = WinGetHandle("[X:139; Y:341; W:638; H:438]") ; Values taken from the _ArrayDisplay $aPos = ControlGetPos($hWnd, "", 15) ; Get the position of the Control. The same values as taken from AutoIt Window Info Tool _ArrayDisplay($aPos) $sText = ControlGetText($hWnd, "", "[X:0; Y: 0; W:622; H:380]") ConsoleWrite($sText & @CRLF) 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...
JohnOne Posted June 29, 2015 Share Posted June 29, 2015 Appears it works on some controls, not others.Here is how I tested on only open explorer window...$hwnd = WinActivate("[Class:CabinetWClass]", "") $val = ControlGetText($hwnd, "", "[X:72; Y:5; W:914; H:22]") ; does not work ;$val = ControlGetText($hwnd, "", "[CLASS:ToolbarWindow32; INSTANCE:2]") ; works ConsoleWrite($val & @LF & @error & @LF) 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...
water Posted June 29, 2015 Share Posted June 29, 2015 (edited) Did you check that $hWnd is a handle by using IsHWnd? Edited June 29, 2015 by water 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...
JohnOne Posted June 29, 2015 Share Posted June 29, 2015 Yes, it works if I use class and instance, but not coords. 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...
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