Scanning program log file for errors

Dim buffer, string
Dim position, number
Dim err_found, boolean

// Load the log file into memory
FileReadAll ("program.log", buffer)
// Convert to lower case to find all sorts of errors
Lower (buffer, buffer)
// Search for word "error"
Pos (buffer, "error", 1, position)
// If error found, notify system administrator
IsGreater (position, 0, err_found)
If (err_found, NOTIFY, END)

// Send email message
MailSend( "Exchange Settings", "syspassword", "", "Error occurred while running PROGRAM.EXE. See program log file for details." )

// Done