Jump to content
automaterk

Window with Visible Controls - ControlGetText returns null

Recommended Posts

automaterk

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.

appscreen.thumb.PNG.291382f7642b4e572046

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!

Share this post


Link to post
Share on other sites
jvds

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
automaterk

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
LarsJ

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
jvds

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
junkew

https://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm

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.
    WinActivate($hWnd)
    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
automaterk

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
automaterk

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

    • gahhon
      By gahhon
      Hi,
      I have a program that is read data from the .txt file, since the .txt file is only readable, viewable and editable for the admin user.
      But how could I lock it with password, or some other technique that can helps to achieve this?
      Thanks for the advanced information.
    • gahhon
      By gahhon
      Hi,
      How can I the trigger the another button functions without waiting the previous function to finish execute?
      Any advise?
      I couldn't find any relevant topics via google.
      Thanks a lot.
    • SharpDressedMan
      By SharpDressedMan
      Hi all,
      I need to use ControlMove() on some controls of a hidden GUI window.
      This works properly on a GUI window created with default style, but does not work on a GUI window created with style $WS_OVERLAPPEDWINDOW
      func GUItest($bOverlapped) $m = GUICreate("test", 200, 100, -1, -1, $bOverlapped ? $WS_OVERLAPPEDWINDOW : -1) $g = GUICtrlCreateButton("test", 0, 0) ControlMove($m, "", $g, 30, 30) GUISetState() endfunc GuiTest(false) ; button 'test' properly moved to (30,30) GuiTest(true) ; button 'test' not moved and still sitting at (0,0) Any reason for this unexpected behavior ?
      Any workaround to fix this ?
      Thanks for any help
    • 2Toes
      By 2Toes
      Hi all..
      I'm having slight issue that has be a bit puzzled.
      I have an Input control.. After a certain function runs, it Disables that Input control, and sets it to ReadOnly.
      When running another certain function, it re-Enables that Input control, and sets the style back to Default.
      Which does work, however, when typing into the Input control after re-Enabling it, the text appears as a light gray color, rather than its original black color.
      I'm sure there's a simple solution here.. But what that is, appears to be beyond me.
      Here is a simplified example code:
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 245, 215, 192, 124) Global $disableBTN = GUICtrlCreateButton("Disable", 32, 64, 75, 25) Global $enableBTN = GUICtrlCreateButton("Enable", 128, 64, 75, 25) Global $Input1 = GUICtrlCreateInput("", 32, 120, 169, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $disableBTN disable() Case $enableBTN enable() EndSwitch WEnd Func disable() GUICtrlSetState($Input1, $GUI_DISABLE) GUICtrlSetStyle($Input1, $ES_READONLY) EndFunc Func enable() GUICtrlSetState($Input1, $GUI_ENABLE) GUICtrlSetStyle($Input1, $GUI_SS_DEFAULT_INPUT) EndFunc  
      Any help would be greatly appreciated
      Thank you in advance!
    • jantograaf
      By jantograaf
      Hi all,
      I'm trying to create a script that runs a JSON-query and then can retrieve some variables out of the returned, decoded object using JSON.au3. I have tried some other examples on this forum, but I'm stuck at one point. My query works perfectly and gets loaded into the variable $data. Then, decoding $data to $object seems to work as well. But then I can't get the date-field out of this JSON-structure with my script.
      The JSON-structure returned looks like this:
      { "content": [ { "id": "451ec583-8f27-4926-82a3-a2d85e57a110", "createdDate": "2018-08-08T08:40:57.449004Z", "updatedDate": "2018-08-08T08:40:57.449004Z", "lastOpenedDate": "2018-08-08T08:40:57.449004Z", "date": "2018-04-26T00:00:00", "description": "X-Ray Exam", "patient": { "id": "f857238a-c75d-4760-b8d1-8f50f8f9bbfa", "createdDate": "2018-08-08T08:40:37.623976Z", "updatedDate": "2018-08-08T08:40:37.623976Z", "lastOpenedDate": "2018-08-08T08:40:37.623976Z", "name": "Fuerstonia", "birthDate": "2014-06-08", "breed": "", "chip": "", "color": "", "damsire": "", "sire": "", "neutered": false, "orthancUuid": "", "sex": "U", "species": "Paard", "ueln": "De 431310762114", "pmsReference": "", "origin": "" }, "type": "study", "accessionNumber": "KME201806960467", "instanceUid": null, "orthancUuid": "", "sent": false, "seriesCount": 0, "modalityType": "RX", "typeAndModality": "study RX", "client": { "id": "be627195-8458-4927-8446-f1ef37b917a4", "createdDate": "2018-08-08T08:40:31.433968Z", "updatedDate": "2018-08-08T08:40:31.433968Z", "lastOpenedDate": "2018-08-08T09:26:49.512298Z", "via": "", "extraInfo": "", "pmsReference": "", "contact": { "id": "406cc555-c491-4c29-b6bb-8d903f0e35a9", "createdDate": "2018-08-08T08:40:31.428968Z", "updatedDate": "2018-08-08T08:40:31.428968Z", "lastName": "Client 1", "firstName": "", "company": "", "email": "", "language": "nl", "phone": "", "address": { "id": "6fc7703c-137a-4e0a-ba96-8c7f38f2044b", "city": "", "country": "", "line": "", "postalCode": "" } } } }, My script looks like this:
      #RequireAdmin #include <json.au3> #include <inet.au3> #include <File.au3> ;Create a handle to a logfile (will be created if it doesnt exist) Global $logfile = FileOpen("C:\VSOL\VSTK\Logs\MigrationFix\MigrationFix.log",9) FileWriteLine($logfile,"Start script") ;Create the URL with the JSON-query $URL = "http://localhost:8080/v0/studies/?seriesCount=1" ;Catch the query output into a variable $data = _INetGetSource($URL) ;Check if there is any data at all in this variable, if not, exit If Not $data Then MsgBox(1,"Error","No answer. Server is probably not running.") Exit EndIf ;For debugging purposes FileWriteLine($logfile,$data) ;Decode the JSON_string into a useable object $object = Json_Decode($data,1000) If @error Then FileWriteLine($logfile,"Error decoding JSON") Exit EndIf Local $i = 0 ;Start a loop to retrieve the study date of each study... While 1 $study_date = json_get($object,'[' & $i & '].date') If @error Then FileWriteLine($logfile,"Study-Date retrieval error") ExitLoop EndIf $i = $i + 1 WEnd ;Close the logfile FileWriteLine($logfile,"Stop script") FileClose($logfile) ;Open the logfile for quick reference ShellExecute("C:\VSOL\VSTK\Logs\MigrationFix\MigrationFix.log") If believe it has something to do with my json_get($object...)-command. Anyone who can point me in the right direction?
      Thanks in advance!
      Kind regards
×