View Single Post
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: 1,099
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:

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

strAllAlarmsDetected = ""
    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
    ' 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

If strAllAlarmsDetected <> "" Then
    crt.Dialog.MessageBox("The following alarms were detected: " & strAlarmText)
    crt.Dialog.MessageBox("No alarms detected.")
End If
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel:
Reply With Quote