Jump to content

Window with Visible Controls - ControlGetText returns null

Recommended Posts


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
Position:   587, 307
Size:   764, 461
Style:  0x94C40000
ExStyle:    0x00000100
Handle: 0x00000000000E1134

>>>> Control <<<<
Instance:   29
ClassnameNN:    LSSTATIC29
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!

Share this post

Link to post
Share on other sites

did you try $sText = WinGetText("Admission/Registration Confirmation Screen") ?

Edited by jvds
$sText =
  • Like 1

Share this post

Link to post
Share on other sites

I have. I will try it again to be sure, but it still returned null. It just seems to have a problem with this window in particular. Is there any other way to get AutoIt to recognize it. It is driving me crazy since every other window has worked just fine. I don't know what could be different from the others.

Share this post

Link to post
Share on other sites

What is the title of your window? There seems to be some characters before the "/"-character. Have you tried to identify the window with the last part of the title ("Registration Confirmation Screen")? Or directly with the window handle?

  • Like 1

Share this post

Link to post
Share on other sites

does the class and instance change if you hold it over different texts?
it could also be HTML inside a window, i have seen some software with that in the past, so what out for that too

  • Like 1

Share this post

Link to post
Share on other sites


build it in steps

First make sure you have the window itself

; Wait 10 seconds for the window to appear.
    Local $hWnd = WinWait("[REGEXPTITLE:.*Registration Confirmation Screen.*]", "", 10)

    ; Activate the window using the handle returned by WinWait.
    WinMove($hWnd, "", 10, 10)

and then just iterate over all children

As AU3Inf is seeing them properly it should be possible with the standard functions.

If not you could give a try to IUIAutomation in Examples section

  • Like 1

Share this post

Link to post
Share on other sites

Thank you all for the responses. I have been out and unable to continue work the last few days, but will give all of this a try and let you know what seems to be working.

@jvds Each label has its own instance and class name, but they are static in the sense that they are the same every time if that's what you are asking.

Share this post

Link to post
Share on other sites

To sum up -

1) This particular window's issue was solved by identifying it as "[REGEXPTITLE:.*Registration Confirmation Screen."

This allowed me to easily identify any of the buttons/labels I was having trouble with.

2) Additionally - I was having some other issues with identifying buttons in another window(I think it may have been hidden by a label in the application), but the child list/iteration helped me figure that out.

Thanks to everyone again, I'm super grateful for all the help you all have already provided!

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

  • Similar Content

    • Rammanan
      By Rammanan
      Hi all, Below is my script,
      Pls advise me if any wrong on that....File exit in location but the return -1.
      FileOpen($file, 0)
         $line = FileReadLine($file)
      Local $aArray = _FileListToArrayRec($serverpath, "*|*.txt", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_NOPATH)
      If @error Then
              MsgBox($MB_SYSTEMMODAL, "Ooops!", "No files found")
          ;_ArrayDisplay($aArray, "Sorted tree")
                 Local $hSearch = FileFindFirstFile($line)
    • Theodoor
      By Theodoor
      I am trying to use the ControlClick in a "save as"-window to select the path of where to save the document.
      I found out that when in press the icon in front of the path, i select the path. So I am trying to press that button (i have attached a print screen of this window).
      While trying to figure out how i had to use the ControlClick, it said somewhere that i could us Au3Info to find out what title,... i should use with the ControlClick.
      The result of the Au3Info I have attached aswel.
      The ControlClick that i tried are these: (and none of these even move the mouse)
      ControlClick("[CLASS:ToolbarWindow32; INSTANCE:4]", "", "", "Left" ,1 ,10,10)
      ControlClick("[CLASS:ToolbarWindow32; INSTANCE:4]", "", "1001", "Left" ,1 ,10,10)
      ControlClick("[CLASS:ToolbarWindow32]", "", "", "Left" ,1 ,10,10)
      ControlClick("Save project as", "", "", "Left" ,1 ,10,10)
      I don't know what I am doing wrong.
      Should I use a controlID? is my windowtitle wrong?
      Can anyone help me?
      Thanks in advance,

    • Mercy
      By Mercy
      I need to add a column with data daily at the end of the column and calculate the difference between last two columns in put it in a seperate column. So i need to get the  position of the last column.
      Local $count = $oWorkbook2.Worksheets(1).UsedRange.Columns.Count MsgBox(0,"",$count) ; ***************************************************************************** ; Copy a single cell from another workbook. Pass the source range as object. ; ***************************************************************************** Local $oRange = $oWorkbook2.Worksheets(1).Range("A1:A15") _Excel_RangeCopyPaste($oWorkbook1.Worksheets(1), $oRange,"H1:H15") _Excel_RangeWrite($oWorkbook1, $oWorkbook1.Worksheets(1), "=C2-H2", "I2:I15", False) this code copies to a specific column H with a range 15. But i need to keep that column range to update automatically when columns are added.
    • Mercy
      By Mercy
      I inspect that Security tab in the webpage .I get the html element below:
      <td tabindex="-1" align="center" class="infaTabsetSimpleTabSetTop" nowrap="true" valign="middle" onfocus="app_details_browse.$47()">Security</td>
      If iam using the class name and trying to click the element. Iam getting "found" but cannot click as all the tab contains same class.
      If iam using the onfocus attribute which is different for every tab and trying to click the element, the element cannot be found.
      Local $oFound = "" Local $oBtns = _IETagNameGetCollection($oIE, "td") For $oBtn In $oBtns ;If String($oBtn.onfocus) ="app_details_browse.$47()" Then If String($oBtn.classname) = "infaTabsetSimpleTabSetTop" Then $oFound = $oBtn EndIf Next If IsObj($oFound) Then _IEAction ($oFound, "focus") _IEAction ($oFound, "click") MsgBox(16, "Success", "found") Else MsgBox(16, "Failed", "Not found.") EndIf

    • nacerbaaziz
      By nacerbaaziz
      I designed this code To help the blind
      Where screen readers users can  Identify the sefocus  item with audio files
      In this code i define some elements
      Unfortunately, I did not know how to define the other elements
      I am waiting for your initiative to  define the other elements
      Thank you in advance
      Global $CFocus = "" Func focus($window) Local $focusing = ControlGetFocus($window) Local $handle = ControlGetHandle($window, "", $focusing) If Not ($focusing = $CFocus) Then Switch StringTrimRight($focusing, 1) Case "button" If IsCheckBox($handle) Then play("checkBox") ElseIf IsRadio($handle) Then play("RadioButton") Else play("focus") EndIf $CFocus = $focusing Case "comboBox", "ListBox" play("list") $CFocus = $focusing Case "edit", "input" play("edit") $CFocus = $focusing Case Else play("focus") $CFocus = $focusing EndSwitch EndIf EndFunc ;==>focus Func IsCheckBox($ctrl_hwnd) $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE) Return BitAND($Style, $BS_CHECKBOX) = $BS_CHECKBOX EndFunc ;==>IsCheckBox Func IsRadio($ctrl_hwnd) $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE) Return BitAND($Style, $BS_AUTORADIOBUTTON) = $BS_AUTORADIOBUTTON EndFunc ;==>IsRadio Func play($name, $wait = 0) Local Const $SND_RESOURCE = 0x00040004 Local Const $SND_ASYNC = 1 ; Play the file - the script will pause as it sounds If $wait = 0 Then DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", BitOR($SND_RESOURCE, $SND_ASYNC)) Else DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", $SND_RESOURCE) EndIf Return 1 EndFunc ;==>play  

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.