Sign in to follow this  
Followers 0
rizal

capture text

2 posts in this topic

i need help. i'm running a software that will popup a message "Pass" for 10 seconds if the test case success. can u guys help me on how i can capture the message? the problem with my script is my test case completion time is different each time i run it. if the command start capture after the popup gone, my test case failed. can u guys suggest solutions?

sleep(120000)
$text = WinGetText("CCP Tester Prompt")

If StringInStr($text, "Pass") > 0 Then
    ;MsgBox(0, "CCP Tester Prompt", $text)

 ;Local $resultFile = FileOpen(@ScriptDir & "\result.txt", 1);1 = Write mode (append to end of file)    
 $resultFile = FileOpen(@ScriptDir & "\result.txt", 1);1 = Write mode (append to end of file)

If $resultFile = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWriteLine($resultFile, "")
FileWriteLine($resultFile, "SW-TestCase-1 : Pass")
FileClose($resultFile)

Else
    ;Local $resultFile = FileOpen(@ScriptDir & "\result.txt", 1);1 = Write mode (append to end of file) 
 $resultFile = FileOpen(@ScriptDir & "\result.txt", 1);1 = Write mode (append to end of file)

If $resultFile = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWriteLine($resultFile, "")
FileWriteLine($resultFile, "SW-TestCase-1 : Failed")

FileClose($resultFile)

EndIf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

you can enumerate all windows of this process ( _WinAPI_EnumProcessWindows ) and filter by text or class.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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
Sign in to follow this  
Followers 0