CaptainBeardsEyesBeard Posted February 6, 2019 Posted February 6, 2019 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?
FrancescoDiMuro Posted February 6, 2019 Posted February 6, 2019 @CaptainBeardsEyesBeard Do some error checking... Check if the handle of window you are looking for is returned, and the same for the control... Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
CaptainBeardsEyesBeard Posted February 6, 2019 Author Posted February 6, 2019 Hmm just tried this and didn't get a msgbox come up Local $WarningText = ControlGetText($hWnd2, "", "Edit1") if @error then MsgBox($MB_SYSTEMMODAL, "Couldnt get text", 4) EndIf
Trong Posted February 6, 2019 Posted February 6, 2019 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,
BigDaddyO Posted February 6, 2019 Posted February 6, 2019 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.
Nine Posted February 6, 2019 Posted February 6, 2019 Or try with WinGetText ("[CLASS:ProFrame]") “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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