<< Click to Display Table of Contents >> Navigation: Reference (Scripting) > Docklight Script Commands - The DL Object > Methods > SendSequence |
Sends a Send Sequence or a custom data sequence. Starts the communication, if not already running (see StartCommunication).
Return Value
Void
Syntax 1
DL.SendSequence nameOrIndex [, parameters] [, representation]
Sends out the Send Sequence that matches nameOrIndex. The SendSequence method syntax 1 has these parts:
Part |
Description |
nameOrIndex |
Required. String containing the Name of the Send Sequence. The first Send Sequence from the list with a name that matches nameOrIndex is used. As an alternative, you may pass an integer value specifying the Sequence Index. Valid Sequence Index range is from 0 to (NoOfSendSequences - 1). |
parameters |
Optional. String containing one or several parameter value(s) for a Send Sequence with wildcards. Parameters are passed in ASCII representation by default. The space character is used to separate several different parameters for different wildcard areas.
To pass parameters in HEX, Decimal or Binary representation, use the optional representation argument described below. In HEX, Decimal or Binary representation, the comma (",") is used as a separator between several different parameters. |
representation |
Optional. String value to define the format for parameters list "A" = ASCII (default), "H" = Hex, "D" = Decimal or "B" = Binary. |
Remarks (Syntax 1)
If the wrong number of parameters is provided by the parameters argument, or the parameter length does not match the corresponding wildcards region, Docklight will not raise an error, but apply the following rules:
•If too few parameters are provided, or the parameter string is too short, all remaining wildcards are filled up with a blank character. If you are using representation = "A" (ASCII) , the wildcards are filled with space characters (ASCII code 32). For all other formats, the wildcards will be filled with ASCII code 0.
•If too many parameters are provided, or the parameter string is too long, the parameter(s) will be truncated or ignored.
DL.SendSequence "", customSequence [, representation ]
Sends out a custom data sequence. The SendSequence method syntax 2 has these parts:
Part |
Description |
customSequence |
Required. String containing the sequence to send. The sequence is passed in ASCII representation by default. For HEX, Decimal or Binary sequence data, use the optional representation argument described below. |
representation |
Optional. String value to define the format for customSequence. "A" = ASCII (default), "H" = HEX, "D" = Decimal or "B" = Binary. |
Example
' Example SendSequence
' Predefined Send Sequences
' (0) Test: Test
' (1) One: One<#><#><#><CR><LF>
' (2) Two: One<?><?><?>Two<#><#><#>
DL.StartCommunication
DL.ClearCommWindows
' Send sequence without parameter
DL.SendSequence "Test"
' Send sequence with one parameter
DL.SendSequence "One", "100"
' Send sequence with two parameters
DL.SendSequence "Two", "100 20"
' Pass two parameters in HEX representation, including spaces and control characters
DL.SendSequence "Two", "20 31 20, 30 0D 0A", "H"
' Send custom sequence data, not using a predefined Send Sequence
DL.SendSequence "", "Custom Data"
' And now using a loop and the loop variable
' for the Send Sequence parameter values
For i = 1 To 10
parString = i & " " & i+1 ' use a space to separate parameters
DL.SendSequence "Two", parString
Next
DL.StopCommunication
After running the script, the Docklight communication window could look like this:
08/05/2008 13:50:35.622 [TX] - Test
08/05/2008 13:50:35.631 [TX] - One100<CR><LF>
08/05/2008 13:50:35.665 [TX] - One100Two20
08/05/2008 13:50:35.682 [TX] - One 1 Two0<CR><LF>
08/05/2008 13:50:35.699 [TX] - Custom Data
08/05/2008 13:50:35.713 [TX] - One1 Two2
08/05/2008 13:50:35.745 [TX] - One2 Two3
08/05/2008 13:50:35.771 [TX] - One3 Two4
08/05/2008 13:50:35.807 [TX] - One4 Two5
08/05/2008 13:50:35.846 [TX] - One5 Two6
08/05/2008 13:50:35.878 [TX] - One6 Two7
08/05/2008 13:50:35.907 [TX] - One7 Two8
08/05/2008 13:50:35.922 [TX] - One8 Two9
08/05/2008 13:50:35.955 [TX] - One9 Two10
08/05/2008 13:50:35.987 [TX] - One10 Two11