<< Click to Display Table of Contents >> Navigation: Reference (Scripting) > Docklight Script Commands - The DL Object > Methods > AddComment |
Adds a user-defined text to the communication data window and log file.
Return Value
Void
Syntax
DL.AddComment [comment] [, timeStampAfterComment] [, lineBreakAndPadding]
The AddComment method syntax has these parts:
Part |
Description |
comment |
Optional. String containing the comment to add to the communication window(s) or log file(s). If comment is left out, AddComment will produce a line break only. |
timeStampAfterComment |
Optional Boolean value. False (Default) = No additional time stamp. True = Add a time stamp after the comment. The time stamp is added when processing the next serial data character, not immediately after printing the comment. This is similar to how the "Additional time stamp..." option in the Receive Sequence dialog works. |
lineBreakAndPadding |
Optional Boolean value. True (Default) = Additional space characters are added before and after the text, to separate it from the communication data. A line break is added after the comment. False = No additional spaces or line break. This is especially useful in combination with the Communication Filter option, when you want to create the actual screen output entirely with the AddComment method. |
Remarks
AddComment supports the Receive Sequence comment macros %_S (bell, "beep signal") , %_L (line break) and %_T (Timestamp) for convenience. See comment macros for details.
You cannot use ASCII control characters like decimal code 08 (Backspace) to emulate terminal functions / display formatting. The only exception is decimal code 07 (Bell), which can be use to produce a 'beep signal', depending on your Windows sound scheme.
Example
' Example AddComment
DL.ClearCommWindows
DL.AddComment "Hello World!"
' Additional line break
DL.AddComment
' Use the '&' operator to concatenate strings and other variables
r1 = 10
r2 = 20
DL.AddComment "Result 1 = " & r1 & " Result 2 = " & r2
' The VBScript constant vbCrLf can be used for an
' additional line break, too
DL.AddComment
DL.AddComment "Result 1 = " & r1 & vbCrLf
DL.AddComment "Result 2 = " & r2
' Disabling the line break and padding characters gives you
' better control over the actual output
DL.AddComment vbCrLf + "Here's some bit of info", False, False
DL.AddComment "rmation. " + vbCrLf, False, False
' A "beep" signal for user notification
DL.AddComment Chr(7)