Sign in to follow this  
Followers 0
Docfxit

How to recognize text in a window

2 posts in this topic

I have a script that needs to send the <esc> key to close a program when the text comes up saying:

"Device timeout in module MAIN"

The script I have doesn't work.

This is what I have:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
;  This is for '98
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Run_Debug_Mode=Y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;;#AutoIt3Wrapper_UseAnsi=y
;Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 0)
AutoItSetOption("TrayIconDebug", 1) ;0-off
; Set so that tray displays current line number
Dim $t
Dim $Crashed = -1
Dim $Show_Log
HotKeySet("{F8}", "Terminate")
HotKeySet("{F10}", "Show_Log")
 
MsgBox(0, "Weather Starter", "Running Main and minimizing..." & @CRLF & "")
Call("Is_Weather_Running")
 
While 1
    $t = $t + 1
    If $t = 5 Then
        Call("Is_Weather_Running")
        $t = 0
    EndIf
  
    ;***************************************************************
    ; This is where I need to recognize the text on the screen
    ;***************************************************************
    If WinExists("CMD.exe", "Device timeout in module MAIN") Then
        WinActivate("CMD.exe", "Device timeout in module MAIN")
        WinWaitActive("CMD.exe", "Device timeout in module MAIN")
        Send("{esc}")
        Call("Is_Weather_Running")
    EndIf
    Sleep(8000)
WEnd
 
Func Is_Weather_Running()
    If Not ProcessExists("CMD.exe") Then
        Run(@Comspec & ' /c  "C:\qb71\RW\MAIN.EXE"', "")
        $Crashed = $Crashed + 1
    EndIf
    Sleep(1000)
EndFunc   ;==>Is_Weather_Running
 
Func Terminate()
    Exit 0
EndFunc   ;==>Terminate
 
Func Show_Log()
    $Show_Log = Not $Show_Log
    If ($Show_Log) Then
        If (ProcessExists("Main.exe")) Then
            SplashTextOn("Weather Starter", "Main is running." & @CRLF & "Main has crashed " & $Crashed & " times.", 300, 75, 0, 0)
        Else
            SplashTextOn("Weather Starter", "Main is NOT running." & @CRLF & "Main has crashed " & $Crashed & " times.", 300, 75, 0, 0)
        EndIf
    Else
        SplashOff()
    EndIf
EndFunc   ;==>Show_Log

This is the screen I am working with:

Posted Image

Thank you,

Docfxit

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