Configuration file example
Here is an example, starting configuration file that combines the examples above together, and adds quite a few more:
A=12000 ; POP3 buffer (HEAP) memory allocation size
B=57600 ; Baud (bits per second) serial data communication rate
COM3 ; Serial port to use
; Text color keyword & value Background Foreground
ColorCommand = 0x47 ; Orange White
ColorIMAP = 0x9F ; Blue White
ColorPOP3 = 0x09 ; Black Bright Blue
ColorSMTP = 0x0B ; Black Bright Cyan
ColorScriptPrint = 0x71 ; White Blue
ColorScriptCmd = 0x7A ; White Bright Green
ColorDump = 0x1E ; Blue Yellow
ColorScriptDebug = 0x0C ; Black Bright Red
ColorIMAPCapa = 0x0A ; Black Bright Green
ColorIMAPTxRx = 0x27 ; Green White
ColorIMAPTxRxFail = 0x37 ; Teal White
ColorIMAPGRC = 0x57 ; Magenta White
ColorInfo = 0x8F ; Grey White
F1 =Emit "?",CR ; Causes MIRTOS' embedded help sequence to be output
AF1=Dump POP buffer
CF1=Type HelpFile.Txt
SF1=Dump LastLine buffer
F2 =Dump Heap ; Display the HEAP memory allocation data, but not HEAP contents
AF2=Dump key macros
CF2=Dump ERx strings
SF2=Dump SRx strings
F3 =PassThru ; or simply "Pass"
AF3=Dump Scripts
CF3=Dump COM status
SF3=Dump Commands
F4 =Pass
F5 =Dump Timed tasks
CF5=Dump WhiteList
SF5=Dump EMail structures
F6 =Emit "E 1 ^= 0x40",CR ; Toggles the MIRTOS device's sequencer logic
SF6=CALL IMAPLogon
F8 =Capture
F10 = ProgCmd
AF10 = Toggle Timed
CF10 = CALL SetFavoriteDebugMode
F11 = CALL SyncClock
SF12 = Call IMAPLogon
CF12 = Call IMAPLogoff
Off = Timed scripts
; These are commented out:
; Pass=0,71 ; Home in the numeric keypad
; Pass=224,71 ; Home in the cursor movement key block
; Pass=0,75 ; Left in the numeric keypad
; Pass=224,75 ; Left in the cursor movement key block
DebugIMAPFilter=B11110001-00010000-00000111
DebugPOP3Filter=0x1F300F ; Valid states: 0 through 20
DebugSMTPFilter=0x3F8F ; Valid states: 0 through 14
;---------- SCRIPTS ----------
Scripts Begin
Timed 3600 SyncClock ; Synchronize the MIRTOS device's clock once each hour
IF SerRx "DI3 On"
CALL SendDI3Command
ENDIF
If SRx "DI4 On"
Call SMTPSetup
ETx "Bedroom door opened at $T on $W., $D"
;Note: "$T on $W., $D" --> "12:26:25.0 on Fri., 4/26/2017"
;Note: "$T on $W, $D+" --> "12:26:25.2 on Friday, April 26, 2019"
;Note: "$T on $W. $D." --> "12:26:25.4 on Fri., Apr. 26, 2019"
LogOn SMTP ; Send the email
Call IMAPLogon ; Make sure that a response can be received
EndIf
IF ERx "ALARM+"
SerTx "O* = 63" ; Enable the alarm horn output
EndIf
IF ERx ALARM-
SerTx "O* = 0" ; Silence the alarm horn
EndIf
IMAPLogon:
HOST IMAP.YourEmailHost.Com
DelayTime 5 ; Seconds delay between requests for new mail
CALL UserAndPW ; Uses the same script defined above
LOGIN IMAP
RETURN
IMAPLogoff: ; Log out of all open IMAP servers
Print Executing IMAP logoff.
LOGOFF IMAP
Return
POP3Once:
CALL POP3Setup
; FLAGs |= 32 ; FLAG_SKIP_BODY
LOGON POP3
RETURN
POP3Poll30:
CALL POP3Setup
DelayTime 3 ; Seconds delay between requests for new mail
PollTime 30 ; Second to remain looping in the DelayTime interval
LOGON POP3
RETURN
POP3Setup:
Print Executing the POP3 setup script.
Label POP3Setup
HOST POP.YourEmailHost.Com
CALL UserAndPW
RETURN
SetFavoriteDebugMode:
ProgCmd "D=32"
ProgCmd "E=1"
ProgCmd "D?"
ProgCmd "E?"
Return
SyncClock: ; Script to synchronize a MIRTOS device's clock with the computer's clock
; SerTx $RTC1 ; Only send the seconds value
; SerTx $RTC2 ; Only send the second and minute values
; SerTx $RTC3 ; Send second, minute and hour values
; SerTx $RTC4 ; To the three (3) above, add the day of the week
; SerTx $RTC5 ; Send second, minute, hour, weekday and date
SerTx $RTC6 ; Send all five (5) above plus month; only omit the year
; SerTx $RTC7 ; Send all seven (7) values: seconds through year
Return ; Be sure to uncomment the one above to be used
SendDI3Command:
CALL SMTPSetup ; Prepare to send the string below
Subject "DI3 contact closed at $t on $d"
ETx "Motion sensed at $T on $W., $D"
Logon SMTP
CALL IMAPLogon ; Logon to listen for any reply
RETURN
SMTPSetup:
Print Starting the SMTPSetup script
Label SMTPSetup
HOST SMTP.YourEmailHost.Com
DOMAIN MyComputerName
CALL UserAndPW ; Uses the same script already defined
; SendTo VerizonCell@VText.Com
SendTo EmailAccount@SomeOtherEmailHost.Com
FromName HomeSCADA monitor
ToName My cell phone
RETURN
; Consider keeping the script which set the username and password as the final one.
UserAndPW:
; Print Executing the UserAndPW script ; (commented out)
User User@YourEmailHost.Com
Password SecretPassword!
Return
Scripts End
END When a line begins with "END" (but not "ENDIF"), the program stops reading the file there.
Program debug constants, changed using "D=0x184" (or "|=", "^=", etc.), for example:
0x0001 1 Displays COM port & structure information during startup
0x0002 2 Displays the memory address instead of buffer offset during dumps
0x0004 4 Removes blocks of repeating zeros from memory dump output
0x0008 8 Displays detailed status when sending a file out the serial port
0x0010 16 Outputs when serial last line check matches a saved string
0x0020 32 Shows details of information stored by the Key Macro save logic
0x0040 64 Dumps the Key Macro buffer in that same Key Macro save logic
(Suggest using with flag 0x0004 to reduce the output)
0x0080 128 Displays details during script execution
0x0100 256 Shows where (routine name) an ESC keypress was processed
0x0200 512 Shows the single or extended (i.e., "2-BYTE") keycode for each key pressed
0x0400 1024 Shows details when an email completion thread starts or stops
0x0800 2048 Shows details when a timed task begins execution
EMail debug constants, changed using "E=0x40", for example:
0x0001 1 Shows process information in the IMAP state machine completion thread
0x0002 2 Shows process information in the POP3 state machine completion thread
0x0004 4 Shows process information in the SMTP state machine completion thread
0x0008 8 Shows socket connection attempts and results for the IMAP, POP3, and SMTP protocols
0x0010 16 Shows some additional details in many of the IMAP, POP3, and SMTP states
0x0020 32 Shows some details when the IMAP scheduler starts a new IMAP completion thread
0x0040 64 Shows information generated by the IMAP GetReplyCount logic
0x0080 128 Shows a time and date formatted email string from an EMailTx action string
0x0100 256 Shows the details when a POP3 or IMAP ERx string is matched
0x0200 512 Causes the email string matching routine to leave received email HTML codes intact
Notes
CommTool was originally written as a 16-bit application, named PortMon. It was converted to a 32-bit application in 1997, and has been actively maintained as a 32-bit application since then. This was done intentionally and means that it should run correctly on any version of Windows® from NT and XP, all the way up through Windows® 10, in either the 32-bit or 64-bit platform. There may still be a use for that older computer!
The numeric value parsing routine in CommTool can handle strings representing decimal, hexadecimal, or binary values. A hexadecimal string must begin with "0x" or "0X", followed by only these characters: 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f; any other character (commonly, a space) exits the parsing function, returning the value parsed up to that point. A binary string must begin with 'B' or 'b' and contain only these characters: 0 1 -. The dash is a spacer, used like a comma in decimal values to visually break up a long string of binary digits. For example, B11110111-00110001 is a binary string, equal to 0xF731 hexadecimal and 63,281 decimal.
The /M (for Mode) command line parameter selects BYTE-by-BYTE file transmission mode instead of the default line-by-line mode for the Send function key command. Use the Esc key to end file transmission before the end of the file, when transmitting a file. Although this is the same key used to gracefully exit the CommTool program, Esc is treated differently during file transmission. A second Esc keypress is then required to exit the program.
CommTool.Exe can be renamed, in which case, by default, it will look for its configuration file with its new name, but with .Exe replaced with the .Cfg extension. Explicitly specifying a configuration file name by using "/CFG = Filename", or specifying "/NoCfg" as a command line parameter overrides the default.
Downloads page