poke Command

For Windows: Not Supported.

The poke BASIC program sends either a string of characters or one or more TCL commands to the input buffer of another port.

Syntax

poke port.number{,{ text}}

poke port.number{ }esc{file.reference {item-ID}}

poke port.number esc

poke port.number tcl.commands esc{tcl.commands{esc}...}

Parameter(s)

port.number

Designates the target port number.

text

Contains any characters, except segment marks (x'ff'), and can be unlimited in length. The text can be preceded by a space, which optional. When the text is omitted, a carriage return is sent to the target port. The text string can be enclosed in single or double quotation marks, or backslashes.

Description

One or more TCL commands may be sent directly to the target port. Each TCL command must be followed by an escape, which is treated as a carriage return on the receiving port.

An item containing one or more valid TCL commands may also be transmitted directly from a file. The transmitted item must contain one valid TCL command on each attribute. This feature is accomplished by poking an escape to the target port. The process prompts for the file name and item-ID of the item to transmit and execute.

The poke command displays the number of characters it has successfully poked to the target port’s input buffer. The number reported may not match the actual number of characters sent due to the condition of the target port’s input buffer.

The ESC key is used by poke to terminate commands, a special provision applies for transmitting an actual escape. This is accomplished by pressing ESC twice. A set of two escapes is treated (and poked) as one escape.

CAUTION

This process does not check to see that the target port is ready to accept characters. In other words, if the target port is in the Update Processor or a FlashBASIC program at an input statement and the (TCL) who command is poked to the target port, it is treated as data on the receiving end.

Some functions of the Update Processor/TCL command stack interfere with transmission of control characters from the TCL prompt. For example, suppose there was a need to poke a CTRL+D to another port. The TCL command stacker uses CTRL+D to retrieve the previous command. The only way this could be accomplished from TCL is to first turn off the command stacker for the current port with the stack-off command. Then the CTRL+D could be poked. The stack-on command restarts the stacker. For this reason, it is probably easier to do all poking from FlashBASIC, where control characters can be poked by their char equivalents.

Example(s)

Sends a carriage return to port 16.

poke 16

[1028] 1 characters poked.

Sends a carriage return to port 16.

poke 16,

[1028] 1 characters poked.

Sends the string, "answer the phone!", to port 16, without following the (poked) string with a carriage return.

poke 16,answer the phone!

[1028] 17 characters poked.

This is exactly the same as the previous example. Single or double quotation marks and backslashes have no effect on the string being sent, unless the string happens to begin with, but not be followed by, a literal quotation mark. See the next example.

poke 16,"answer the phone!"

[1028] 17 characters poked.

Fails because the string is preceded by a quotation mark.

poke 16 "hi

[2] Uneven number of delimiters (’ " \).

The next example shows that a trailing quotation mark is accepted.

poke 16 hi"

[1028] 3 characters poked.

Embedded quotation marks are permitted.

poke 16,don’t panic!

[1028] 12 characters poked.

In all of the previous examples, no carriage return was entered at the end of the poked strings.

In this form of a poke, the string being sent is an actual TCL command. The [ is echoed by pressing ESC. This pokes a who to port 16 and issues a carriage return to process the command.

poke 16 who[

This pokes the who, time, and ovf commands to port 16 and executes them.

poke 16 who[time[ovf

This form uses the port number, followed by pressing ESC, and then ENTER. The process prompts for the file name and item-ID of the item to transmit.

poke 16[

poke from file-name item-name:md script1

Each attribute of the specified item, starting at the first attribute, is treated as a valid TCL command. For example, script1 could look like this:

id: script1

att 1: who

att 2: time

att 3: ovf

The file name in this example is supplied on the command line. The process only prompts for the item-ID of the item to transmit.

poke 16[md

poke from item-name:script1

The file name in this example and item-ID are specified on the command line.

poke 16[md script1

[1028] 13 characters poked.

In this form, an item is constructed on-the-fly, then poked into the target port’s input buffer. This example executes the who, time, and ovf commands on port 16.

poke 16[

poke from file-name item-name:[

0001 :who

0002 :time

0003 :ovf

0004

[1028] 13 characters poked.

Pokes two ESC key results in one escape being sent.

poke 16 [[

[1028] 1 characters poked.

Illustrates using execute to poke characters to another port. This instruction pokes a CTRL+X, then a CTRL+E, followed by a literal "y". This explicitly exits the receiving port from the current item in the Update Processor.

execute "poke 16 " : char(24):char(5):"y"

See Also

tcl Command

tcls Command