4 posts in this topic
Hello all! I have had some issues reading text from different types of windows, occasionally, specifically with controlgettext.
**Before I begin, I know there are better ways to do what I attempt in the example below. That's not the point of this post. The point is my issues with controlgettext.
I am about to cite an example with an application you may be familiar with called SpeedFan (v4.52). My problem is not specific to speedfan, it is simply the most recent and easily reproducible example I can think of.
So, the goal of the script below is to get a string of text containing the current fan RPMs from the highlighted control in the screenshot below (see "speedfan_control_details.png").
Now, here's a simple script for grabbing the window handle and reading the text from that control:
$wintitle = "SpeedFan 4.52" $controlID = "197934" ;will be reformatted as "[ID:######]" $hwnd = wingethandle($wintitle) if @error<>0 then msgbox(0, "WinGetHandle", "FAILURE. @error="&@error) Exit EndIf $text = ControlGetText($hwnd, "", "[ID:"&$controlID&"]") if @error=1 then msgbox(0, "ControlGetText", "FAILURE. @error="&@error) ;failure returns "" and @error=1 Exit EndIf msgbox (0, "ControlGetText", "SUCCESS. @error="&@error &@CRLF& "$text="&$text) ;success returns string and @error=0 You'll see that the ControlGetText operation runs without error, however it does not capture any text from the control. If you explore the other controls in this one window, you'll find mixed results across the board. Neither the temps nor voltages can be read, while the log field and some other elements can be read. Even when you read the text from the whole window, those elements are not included in the visible nor hidden texts.
I have run into this issue many times in the past- inconsistencies in the ability of autoit to interact with certain controls. What is it which makes this text different than any other readable texts? Is there an alternate method of reading the text in the window/control which could work? Any and all info to help me solve this mystery and satisfy my curiosity would be greatly appreciated.
Thanks -Rob C
PS: Running Autoit v126.96.36.199 on Win7 Ultimate x64
I am working on windows based application in which i have to read the error msg which is coming on the bottom of the the windows application screen.its a kind of status bar msg but not status bar because when i find it using AutoIT finder the complete panel of the screen is getting selected. PFA and request you to give your inputs on it. OS: Windows XP Java: 1.7 AutoIT: 3.1.3 I tried jubula and sikuli and java OCR also but unable to get text of that panel.
Hello again all!
Everyone has been a great help with my work so far, but I have come across something that hopefully has a simple solution.
I have a window that the Info tool can grab all control info from and easily identify the text of said controls. The window in question is below.
The text I am trying to grab are the acct, history and chart numbers. The output of the info tool is as follow:
>>>> Window <<<< Title: Admission/Registration Confirmation Screen Class: LSPANEL Position: 587, 307 Size: 764, 461 Style: 0x94C40000 ExStyle: 0x00000100 Handle: 0x00000000000E1134 >>>> Control <<<< Class: LSSTATIC Instance: 29 ClassnameNN: LSSTATIC29 Name: Advanced (Class): [CLASS:LSSTATIC; INSTANCE:29] ID: 5 Text: 2000684 Position: 224, 39 Size: 60, 14 ControlClick Coords: 30, 7 Style: 0x5400008C ExStyle: 0x00000004 Handle: 0x00000000000E1140 I have tried several variations of of things to get AutoIT to interact with the window. This was my latest
ControlFocus("Admission/Registration Confirmation Screen", "", "#327701") ;ControlClick("Admission/Registration Confirmation Screen", "", "LSBMPBUT4") ;Local $sText = ControlGetText("Admission/Registration Confirmation Screen","", "[CLASS:LSSTATIC; INSTANCE:29]") ;Local $sText1 = WinGetTitle("Admission/Registration Confirmation Screen", "") ;MsgBox($MB_SYSTEMMODAL, "", "The text in LSSTATIC29 is: " & $sText) ;MsgBox($MB_SYSTEMMODAL, "", "The text in LSSTATIC29 is: " & $sText1) I've also tried just having LSSTATIC29, etc.
After messing with everything for awhile, it seems AutoIt simply has issues working with this window at all as I can't get it to ControlClick the button either. All other windows of this nature have been completely usable. I noticed that with this particular window ,while I can identify the controls, when I click and hold - it allows me to drag a box across the window. Not sure if this matters or not, but thought it might be important for identifying the type of window.
I can't think of anything else I might be leaving out, but if there are any questions please let me know and I will get back to you as soon as I can. I will be working on the rest of this project on and off for the weekend. Thank you in advance for any help you might be able to give!