Jump to content

Recommended Posts

Posted

Hi again, 

I'm trying to read this control and check if this warning message exists

 

WinActivate("Post-it Screen -  MAIN")
$hWnd2 = WinWait("[CLASS:ProFrame]", "", 10)

Sleep(6000)
Local $WarningText = ControlGetText($hWnd2, "", "Edit1")
MsgBox($MB_SYSTEMMODAL, "", $WarningText)
FileWrite($hFilehandle, @CRLF & "Test" & $TestCount & " Create a new matter using " & $WarningText)

I've attached a few screenshots of the Auto IT window and the visible text window.

I essentially want to check in this control box if the phrase 

*** WARNING****
You do NOT have an up to date CRU certificate. 
 
exists. However using the above ControlGetText command it produces a blank msgbox. 
 
I also wrote it out to a notepad file and only "Create a new matter using " is in it. (ie. it's not writing out the $WarningText variable to either the msgbox or txt file) 
 
Any ideas? 

Control autoit window.PNG

msgbox.PNG

visible text box.PNG

Posted

0_o

Global $iWinClass = "[CLASS:ProFrame]"
Global $WarningText
Local $hWnd2 = WinExists($iWinClass, "")
If Not $hWnd2 Then
    ConsoleWrite("- Waiting Windows ")
    ToolTip("> Waiting Windows :" & $iWinClass)
    Local $Check = 10
    While $Check
        ToolTip($Check & "> Waiting Windows: " & $iWinClass)
        ConsoleWrite(".")
        Sleep(1000)
        $hWnd2 = WinExists($iWinClass, "")
        If $hWnd2 Then ExitLoop
        $Check -= 1
    WEnd
EndIf
If $hWnd2 Then
    ConsoleWrite(@CRLF & "+ Found Windows !" & @CRLF)
    WinActivate($hWnd2)
    WinActive($hWnd2)

    $WarningText = ControlGetText($hWnd2, "", "Edit1")
    If $WarningText <> "" Then
        MsgBox(64 + 262144, "", $WarningText)
    Else
        MsgBox(48 + 262144, "Error", "Not Found Text ON: " & $iWinClass)
    EndIf
Else
    MsgBox(16 + 262144, "Error", "Windows Not Found: " & $iWinClass)
EndIf

 

Regards,
 

Posted

Your first screenshot with the AutoIt spy Control tab doesn't show any value in the Text field.  For an Edit field, that should show the text that would be captured.

It's possible that the actual text value you want is in a different control, possibly behind or embedded within the Edit.

I have had to use a script to hide a top level control, then use the AutoIt spy again to get the actual control behind that contains the value.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...