View Single Post
  #4  
Old 10-10-2016, 10:06 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 922
As a reminder, Screen.Get will not return anything but plain text -- no color information is available to the scripting API at this point, so let's abandon that approach.

Your raw log info shows that it's the *background*, not the text itself that is colored in red. In other words, the alarm condition is displaying red background over text in *reverse*. This means that the escape sequence you'd want to use involves 41m, not 31m. For example:

Code:
' Send the characters/keystrokes that cause the alarm screen
' to be displayed... You fill in the blanks here...
' ...
' ...
' 
' then...

strAllAlarmsDetected = ""
Do
    If Not crt.Screen.WaitForString(chr(27) & "[41m", 2) Then
        Exit Do
    End If

    ' If we get here, we know that we've seen an ESC [ 41 m
    ' ...so now, we ReadString() up to the ESC [ 40 m, where
    ' reverse is turned off.
    strAlarmText = crt.Screen.ReadString(chr(27) & "[40m")
    strAllAlarmsDetected = strAllAlarmsDetected & vbcrlf & strAlarmText
Loop

If strAllAlarmsDetected <> "" Then
    crt.Dialog.MessageBox("The following alarms were detected: " & strAlarmText)
Else
    crt.Dialog.MessageBox("No alarms detected.")
End If
--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote