Creating pcANYWHERE Scripts

Transcription

Creating pcANYWHERE Scripts
™
Creating pcANYWHERE Scripts
™
™
Creating pcANYWHERE™ Scripts
The software described in this book is furnished under a license agreement
and may be used only in accordance with the terms of the agreement.
Copyright Notice
Copyright  1993-1996 Symantec Corporation.
All Rights Reserved.
No part of this publication may be copied without the express written
permission of Symantec Corporation, Peter Norton Group, 10201 Torre
Avenue, Cupertino, CA 95014.
Trademarks
Symantec, pcANYWHERE, and pcANYWHERE32 are trademarks of Symantec
Corporation.
Windows is a registered trademark, Windows 95 and Windows NT are
trademarks of Microsoft Corporation. Other product names mentioned in this
manual may be trademarks or registered trademarks of their respective
companies and are hereby acknowledged.
Printed in the United States of America.
10
9
8
7
6
5
4
3
2
1
Contents
About This Guide
Contents ...............................................................................................................................5
Assumptions ..................................................................................................................5
Conventions ..................................................................................................................6
1. Getting Started Using Scripts
What Is a Script? ...................................................................................................................7
Creating a Script ...................................................................................................................8
Writing and Editing a Script ................................................................................................8
Compiling a Script ...............................................................................................................8
Running a Script ...................................................................................................................9
Sample Script ..................................................................................................................... 10
Creating a Script using Learn Mode .......................................................................... 13
2. Components and Concepts
Language Components ...................................................................................................... 15
Comments ................................................................................................................... 15
Commands .................................................................................................................. 16
Literals ......................................................................................................................... 19
Variables ...................................................................................................................... 20
Operators .................................................................................................................... 22
Labels .......................................................................................................................... 25
Capitalization and Spacing ................................................................................................ 25
Using the $Result Reserved Variable ................................................................................ 26
Error Handling ................................................................................................................... 26
Making Decisions ............................................................................................................... 26
Branching ........................................................................................................................... 27
Command Summary .......................................................................................................... 28
Automating Remote Control Sessions ....................................................................... 28
Loading or Modifying Configuration Information ..................................................... 30
Controlling Script Processing ..................................................................................... 31
Interacting with User .................................................................................................. 33
Transmitting and Receiving Data ............................................................................... 34
Managing Files and Directories ................................................................................. 36
Reading/Writing To Files ........................................................................................... 38
Performing String Operations .................................................................................... 39
Printing ........................................................................................................................ 40
Managing the Display ................................................................................................. 40
Miscellaneous Commands .......................................................................................... 43
4
Contents
3. Managing Scripts in pcANYWHERE for Windows
Creating, Compiling, and Running Scripts ........................................................................45
Creating and Editing Scripts .......................................................................................46
Using the Online Reference .......................................................................................50
Creating Commands with the Assist Dialog Box ......................................................51
Printing a Script ...........................................................................................................56
Compiling and Running Scripts .................................................................................56
Other Editor Features .........................................................................................................59
Recording and Playing Macros ...................................................................................59
Searching and Replacing Text ....................................................................................59
Setting Document Preferences ...................................................................................67
Setting Editor Preferences ...........................................................................................68
Customizing the Keyboard .........................................................................................71
4. Script Language Command Reference
A. Reserved Words and Variables
Reserved Words ...............................................................................................................203
Reserved Variables ...........................................................................................................205
B. Error Messages
Syntax Errors ....................................................................................................................211
The $Error Reserved Variable ..........................................................................................212
Glossary
Index
About This Guide
This guide explains the pcANYWHERE script language used with
pcANYWHERE for DOS, pcANYWHERE for Windows, and pcANYWHERE32
for Windows 95 and Windows NT. It also describes the pcANYWHERE Editor
used in Windows to create and edit script files. Please consult your program’s
READ.ME file and appropriate online help to determine differences that may
be applicable with the creation and execution of pcANYWHERE script files
under different versions available. Note that this manual provides scripting
examples for pcANYWHERE for Windows and pcANYWHERE for DOS that,
in many cases, are also available under pcANYWHERE32.
Contents
If you are not already familiar with batch files or programming languages,
read Chapters 1 and 2, “Getting Started Using Scripts” and “Components and
Concepts.” They provide the background information that will enable you to
use the script language effectively. Some of the information in Chapter 2 is
aimed at more technical users. If you don’t understand the finer details, don’t
worry; you’ll still be able to take advantage of the script language’s power.
Chapter 3, “Managing Scripts in pcANYWHERE for Windows,” explains the
pcANYWHERE Editor for use with pcANYWHERE for Windows.
Chapter 4, “Script Language Command Reference,” is an alphabetical listing
of the script language commands. The entry for each command includes its
syntax, description, and parameters, the changes it makes to reserved
variables (such as $Result and $Error), an example of its use, and a “See
Also” section that lists any related commands.
At the back of the guide are two appendices—a list of reserved variables and
a list of error messages—and a glossary of terms used in the guide.
Assumptions
This guide assumes that users of pcANYWHERE for Windows know how to
use Windows. If you are not familiar with such Windows terms as “dialog
boxes,” “icons,” “option buttons,” and “list boxes,” refer to your Microsoft
Windows documentation.
6
About This Guide
This guide does not assume you have any previous experience with script
languages. The material is designed for the novice and the experienced
programmer alike.
Conventions
In this guide, all sample script file lines use a monospace-style font named
Courier:
This is an example of Courier font.
This guide includes many sample script file lines. Each line of a script file
starts at the same point on the left side of the page. If a script file line is too
long to fit across a single line on this guide’s page, the line is continued on a
second, indented line. Here is an example:
If ((attribute&32)==32)&& ($Result>0) Then StrCat
description "A"
Note that all of this text must appear on a single line within a script file;
otherwise, you get an error message when you try to run the file.
This guide uses a number of conventions for indicating the correct syntax of
the script language commands. These conventions are explained in
Chapter 2, “Components and Concepts.”
Getting Started Using
Scripts
1
This chapter introduces you to the pcANYWHERE script language. It
provides the information you need to begin using scripts. With scripts, you
can automate the operation of pcANYWHERE for DOS or pcANYWHERE for
Windows.
This chapter explains:
■
What a script is
■
Why you would want to use a script
■
How to write a script
■
How to compile and run a script
If you have pcANYWHERE for DOS, read about automated procedures in the
user’s guide, Using pcANYWHERE for DOS. For remote control sessions, you
may prefer to use an automated procedure instead of a script.
What Is a Script?
A script is a small program you can use to make the operation of
pcANYWHERE more automatic. For example, with a script you can arrange
for a pcANYWHERE session to take place between two computers without
any human intervention, perhaps to perform unattended file transfers in the
middle of the night, when the long distance phone rates are lower. Or you
can streamline a connection with an online service or electronic bulletin
board—navigate the appropriate menus, upload your electronic mail, or post
messages to a bulletin board.
A script is a written set of instructions used to operate pcANYWHERE on
your computer. The instructions are written in an ASCII text file and stored
on disk. If you are not familiar with a script language, the easiest way to
learn the concepts and get some experience is by reading through the first
two chapters of this guide. If you already have some programming
experience, you can skip to Chapter 4, “Script Language Command
Reference,” for details about each of pcANYWHERE’s script commands.
8
Chapter 1 • Getting Started Using Scripts
NOTE: This chapter includes many sample script file lines. If a script file line
is too long to fit across a single line on this guide’s page, the line is continued
on a second, indented line. However, within an actual script file, the entire
line must appear on a single line.
Creating a Script
First, you must fully understand what you want your script to do. Scripts
make no assumptions, and execute your instructions exactly as you have
specified them.
To avoid errors when creating scripts:
1
Manually perform the steps you want to automate, and carefully note
each detail of the operation. Write down the steps in plain English.
This is called writing pseudocode.
2
Write the script. Each line of pseudocode should translate to one or
more lines of script code.
Writing and Editing a Script
Scripts must be written in ASCII text files and saved on disk with the
extension .SCR. Before being used, they must be compiled, changed into a
form recognized by pcANYWHERE. In pcANYWHERE for DOS, this is called
preprocessing. Compiling or preprocessing creates files with the extension
.SCX, the form that can be interpreted by pcANYWHERE.
When creating a script for either version of pcANYWHERE, you can use any
editor capable of saving ASCII text files. pcANYWHERE for Windows
provides a text editor that makes writing, compiling, and running scripts
easy. This editor is explained in depth in Chapter 3, “Managing Scripts in
pcANYWHERE for Windows.”
Compiling a Script
Once you have successfully compiled a script, you can run it in either
pcANYWHERE for DOS or for Windows.
To compile a script in the DOS version:
1
Choose UTILITIES… from the Main menu.
Chapter 1 • Getting Started Using Scripts
The Utilities menu appears.
2
Choose PREPROCESS SCRIPTS… from the Utilities menu.
The Select Path For Script File form appears.
3
Type the pathname of the script then press Enter.
To compile a script in the Windows version:
1
Choose SCRIPTS… from the Utilities menu.
The Scripts dialog box appears.
2
Select the name of the script then click Compile….
In either version, messages about syntax errors appear in an .ERR file with
the same name as the script. You cannot run a script until it is error free.
Running a Script
Scripts may be run four different ways:
■
A script that initiates a connection may be run from pcANYWHERE
for DOS using either the CALL A PCANYWHERE HOST or the CALL AN
ONLINE SERVICE menu. For pcANYWHERE for Windows, you select
the script from the Scripts dialog box. See the procedures below.
■
To run a script immediately after a connection is established, you
can insert the name of a script in either the host or online session
configuration. You type the script’s name in the field called Script
File.
■
After a connection has been established with a host PC or an online
service, you can run a script of your choice. For pcANYWHERE for
DOS, you choose RUN SCRIPT… from the Terminal Options menu.
For pcANYWHERE for Windows, you choose SCRIPTS… from the File
menu. The script runs immediately. See the procedures below.
■
To initiate a script from the DOS prompt as you launch
pcANYWHERE for DOS, use the following command-line options:
/m:s
/n:script_filename
For example, the command lines below cause the script file SAMPLE to
be run on a remote PC. The first command line is for a network
connection; the second is for a serial connection.
AW /i:xxx /o:r /m:s /n:SAMPLE
AW /m:s /n:SAMPLE
9
10
Chapter 1 • Getting Started Using Scripts
To connect with a script in pcANYWHERE for DOS:
1
Choose CALL A PCANYWHERE HOST… or CALL
from the pcANYWHERE Main menu.
AN
ONLINE SERVICE…
The Call a pcANYWHERE Host or Call an Online Service menu appears.
2
Choose RUN SCRIPT….
The Select Path For Script File form appears.
3
Type the pathname of the script then press Enter.
To connect with a script in pcANYWHERE for Windows:
1
Choose SCRIPTS… from the Utilities menu.
The Scripts dialog box appears.
2
Select the name of the script then click Run….
To run a script after connection in pcANYWHERE for DOS:
1
Press the remote hotkey.
The Terminal Options menu or the Session Options menu appears.
2
Choose RUN SCRIPT….
The Select Path For Script File form appears.
3
Type the pathname of the script then press Enter.
To run a script after connection in pcANYWHERE for Windows:
1
Choose SCRIPTS… from the File menu.
The Scripts dialog box appears.
2
Select the name of the script then click Run….
Sample Script
This script automates a login sequence to CompuServe Information Service, a
world-wide electronic communications service. Each manual step is noted in
detail in the following pseudocode.
I dialed 555-1234.
I waited for the screen to say "06CUI". (You may see something
different.)
I pressed Enter.
It said "Host Name:".
I typed "COMPUSERVE" and pressed Enter.
It said "User ID:".
Chapter 1 • Getting Started Using Scripts
I typed "1234,4321", and pressed Enter. (Your user ID will be
different.)
It said "Password:".
I typed "secret", and pressed Enter. (Your password will be
different.)
And then I was connected.
The first section of the following script provides the information normally
defined in the online session configuration. Set Echo On tells pcANYWHERE
to display the incoming text. Load OnlSvc “Serial: Modem” loads all of the
communications parameters, such as COM port, data rate, parity, etc., from
the session configuration name specified between the quotation marks. Clear
Screen clears the screen. Emulate ANSI tells the script to function in same
manner as an ANSI terminal would.
Blank lines in the script are separators that make reading the script easier.
Blank lines are ignored in the script language. Also, the semicolon character
( ; ) indicates that the rest of the line is just a comment.
The second section of the script contains commands translated from the
psuedocode. The actions taken in the script are in response to the prompts
received from CompuServe. A frequent error when writing scripts is
forgetting to tell the script what to look for before sending a response.
Lastly, End Terminal goes into terminal operation which ends the script and
allows you to interactively communicate with the online service
(CompuServe, in this case).
11
12
Chapter 1 • Getting Started Using Scripts
; This section prepares pcANYWHERE and the modem prior
;to making the connection
;Enable local character echo
Set Echo On
;Get communications parameters
Load OnlSvc "Serial: Modem"
;Clears the screen
Clear Screen
;Behave like an ANSI terminal
Emulate ANSI
;This section contains the main body of the script,
;converted from the pseudocode
;I dialed 555-1234
Dial Number "555-1234"
;I waited for my screen to say "06CUI"
Wait String "06CUI"
;I pressed Enter
Send String "^M"
;It said "Host Name:"
Wait String "Host Name:"
;I typed "COMPUSERVE", and pressed Enter
Send Line "COMPUSERVE"
;It said "User ID:"
Wait String "User ID:"
;I typed "1234,4321", and pressed Enter
Send Line "1234,4321"
;It said "Password:"
Wait String "Password:"
;I typed "secret", and pressed Enter
Send Line "secret"
;This section ends the script,
;leaving the terminal connection
;End the script because I am connected
End Terminal
Chapter 1 • Getting Started Using Scripts
Creating a Script using Learn Mode
Learn Mode, a feature in version 2.0 and higher, records the keystrokes you
execute during an online service session, and converts them into script
language commands. You can use Learn Mode to create a script that
automates repetitive tasks. For example, a script can automatically dial into
an online service such as CompuServe and access the Dow Jones daily stock
quotes.
You can modify this file if necessary, using the pcANYWHERE script editor.
See Chapter 3, “Managing Scripts in pcANYWHERE for Windows.”
To create a script with Learn Mode:
1
Before making a connection, check the Begin Script Recording After
Connection check box in the Online Service connection item’s
properties. Refer to Chapter 10, “Online services,” in the
pcANYWHERE User Guide, for information on creating online service
connection items.
2
Connect to an online service.
All activities during the session are recorded.
3
Log off the online service.
The Save Recorded Script dialog box appears (Figure 1-1).
Figure 1-1
The description you provide is listed in the Scripts dialog
box for easy identification of the script file’s content.
4
Type an easily recognizable description for the new script file in the
Description text box.
5
Click the Save Script As... button.
The Save Script File As dialog box appears (Figure 1-2).
13
14
Chapter 1 • Getting Started Using Scripts
Figure 1-2
pcANYWHERE automatically adds the .SCR extension
to your filename.
6
Type a filename in the File Name text box.
7
Click OK.
The pcANYWHERE session ends and the script file is saved.
Refer to Chapter 3, “Managing Scripts in pcANYWHERE for Windows,” for
information on editing and running scripts.
Components and
Concepts
2
This chapter explains the components of the pcANYWHERE script language
and how a number of programming concepts are implemented in the
language. This chapter covers the following topics:
■
Language Components
■
Comments
■
Commands and their parts: Parameters, literals, variables,
operators, and labels.
■
Capitalization and spacing
■
The $Result reserved variable
■
Error handling
■
Decision making and branching
It also includes a summary of all the commands in the pcANYWHERE script
language grouped by function.
Language Components
Each line (or statement) in a script file is a comment, a command, or a
command followed by a comment. The maximum length for a line is 255
characters. You cannot wrap any of your commands or comments from one
line to the next. However, if a script file line is too long to fit across a single
line on this guide’s page, the line is continued on a second, indented line.
Comments
A comment is a sequence of characters that pcANYWHERE ignores when
processing a script file line. You can use comments in your script to provide
documentation. This is particularly helpful each time you open the script to
modify it, since your comments remind you how your scripts operate. Script
comments are preceded by a semicolon ( ; ). They can be entered on a line
by themselves, or added to the end of a command line.
16
Chapter 2 • Components and Concepts
NOTE: In addition to using comments to clarify your script, you may want to
use blank lines to group commands and their labels or separate subroutines
from the main body of the script. The compiler ignores all blank lines during
compilation.
Examples:
;Loop through the strings until a match is found
String userID[8]
;userID contains the name of user
Dial OnlSvc “CompuServe”
;dial service
TIP: If you decide that you want to test your script from the Scripts dialog
box in pcANYWHERE for Windows, but some of the commands won’t
execute unless you’re connected to a host, disable these commands by using
semicolons. Simply place a semicolon in front of each command you do not
want executed. This allows you to easily modify and test individual segments
of your script file.
Commands
Commands are instructions to pcANYWHERE. Each command has its own
syntax, or rules for constructing the command. A command’s name can be
followed by one or more parameters, which give pcANYWHERE additional
information about how the instruction is to be executed.
Commands are used for a variety of actions, which are grouped as follows:
■
Automating remote control sessions
■
Loading or modifying configuration information
■
Controlling script file processing
■
Interacting with user
■
Transmitting and receiving data
■
Managing files and directories
■
Reading/writing to files
■
Performing string operations
■
Printing
■
Managing the display
■
Miscellaneous commands
Chapter 2 • Components and Concepts
A list of the script commands, grouped by function, appears at the end of this
chapter. Chapter 4, “Script Language Command Reference,” provides an
alphabetical description of each script language command, including its
purpose, syntax, parameters, and an example of its use.
Several commands refer to the ASCII values (0-127) for characters in the
ASCII character set. ASCII is the acronym for American Standard Code for
Information Interchange. In the character set, numeric values are assigned to
letters, numbers, punctuation marks, and a few additional characters.
Computers and programs using these standard codes are able to exchange
information. Values 0 to 31 are assigned as control codes and are generally
nonprinting characters. In some fonts, these characters represent graphical
symbols. Values from 32 to 127 represent the numbers 0 to 9, common
punctuation marks, and the upper- and lowercase letters of the alphabet. In
ASCII order, the string “Zebra” would precede both “aardvark” and “zebra”,
because the uppercase letters precede the lowercase letters.
Reserved Words
A reserved word is a word that has a special meaning in the script language
and can be used only as its syntax allows. In this guide, a reserved word
used in a command’s syntax appears in bold type to remind you to use it
exactly as it appears. Appendix A, “Reserved Words and Variables,” contains
a complete list of the reserved words in pcANYWHERE script language.
Parameters
Parameters provide the information that the pcANYWHERE script language
needs to execute a command. Depending on the command, a parameter can
be a variable or a literal. (Variables and literals are explained in greater detail
in the following sections.) The number of parameters must match the
number required by the command’s syntax, or an error occurs when you
compile the script. Each parameter must be the type (string or integer) that
the command requires as well.
Syntax
To effectively use the command summary at the end of this chapter or the
detailed command reference in Chapter 4, “Script Language Command
Reference,” you need to understand the syntax conventions used in this
guide. They are a variation of Backus-Naur Form (BNF), a standard method
17
18
Chapter 2 • Components and Concepts
of indicating how to write commands correctly in a programming language.
The specific meanings of the various fonts and symbols is as follows:
Boldface
Words in bold type are reserved words that must be used
exactly as they appear in the syntax. A complete list of
reserved words appears in Appendix A, “Reserved Words
and Variables.”
italics
Words that appear in italics are parameters. In a
command, you substitute variable names or literals (of the
correct data type), for the words in italics. An explanation
of each word that appears in italics is explained below
the syntax.
[
The brackets do not appear in your commands. In the
syntax, a pair of brackets means that anything between
them can be omitted and the command will still compile.
Usually, when you omit something, its default is used.
|
]
The vertical bar does not appear in your commands. In
the syntax, it means that you have a choice. No more
than one of the choices will appear in your command.
When the choices are in brackets, making a choice is
optional. When choices are not in brackets, you must
pick one of them.
Here is an example of the notation used to describe a command:
Receive Char char [timeout]
The syntax indicates that the Receive Char command has two reserved words
(Receive and Char). It requires a char parameter and accepts an optional
timeout parameter. The parameters are separated by a space.
Here is another example:
Session Overwrites Always | Never | Older
The Session Overwrites command is composed of three reserved words. For
the last word, you have three choices: Always, Never, or Older. Just one
option is selected for the command, as the next examples shows:
Session Overwrites Older
Chapter 2 • Components and Concepts
Literals
A literal is a value of a particular type—rather than a representation of that
value. You use a literal in your script as the value of a variable or parameter.
pcANYWHERE provides two types of literals: integers and strings. An
example of an integer literal is the number 4. A integer variable can store the
value 4, but its name is not 4, the value itself. A string literal is the sequence
of characters in the string. For example, “Hello, world!” is a string literal.
String literals are enclosed in delimiter characters, either single or double
quotation marks.
In some user’s guides, a literal is called a constant, because its value does not
change during the execution of the script.
Integer Literals
Integer literals are built from the digits 0 through 9. They can have any whole
number value from -2,147,483,648 to +2,147,483,647, the range for integers.
Each negative integer is preceded by the unary minus operator (-). Integer
literals cannot contain commas or decimal points.
Integer literals can also be expressed as hexadecimal numbers. You indicate
that an integer literal is hexadecimal by preceding up to 8 hexadecimal digits
by 0x. (Hexadecimal digits are 0-9, A-F.)
Examples of integer literals are:
1
592345
0x8000
String Literals
String literals are from 0 to 255 characters in length and contain any
displayable characters delimited by quotation marks. You can use single (')
or double (") quotation marks to enclose a string literal, as long as you use
the same delimiter both before and after the literal. If you need to embed the
delimiting quotation mark inside a string literal (so that it becomes a
character within the string), use the delimiting quotation mark twice. Usually
you can avoid this problem by using single quotation marks to delimit a
string that contains double quotation marks, and vice versa. You can also
embed ASCII control codes (codes less than decimal value 32) by using the
caret symbol (^) and one of the following characters:
19
20
Chapter 2 • Components and Concepts
@ A-Z [ \ ' ^ "
The most commonly used control codes in string literals represent the
carriage return and linefeed characters, ^M and ^J, respectively.
Examples of string literals:
"Gary Lee"
'555-1212'
"Use a single embedded ' mark"
'Use a single embedded " mark'
"Use a double embedded "" mark"
"Use a carriage return/linefeed ^M^J"
NOTE: The convention in this guide is that all string literals are surrounded
by double quotation marks.
Variables
Variables contain values that can change during the execution of a script or
they contain values that change each time a script is run. A variable in
pcANYWHERE can contain either an integer or a string value. For example, if
your password changes frequently, you may prefer to enter it each time you
run a script requiring it, rather than to store it directly in your script as a
literal or to read an encrypted version of it from a file.
Variables can be either local, used by only one script, or global, available to
more than one script. Global variables all start with a dollar sign ($). Local
variables start with a letter of the alphabet. You can define, or declare, both
local and global variables to store values used in a script. When you do so,
the variable is called a user-defined variable. pcANYWHERE has a number of
reserved variables, variables that store information used by pcANYWHERE. In
most cases, you can also assign the values of reserved variables explicitly.
User-Defined Variables
User-defined variables are those variables that you define for your use during
the running of a single script. When you declare a user-defined variable, you
specify its type: integer or string. You can declare both local and global userdefined variables, but their naming conventions differ.
Chapter 2 • Components and Concepts
Local User-Defined Variables
Local user-defined variables must begin with an alphabetic character, and
can contain any letters, numbers, or symbols except the following:
= + - * / | & ^ ! > < ( ) : ; [ ] , blank spaces
Although only the first eight characters are used to determine the uniqueness
of a name, variable names can be any length up to 255 characters. (Keep in
mind that the maximum length of one line in a script is also 255 characters.)
This allows you to select descriptive names for your variables. In addition,
variable names are not case-sensitive. For example, the variables HostName,
hostname_office and HostName_Plant are treated as the same variable. In
effect, modifying any of these variables modifies all of them.
While you can have a variable name that matches a reserved word, it’s not
recommended.
If your script starts the execution of a second script, the values in the local
variables are not carried over into the second script (even if variables with
the same names exist in both places). In fact, the same variable name can be
used in the second script to contain totally different information.
Global User-Defined Variables
Global variables are variables whose values are remembered and remain
accessible while you are running scripts that are linked to or nested within
the primary script. These variables retain their values from script to script.
All global variable names start with a $ (dollar sign) character. Global userdefined variables range from $1 through $127. Global variables are integers
unless you declare them to be strings. If you declare global variables to be
strings, you must declare them identically in each of the linked or nested
scripts that reference them. This is primarily to ensure that the maximum
length does not change from script to script.
Declaring User-Defined Variables
When you declare a variable, you indicate its type, its name, and, in the case
of string variables, the maximum length string the variable can hold. You
must declare each local user-defined variable, and each global user-defined
variable that will contain a string. It is customary to declare each variable at
the beginning of the script along with a comment that explains its use. You
may want to declare global user-defined variables that will contain integers
so that all the variables are defined at the beginning of the script. The script
21
22
Chapter 2 • Components and Concepts
language automatically initializes each integer variable to zero and each
string variable to the empty string, a string containing zero characters.
A string variable is a placeholder for up to 255 characters of text you use in
the script. String variables are declared by using the reserved word String,
followed by the name of the variable and the maximum length of the string
enclosed in square brackets. You cannot put a space between the name of
the variable and the left bracket. If you do not assign a length to a string
variable, the length is automatically set to 80 characters. If you assign more
characters to a string than it can hold, the extra characters are truncated. In
the following examples, the password variable can contain no more than 12
characters, and the filename variable can contain no more than 80.
String password[12]
String filename
An integer variable is a placeholder for an integer value that you are going to
use in the script. The value stored in the integer variable can be any whole,
non-fractional number, such as 0, 1, or 9275, within the range for integers.
Integer variables are declared using the reserved word Integer followed by
the name of the integer variable, as shown below:
Integer total
Reserved Variables
Reserved variables are variables that have special meaning to pcANYWHERE.
They can contain, for example, current parameter settings, results of
operations, or the current date and time. You can use reserved variables
anywhere that variables of the appropriate type (integer or string) are
allowed. However, some reserved variables are read-only; that is, you cannot
change their values.
All reserved variable names start with a $ (dollar sign) character because they
are global. You can use any of the reserved variables anywhere in your
script, even if the script is linked or nested. For the complete list of reserved
variables and the information that they contain, see Appendix A, “Reserved
Words and Variables.”
Operators
Literals and variables can be combined into expressions using operators. The
pcANYWHERE script language operators can take one operand (unary
Chapter 2 • Components and Concepts
operators) or two operands (binary operators). You can use the following
operators in pcANYWHERE scripts.
Assignment operator:
=
Assignment; used only in assignment statements.
See “Assignment Operator” for more
information.
Arithmetic operators:
+
Addition
-
Arithmetic negation (one operand)
-
Subtraction (two operands)
*
Multiplication
/
Division
Relational operators (used in logical expressions):
==
Equal
!=
not equal
>
Greater than
>=
Greater than or equal
<
Less than
<=
Less than or equal
Logical operators:
&&
Logical And
||
Logical Or
&
Bitwise And
|
Bitwise Or
^
Exclusive Or
Separators for expressions:
(
Opening parenthesis
)
Closing parenthesis
23
24
Chapter 2 • Components and Concepts
Assignment and arithmetic operators can be used in assignment statements.
Arithmetic, relational, and logical operators can be used in the logical
expressions for If commands. Parentheses can be used in any expressions;
the part of the expression between the parentheses is evaluated before the
rest of the expression. Otherwise, the order of precedence is: multiplication
and division, addition and subtraction, the relational operators, and the
logical operators. When operators are of equal precedence (such as addition
and subtraction), they are evaluated from left to right.
NOTE: It does not matter whether you put a space before or after an
operator. For example, the pcANYWHERE Editor accepts either of these
formats:
variable=a
variable = a
Assignment Operator
In pcANYWHERE, a single equal sign (=) is an assignment operator, which
assigns the evaluated result of an expression to the specified variable. It
assigns the value on the right side of the equal sign to the variable on the left
side of the equal sign. The following is an example of an assignment
command:
sum = x + y
This means, in English, “Assign the value of the arithmetic expression x + y to
the variable named sum.” As a result, the value of x + y is stored in the
memory location for sum.
If a variable is also a reserved word, you must start the assignment command
with the reserved word Let. (Using reserved words as variables is not
recommended.)
Let echo = "abc"
Assignment statements set variables to either specified or computed values.
The assignment operator can be used with integers as well as with strings.
Unless otherwise noted, you can assign values to the script language
reserved variables. See Appendix A, “Reserved Words and Variables,” for
details.
Examples:
x = 5
$14 = "password"
$Timeout = 10
Chapter 2 • Components and Concepts
Labels
Normally, a script executes from the first line to the last. However, you can
use GoTo and GoSub commands to change that. Each of these commands
can transfer control from the current line to the line that follows a label. A
label is a place marker in a script. The name of a label follows the rules for
the name for a local user-defined variable, except that the first character of a
label can be the at symbol (@) and a reserved word cannot be used as a
label. When a label is used as a place marker in the script, it appears on a
line by itself followed by a colon (:). In this reference guide, to clearly
identify each label as a label, its first character is the at symbol (@).
Here is an example of the use of a label named “@continue”:
String message
message = "Do you want to continue the session?"
MessageBox "Continue" message 35
If ($Result == 6) GoTo @continue
End
@continue:
Type Line "Continuing Processing..."
Capitalization and Spacing
pcANYWHERE doesn’t care whether you type commands and variables using
all lowercase letters, all uppercase letters or a combination of the two. The
language is not case-sensitive.
Likewise, pcANYWHERE isn’t fussy about whether or not you put several
spaces before a parameter or if you insert blank lines between commands.
However, you may want to adopt some of the conventions used in this guide
because they can make your script files easier to read and modify.
NOTE: Capitalization and spacing are important in string literals. For
example, in the Type Line command, the text in the string parameter is
displayed on the user’s screen exactly as it appears in the string literal or
variable used in the command.
25
26
Chapter 2 • Components and Concepts
Using the $Result Reserved Variable
Reserved variables, as discussed earlier, are variables that have special
meaning to pcANYWHERE. They are predefined by pcANYWHERE and
contain, for example, current parameter settings, results of operations, or the
current date and time. Many script language commands modify a particular
reserved variable: $Result. As its name implies, $Result contains the result (in
integer form) of the last command executed.
As an example, after the MessageBox command is executed, $Result contains
an integer value corresponding to the command button the user pressed.
You can make decisions based upon the user’s selection by comparing
$Result to its possible values.
Since many commands alter the contents of $Result, further processing in
your script can overwrite its value. To save the value for later use, assign
$Result to a user-defined variable. See “Making Decisions” later in this
chapter for an example using the $Result reserved variable.
Error Handling
Errors can occur while a script file is running. If the outcome of a command
is an error, an error code may be stored both in $Result and in $Error,
another reserved variable. When $Error is set to a negative value, an error
has occurred. You can test the value of $Result and $Error in your script to
determine what action, if any, should take place. A list of the error values
appears in Appendix B, “Error Messages.”
Making Decisions
The pcANYWHERE script language provides a way to conditionally execute a
command: by using If...Then.
The syntax for this command is:
If expression Then command
The expression following the reserved word If is always a logical expression
that evaluates to either true or false. If the logical expression is true, the
command following the reserved word Then is executed. If the expression is
false, the command is ignored.
An example using If…Then appears below.
Chapter 2 • Components and Concepts
String message
message = "Do you want to transfer a file?"
MessageBox "Transfer File" message 35
response = $Result
If (response == 7) Then Type Line "File transfer not performed."
NOTE: The parentheses around the logical expression in the If...Then
command are used for clarity in this example. However, you can always use
parentheses to let pcANYWHERE know what to evaluate first when you nest
expressions. The double equal signs (==) is the equality operator. If you use
the assignment operator (=) here by mistake, a compile error occurs.
As the script executes the MessageBox command, a message box asks the
user if he or she would like to transfer a file. If the user selects No, $Result
and response become 7.
Using the If…Then command, you compare the value stored in the response
variable to the value 7. Because they are the same, the command after the
reserved word Then is executed and the line “File transfer not performed.”
appears on the screen.
If you want to test for more than one expression, you need two If…Then
commands. For example, in the MessageBox example above, the user has
the option of selecting the Yes, No, or Cancel buttons. If you want to test for
both a Yes and No response, you might use the following commands:
If (response == 6) Then Type Line "Enter the complete
path and filename."
If (response == 6) Then Input filename
If (response == 7) Then Type Line "File transfer not performed."
Having to compare response to the values 6 and 7 is necessary, but having to
evaluate response to the value 6 more than once is unwieldy. If you want to
execute more than one command when an expression is true, use branching.
Branching is explained in the next section.
Branching
The If…GoTo command allows you to redirect the “flow of control” in a
script file. GoTo does exactly what it says—it causes the flow of control to go
to another point in the file. You specify what command you want executed
next by marking the line above it with the same label you use in the
If…GoTo command. A label is simply a destination address, or marker. As
27
28
Chapter 2 • Components and Concepts
with variable names, meaningful label names make your script file more
readable.
The syntax of the GoTo command is:
If expression GoTo label
Here’s an example:
Find First “C:*.DAT”
If ($Result==1) GoTo @found
Type Line “No matching files found.”
GoTo @end
@found:
Type Line “Matching files found.”
@end:
End
NOTE: Once the execution of your script is redirected to a label, it continues
to execute the commands in the script line by line. The execution does not
stop when it comes to a new label. It ignores that label and moves on to the
next command. It stops only when it comes to a command, such as End, that
ends the script’s execution.
The GoTo command can also be independent of the If…Then command.
Simply use GoTo with a label (shown above) to modify the flow of your
script.
Command Summary
The rest of this chapter provides a brief description of each of
pcANYWHERE’s script language commands, organized by the types of tasks
with which they are associated.
For more information about each of these commands, including detailed
descriptions and examples, see Chapter 4, “Script Language Command
Reference.”
Automating Remote Control Sessions
The commands in this section can only be used during unattended remote
control sessions.
Chapter 2 • Components and Concepts
Session Delay [count]
Sets the amount of time (in minutes) to delay before retrying a Session Dial.
Session Dial host_name [time [date]] [script_name]
Begins an unattended remote control session.
Session End
Ends an unattended remote control session.
Session ExitMode Wait | Idle | Accept | Original |
Cancel
Sets the state in which the host PC is left after an unattended remote control
session.
Session OnError Ignore | Next | End
Determines how to proceed when a Session command fails during an
unattended remote control session.
Session Overwrites Always | Never | Older
Determines how to proceed if a file already exists that has the same name as
a file being sent by a SessOpr Host Send or SessOpr Remote Send command.
Session Retry [count]
Sets the number of times to retry a Session Dial command.
Session Timeout seconds
Specifies the timeout for inactivity by the remote PC in an unattended
session.
SessOpr Host Run [Wait | NoWait] command_line
Executes a program on the pcANYWHERE host PC.
SessOpr Host Send filename
Sends a file from the pcANYWHERE host to the remote PC.
SessOpr Remote Run [Wait | NoWait] command_line
Executes a program on the remote PC.
SessOpr Remote Send filename
Sends a file from the remote PC to the pcANYWHERE host PC.
29
30
Chapter 2 • Components and Concepts
Loading or Modifying Configuration Information
The commands in this section provide the hardware or session configuration
needed by pcANYWHERE before making a connection. With the exception
of the Dial Host, Dial Number, and Load HostInfo commands, these
commands can be used only in scripts performing online sessions. Of the
commands mentioned as exceptions, Dial Number can be used for either
remote control or online sessions, and the other two can be used only for
remote control sessions.
Answer
Waits for an incoming call.
Dial Host host_name
Dials a pcANYWHERE host PC.
Dial [Number] number
Dials a telephone number.
Dial OnlSvc online_svc
Dials an online service, such as a BBS.
Emulate terminal_name
Specifies which of the supported terminal types to emulate in Terminal Mode
or when outputting character sequences to the screen from a script.
Load Config hardware_config
Loads a hardware configuration. (This command is not supported in
pcANYWHERE, version 7.0 or higher.)
Load FKeys keyboard_file
Loads a function key file containing programmable function key information
that is in effect only in Terminal Mode (not during script execution).
Load HostInfo host_name
Loads a remote control session configuration.
Load OnlSvcInfo online_svc_name
Loads parameters associated with the specified online service session
configuration.
Load Translation translation_file
Chapter 2 • Components and Concepts
Loads a translation table file that specifies receive and transmit translations.
Set DTR On | Off
Sets the state of the RS-232 DTR signal (for serial communications only).
Set Echo On | Off
Enables or disables echoing of data received during a Wait or Receive
command.
Set Flow RTSCTS | XONXOFF | Both | None
Sets the hardware and software flow controls.
Set Parity None | Even | Odd | Mark | Space
Sets the type of parity (for serial devices only).
Set Port number
Selects the communications port for subsequent Set Speed, Set Parity, or Set
Flow commands.
Set Protocol type
Sets the file-transfer protocol to be used for subsequent Send File and
Receive File commands.
Set Record On | Off
Enables or disables recording of received data to the current recording file.
Set RTS On | Off
Sets the state of the RS-232 Ready to Send signal.
Set Speed rate
Sets the speed of the communications port (for serial connections only).
Set Translation On | Off
Enables or disables the use of a previously loaded translation tables.
Controlling Script Processing
The commands in this section can be used during both remote control and
online sessions. They control what commands are processed, control the
order in which they are processed, and handle exceptions (such as a
disconnection, timeout, or the occurrence of an error).
31
32
Chapter 2 • Components and Concepts
End [return_code]
Ends the current script. If the script was called from another, it can return an
integer value to the calling script.
End Menu
Ends the current script and passes control to the main menu.
End Terminal
Ends all scripts and passes control to terminal mode.
Exit
Ends all scripts and exits pcANYWHERE.
GoSub label
Calls a subroutine within the current script file.
GoTo label
Branches to the line in the script containing the specified label.
Hang
Hangs up the modem or otherwise terminates a connection.
If expression GoTo label
Conditionally branches to a label.
If expression Then statement
Conditionally executes a statement.
Link script_name
Passes control to the script specified in script_name. When the called script
terminates, the calling script file resumes control at the line following the
Link command.
On Cancel [command]
Specifies the command to be executed if the user presses Esc while the script
is processing a Wait or Receive command. If no command is specified, On
Cancel processing is disabled.
On Disconnect [command]
Specifies the command to be executed if a connection is lost. If no command
is supplied, On Disconnect processing is disabled.
Chapter 2 • Components and Concepts
On Error [command]
Specifies the command to be executed if the $Error reserved variable is set to
an error value by another command. If no command is supplied, On Error
processing is disabled.
Return [return_code]
Ends a subroutine. The calling script resumes processing at the line following
the call to the subroutine.
Script script_name
Passes control to the script specified in script_name. When script_name
terminates, the calling script file resumes control at the line following the
Script command.
Set Cancel On | Off
Enables or disables On Cancel processing.
Set Disconnect On | Off
Enables or disables On Disconnect processing.
Terminal
Begins terminal emulation mode. When terminal emulation mode is ended,
the current script resumes processing control with the line following the
Terminal command.
Interacting with User
The commands in this section are primarily for scripts used for or during
online sessions. However, the commands can be used during a remote
control session if the monitor on the host PC is not in graphics mode. The
purpose of these commands is to provide information to or receive input
from the user of the script.
Beep
Causes the remote PC to beep once.
Input data_string [maxlength]
Accepts one line of input from the keyboard.
Input Key character
Accepts one keystroke from the keyboard.
Keyboard Flush
33
34
Chapter 2 • Components and Concepts
Flushes all typed-ahead keyboard characters from the keyboard input buffer.
Use this to make sure you are retrieving only what the user entered in
response to your prompt.
Keyboard Hit [flag]
Tests to see if a key has been pressed, but not yet read.
MessageBox title text [options]
Displays a message box.
Type File filename
Displays the contents of a file.
Type Line string
Displays a string, followed by the contents of the reserved variable
$TLineEnd (which is set, by default, to carriage return/linefeed). This is often
used as a prompt for the user.
Type [String] string
Displays a string. The contents of $TLineEnd are not appended to the string.
Transmitting and Receiving Data
The commands in this section are only for scripts used for or during online
sessions. The purpose of these commands is to transmit and receive data.
Break
Places a break signal on the communication line (for serial devices only).
On Receive string [command]
Specifies the command to be executed if the specified string is received while
processing a Wait or Receive command. If no command is supplied, On
Receive processing is disabled.
On Timeout [command]
Specifies the command to be executed if a timeout occurs while processing a
Wait or Receive command. If no command is supplied, On Timeout
processing is disabled.
Receive Char char [timeout]
Receives a single character from the communications port.
Receive Clear
Chapter 2 • Components and Concepts
Clears the receive buffer.
Receive File [filename]
Receives a file using the current protocol.
Receive Line destination [maxlength [termchar
[timeout]]]
Receives a string from the communications port. The string delimiter is
determined by the reserved variable $RLineEnd or termchar, if specified.
Receive String destination [length] [timeout]
Receives a string from the communications port.
Reset
Resets the terminal emulation on the remote PC.
Send Char char
Sends a single character through the communications port.
Send Clear
Clears the send buffer.
Send File filename
Sends a file using the current protocol.
Send Line string
Sends a string through the communications port, followed by the reserved
variable $SLineEnd (by default, a carriage return).
Send String string [length]
Sends a string through the communications port.
Set CharDelay delay
Sets the default delay (in tenths of seconds) for sending characters.
Set Timeout seconds
Sets the timeout value for Receive and Wait commands.
Wait Carrier [seconds]
Waits for the data carrier detect signal (for serial connections only).
Wait Receive [timeout]
35
36
Chapter 2 • Components and Concepts
Waits for any character to be received.
Wait Silence [seconds]
Waits for the specified number of seconds of silence on the receive
communication line.
Wait String string [seconds]
Waits for the specified string to be received.
Wait [Time] seconds
Waits the specified number of seconds.
Wait Until time [date]
Waits until the specified time (and date, if specified).
Managing Files and Directories
The commands in this section are primarily for scripts used for or during
online sessions. They can be used prior to or after a remote control session,
but the Get and Set commands can only be performed on the remote PC.
Most of these commands are similar to DOS commands. They are used to:
■
Find, manipulate, get information about, or change the attributes of
DOS files
■
Create or remove a directory
■
Switch the current DOS directory
■
Determine the amount of space on the drive
(During a remote control session, you can use the SessOpr Host Run and
SessOpr Remote Run to perform many of the related DOS commands.)
CD pathname
Changes the current directory on the remote PC.
Copy source destination
Copies a DOS file from one location to another on the remote PC.
Del filename
Deletes a file or group of files on the remote PC.
Dir filespec
Chapter 2 • Components and Concepts
Lists all the files in a directory on the remote PC that match the specification.
Find First search_for [match_found]
Searches a remote PC’s drive for the first file that matches the specification
and retrieves its pathname.
Find Next [match_found]
Locates the next matching file after a successful Find First command and
retrieves its pathname.
Get Environment variable value
Retrieves the value of the specified DOS environment variable.
Get File Attr filename [attributes]
Retrieves the specified file’s attributes.
Get File Date filename [date]
Retrieves the date that the specified file was created or last modified.
Get File Size filename [size]
Retrieves the specified file’s size in bytes.
Get File Time filename [time]
Retrieves the time that the specified file was created or last modified.
Get Free Disk drive [freespace]
Determines the amount of space available on a remote PC’s drive.
MD pathname
Creates a new directory on the remote PC.
RD pathname
Removes an existing directory on the remote PC.
Ren old_name new_name
Renames a file or directory on the remote PC.
Set File Attr filename new_attribute
Sets the specified file’s attributes.
Set File Date filename new_date
Sets a file’s date.
37
38
Chapter 2 • Components and Concepts
Set File Size filename new_size
Sets a file’s size.
Set File Time filename new_time
Sets a file’s time.
Reading/Writing To Files
The commands in this section are primarily for scripts used for or during
online sessions. However, the commands can be used prior to or after a
remote control session. The purpose of these commands is to read from and
write to ASCII files.
Create file_number filename [attributes]
Creates and opens an ASCII file for reading or writing.
Open file_number filename [attributes]
Opens an ASCII file for reading or writing.
Close file_number
Closes the file represented by the specified file number.
Read Line file_number data_string[length [termchar]]
Reads a line (or the specified number of characters) from a file into a string
variable. If termchar is not specified, the line is terminated by the $RLineEnd
reserved variable (by default, a carriage return/linefeed).
Read String file_number data_string[length]
Reads a string from a file. The length of the string is determined by the
declared size of the string, or by the value of the length parameter.
Seek file_number offset option
Sets a files read/write pointer. A subsequent read or write operation will
occur at this location.
Write Line file_number data_string
Writes a string to a file, followed by the value of the $TLineEnd reserved
variable (by default, a carriage return/linefeed).
Write String file_number data_string[length]
Writes a string to a file.
Chapter 2 • Components and Concepts
Performing String Operations
The commands in this section are primarily for scripts used for or during
online sessions. However, the commands can be used prior to or after a
remote control session. The purpose of these commands is to manipulate
and test string literals and string variables.
Decrypt string key
Decrypts a string based upon the supplied encryption key string.
Encrypt string key
Encrypts a string based upon the supplied encryption key string.
Index source_str search_str [position]
Locates the position of one string within another.
Lower string
Converts characters in a string to all lowercase.
Set IgnoreCase On | Off
Enables or disables case sensitivity for string comparison operations.
StrCat string1 string2
Appends string2 to the end of string1.
StrCmp string1 string2
Compares two strings.
StrLen source [length]
Counts the characters in a string.
StrSet result_string length character
Assigns a string variable the specified number of the specified character.
SubStr string start length substring
Extracts a portion (called a substring) of a string. You specify the starting
position within the original string and the number of characters to copy.
Trim string
Trims any leading or trailing spaces and control codes from the string.
39
40
Chapter 2 • Components and Concepts
Upper string
Converts characters in a string to all uppercase.
Printing
The commands in this section are primarily for scripts used for or during
online sessions. However, the commands can be used prior to or after a
remote control session. The purpose of these commands is to print
information.
Print File filename
Prints a file to a remote printer from the remote PC.
Print Line string
Prints a string, followed by the value of $TLineEnd (by default, a carriage
return/linefeed).
Print String string
Prints a string.
Printer On | Off
Turns simultaneous printing to the display and printer on or off.
Managing the Display
The commands in this section are for scripts used for or during online
sessions only. The purpose of these commands is to manipulate the contents
of the remote PC’s display buffer and the colors that are displayed.
Clear BOL
Clears the current line from first column up to but not including the current
cursor position (remote PC only).
Clear BOP
Clears the screen from its top-left corner up to but not including the current
cursor position (remote PC only).
Clear EOL
Clears the current line from the current cursor position to the end of the line
(remote PC only).
Chapter 2 • Components and Concepts
Clear EOP
Clears the screen from the current cursor position to the bottom-right corner
of the screen (remote PC only).
Clear Screen
Clears the entire screen and positions the cursor at the top-left corner of the
screen (remote PC only).
Cursor Block
Sets the cursor shape to a full rectangular block. Also used to display a
hidden cursor.
Cursor Down [count]
Moves the cursor down by the specified number of lines or by one line if no
number is specified (remote PC only).
Cursor Home
Moves the cursor to the top-left corner of the screen (remote PC only).
Cursor Left [count]
Moves the cursor to the left by the specified number of columns, or by one
column if no number is specified (remote PC only).
Cursor Line
Sets the cursor shape to a single underscore. Also used to display a hidden
cursor.
Cursor Off
Turns the cursor indicator off.
Cursor Position row column
Moves the cursor to the specified position (remote PC only).
Cursor Restore
Restores the cursor position, type, and video attribute to those saved by the
most recent Cursor Save command (remote PC only).
Cursor Right [count]
Moves the cursor to the right by the specified number of columns, or by one
column if no number is specified (remote PC only).
41
42
Chapter 2 • Components and Concepts
Cursor Save
Saves the current cursor position, type, and video attribute. Can be restored
by the Cursor Restore command (remote PC only).
Cursor Up [count]
Moves the cursor up by the specified number of rows, or by one row if no
number is specified (remote PC only).
Delete Char [count]
Deletes screen characters starting with the character at the current cursor
position. If no number is specified, one character is deleted (remote PC
only).
Delete Line [count]
Deletes screen lines starting at the row in which the cursor is currently
located. If no number is specified, one line is deleted (remote PC only).
Insert Char [count]
Inserts spaces at the current cursor position. If no number is specified, one
space is inserted.
Insert Line [count]
Inserts lines at the row above the line on which the cursor is currently
located. If no number is specified, one line is inserted.
Screen Restore
Restores a screen image previously saved with a Screen Save command.
Screen Save
Saves the contents of the screen so that it can be restored with a Screen
Restore command.
Set Attribute attribute
Sets the screen attributes for subsequent characters output to the screen.
Set Palette number attribute
Sets the screen palette attributes for subsequent characters output to the
screen. This command is used only by pcANYWHERE for DOS scripts.
Set Quiet On | Off
Enables or disables suppression of display of command processing on the
screen.
Chapter 2 • Components and Concepts
Miscellaneous Commands
The Description and Let commands can be used during both remote control
and online sessions. The Run command can be used only in scripts that
perform online sessions.
Description
Adds a brief description to the script file.
[Let] variable = expression
Sets variable equal to the result of the expression. This is an assignment
statement and the way to perform arithmetic operations.
Run command_line
Executes a DOS or Windows command line on the remote PC.
43
THIS PAGE LEFT BLANK INTENTIONALLY
Managing Scripts in
pcANYWHERE for
Windows
3
pcANYWHERE for Windows allows you to create, compile, and run scripts
from within pcANYWHERE for Windows. Although a script file is an ASCII
text file and can be created or modified in any text editor, the pcANYWHERE
Editor, described in detail in this chapter, offers a number of other features
specifically designed to work with pcANYWHERE scripts. For example, it
provides an online Reference box that contains a description of each
command.
Creating, Compiling, and Running Scripts
The Scripts dialog box makes it easy to create, compile, test, and run scripts
from within pcANYWHERE for Windows.
To display the Scripts dialog box:
■
Choose SCRIPTS… from the pcANYWHERE Utilities menu.
The Scripts dialog box appears (Figure 3-1).
Figure 3-1
From the Scripts dialog box, you can create a new script, or
edit, compile, or run an existing script.
46
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
The Scripts list box contains a list of all the currently defined scripts. For each
compiled script that contains a Description command, the list box displays
the script’s description. Directly beneath the list box is the Script Path text
box. If your script files are located in a directory other than the one
displayed, you can change directories by clicking Browse....
After highlighting a file in the list box, simply click Edit..., Compile..., or
Run... to perform that function on the selected script.
Creating and Editing Scripts
You use the commands on the pcANYWHERE Editor File menu to create
new script files and modify existing scripts. If you want to create a new script
that is similar to an existing one, you can use the existing script as the basis
for the new one.
The pcANYWHERE Editor uses standard Windows methods for creating new
files, opening existing files, and assigning names to files. If you are familiar
with these methods, you can skip this section and go on to the next section,
“Using the Online Reference.”
To create a new script file:
1
Click New… in the Scripts main window.
The pcANYWHERE Editor editing window appears
(Figure 3-2).
Figure 3-2
The pcANYWHERE Editor includes an editing window for
creating and modifying script files.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
2
Make sure you are currently in an untitled editing window.
If you are, your screen should look like Figure 3-2. If you have a file
open, its filename appears in the pcANYWHERE Editor title bar and its
text in the editing window. In this case, choose NEW from the File
menu to open an untitled window.
3
Simply start typing pcANYWHERE script language statements in the
editing window.
The rules for entering script file lines (called syntax) are covered in
Chapter 2, “Components and Concepts.” The syntax for each command
is in Chapter 4, “Script Language Command Reference.”
Use the standard Windows mouse and/or keyboard methods to enter
lines of text, select and/or change existing text, and move around
within the script file. In addition, Table 3-1 shows the commands on
the Edit menu that can help you prepare your script file text.
Table 3-1
The pcANYWHERE Editor Edit menu includes commands to
help you edit your script file.
Command
Shortcut Key
Explanation
Undo
Alt+Backspace
Returns text to its state before the
previous operation was performed
Cut
Shift+Del
Deletes selected text and places it in
the Windows Clipboard
Copy
Ctrl+Insert
Copies selected text to the Clipboard
Paste
Shift+Insert
Copies the Clipboard contents to the
location of the insertion point
Delete
Del
Deletes selected text; does not place
it in the Clipboard
Select All
N/A
Selects all text in the script file
Time/Date
N/A
Inserts the current date and time at
the cursor location
Word Wrap
N/A
Automatically wraps one line to the
next. Do not use this feature inside a
script because a statement must
appear on only one line.
47
48
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Table 3-1
The pcANYWHERE Editor Edit menu includes commands to
help you edit your script file. (continued)
Command
Shortcut Key
Explanation
Wrap
Paragraph
N/A
Wraps the paragraph in which the
cursor appears. Do not use this
feature inside a script because a
statement must appear on only one
line.
4
When you are finished entering text, choose SAVE AS… from the File
menu.
The Save As dialog box appears (Figure 3-3).
Figure 3-3
5
Use the Save As dialog box to assign a name to a new
script file.
In the File Name text box, type the filename you want assigned to
the script file. Be sure to use the file extension .SCR. The
pcANYWHERE Editor does not include your file in the Scripts list
box unless the .SCR extension is specified.
If you want to store the script file in a directory other than the current
one, you can use the directory and drive list boxes to specify the
desired directory.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
TIP: If you are creating a fairly long script file, use the SAVE AS…
command to assign the filename while you are still working on the
file. Then save the file from time to time by choosing SAVE from the
File menu. These methods keep you from losing your work in the
event of a power failure or any other problem that causes the
pcANYWHERE Editor to close prematurely.
To edit an existing script file:
1
Select the file to edit from the Scripts list box.
2
Click Edit….
The pcANYWHERE Editor main window appears with the contents of
the selected file loaded in the editing window.
3
Edit the script file.
4
Choose SAVE from the File menu to save your changes.
The Save command saves the file under its current name.
To create a new script from an existing one:
1
Select the file you are using as the basis for the new script from the
Scripts list box.
2
Click Edit….
The pcANYWHERE Editor main window appears with the contents of
the selected file loaded in the editing window.
3
Choose SAVE AS… from the File menu.
The Save As dialog box appears (Figure 3-3).
4
Type the filename you want assigned to your new script file in the
File Name text box. Be sure to use an extension of .SCR.
You now have a new copy of the original script file and can make
changes to this new file without affecting the original.
5
Enter the desired changes to the lines in this new script file.
6
Choose SAVE from the File menu to save the new file under its new
name.
To close the pcANYWHERE Editor window:
■
Choose EXIT from the File menu.
49
50
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
If you didn’t save any files you created or edited during this session, the
pcANYWHERE Editor first displays a dialog box asking if you want to save
your work before exiting.
TIP: While you’re working on a script file, rather than closing the
pcANYWHERE Editor, just minimize it. That way, you can compile and run
your script file to test it, then easily restore the editor’s window to correct
problems with your script or make refinements to it.
Using the Online Reference
While you’re creating or editing a script file, you can display all the script
language commands. You can even have the pcANYWHERE Editor insert a
command into your script (instead of typing it yourself). The Reference
dialog box provides these capabilities.
To open the Reference Dialog Box:
■
Choose REFERENCE from the Tools menu.
The Reference dialog box (Figure 3-4) appears. This dialog box includes a list
box containing every pcANYWHERE script language command. Beside the
list box, information about the currently highlighted command appears.
You can move this dialog box to any location on your screen so that you can
refer to it throughout your editing session. You can also use this dialog box
to add a line to your script file, or to replace a script file command with a
different one.
Figure 3-4
The Reference dialog box lets you insert a command in your
script file by double-clicking on that command in the list box
or by clicking Add.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
To add a command to your script file:
1
In the script file, position the cursor at the location where you want
the command added.
2
In the Reference dialog box, double-click the command that you
want inserted in your script.
The selected command appears at the insertion point.
To replace a script command:
1
In the script file, highlight the command and parameters that you
want replaced.
2
In the Reference dialog box, double-click the command that you
want inserted in your script.
Creating Commands with the Assist Dialog Box
In addition to providing an online command reference, the Assist dialog box
(accessed from the Reference dialog box) helps you create a command or
group of related commands by filling in options and clicking OK. The
pcANYWHERE Editor takes the information you entered in the dialog box
and generates commands for the script. This is much easier than typing and
compiling those commands in the editor. When you reference a command,
you can use the Assist dialog box to automatically create one or more
commands if the Assist… button is enabled.
The example in this section shows how to use the Assist dialog box while
creating an unattended remote control session. An unattended session occurs
when a remote PC connects with a host PC that has been configured to
expect and handle unattended requests. For example, if you download
weekly sales figures from your office PC to your home PC, you can create a
script using the Assist dialog box that automatically calls the sales office and
downloads the specified file at the same time each week.
The Assist dialog box prompts you for the parameters that pcANYWHERE
sets before initiating an unattended session. You can use the defaults
provided or select custom options, based on the procedure you are
automating. The pcANYWHERE Editor uses the selected options to generate
commands with the correct parameters for an unattended session that:
■
Logs onto a host PC at a specified date and time.
■
Logs off of the host PC, leaving it in whatever state you specify.
51
52
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
A comment even shows you where to insert the commands that perform the
procedure you want done automatically. For example, if you are
downloading a single file, you specify the command that transfers the file.
Then you can compile and run the script.
To create a session script:
1
If you are adding Session commands to an existing script, open the
desired script. If you are creating a new script, choose NEW from the
File menu.
2
Position the cursor at the location where you want the Session
commands added.
3
If the Reference dialog box is not already displayed, choose
REFERENCE from the Tools menu.
The Reference dialog box appears.
4
Select Session Dial from the list box on the left.
5
Click Assist.
The Session Dial dialog box appears (Figure 3-5).
Figure 3-5
You can use the Session Dial dialog box to automatically
create the outline for scripts used during unattended
sessions.
Each of the options in the Assist dialog box corresponds to a Session
command. By entering values for each of the dialog box controls,
pcANYWHERE outlines your session and produces correctly formatted
lines of code. The controls, the items they affect, and the Session
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
command that corresponds to each are described immediately
following this procedure. For complete details on each of the Session
commands and their parameters, see Chapter 4, “Script Language
Command Reference.”
6
Once you are satisfied with your selections, click OK.
The dialog box closes and the formatted Session commands are
inserted into the script at the current cursor position (Figure 3-6).
Figure 3-6
The Assist dialog box automatically inserts correctly formatted
Session commands in your script file.
Host to Call
Click the prompt button to select the name of the host you want to connect
to during the session. The drop-down list box contains the same set of names
as those in the Host PC Directory. For example, choosing Carol’s Office PC
from the list box generates the command:
Session Dial “Carol’s Office PC”
Cancel Host After Session
Check this check box to disable the host TSR when your session is complete.
If this box is checked, the following command is generated:
Session ExitMode Cancel
53
54
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Call Immediately
Check this check box if you want the call to be made as soon as the script is
executed. You can also specify a date and time at which the call is to be
made. If this box is unchecked, then the Time to Call and Date to Call text
boxes are enabled.
Time to Call
Enter the time you want pcANYWHERE to dial the host. The format is
military time (24-hour clock). If you specify a time, you must also specify a
date in the Date to Call text box. For example, specifying a time of 10:00 P.M.
on June 30, 1994 generates the command:
Session Dial “Carol’s Office PC” 2200 940630
Date to Call
Enter the date you want pcANYWHERE to dial the host. The format is
YYMMDD. If you specify a date, you must also specify a time in the Time to
Call text box.
Retries
Enter the number of times you want pcANYWHERE to redial the host. An
entry of 3 generates the command:
Session Retry 3
Time Between Retries
Enter the number of minutes that elapse between retries to dial the host. An
entry of 10 generates the command:
Session Delay 10
If Error Occurs
Click the prompt button to select the action to perform if an error should
occur during the unattended session. You can select from:
END: Ends the script and returns control to pcANYWHERE.
IGNORE: Ignores the command which caused the error and advances to the
next command.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
NEXT: Advances to the matching Session End command and continues
processing from that point on in the script.
For example, selecting END generates the following command:
Session OnError End
File Transfer Overwrites
Click the prompt button to select the action to perform when the filename
parameter in a SessOpr Host Send or SessOpr Remote Send command is the
same as a filename at the destination. You can select from:
ALWAYS: Causes the file at the destination to be overwritten.
NEVER: Causes the file sent to be ignored.
OLDER: Causes the file at the destination to be overwritten if the file being
transferred is more recent (compares date/time stamp).
For example, selecting Older generates the command:
Session Overwrites Older
Error Time Out
Enter the time (in seconds) of the remote’s inactivity timeout for unattended
sessions. For example, entering 30 generates the command:
Session Timeout 30
Completing the Script
Once you have the session outlined, complete the script by specifying the
action to occur after the connection has been made. These commands should
be inserted into your script at the line COMMENT: ** insert SessOpr here
**. If you are using your script for unattended file transfers or to launch an
application on the host computer, be sure to use the correct SessOpr
commands. The corresponding “regular” commands (such as Send File) in
the script language are unavailable for unattended sessions and return an
error when used. For a complete discussion of the SessOpr commands and
their syntax, see Chapter 4, “Script Language Command Reference.”
55
56
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Printing a Script
You can use the pcANYWHERE Editor to print a script file using any printer
you’ve set up.
To select a printer:
1
Choose PRINTER SETUP… from the File menu.
The Printer Setup dialog box appears.
2
Use the Printer Setup dialog box to specify the printer you want to
use.
To print a script:
■
Choose PRINT from the File menu.
Your script file is sent to the default printer.
Compiling and Running Scripts
Once you have finished writing your script, you need to compile it and check
for syntax errors. Compilation is the process of converting a high-level source
script file (.SCR) into a low-level set of commands (.SCX) that your computer
can execute, or run. pcANYWHERE also checks for syntax errors while your
script is being compiled.
If you have a relatively short script, you may want to skip the compilation
and just run your script. In this case, pcANYWHERE checks the date and time
stamp on the .SCR and .SCX files (if one exists) to see if the source script file
has changed since the last time it was compiled. If so, pcANYWHERE
automatically compiles the script before attempting to run it and notifies you
if there are any errors.
If your script compiles without errors, pcANYWHERE creates an executable
version of your script which can be launched from several places within
pcANYWHERE.
Compiling a Script
Compiling your script before you run it doesn’t help you find errors in your
logic, but it does flag every line where you may have made a syntax error,
like forgetting a semicolon before your comment or not declaring a variable
before using it in the script. Maybe you forgot to enclose a string in quotation
marks, or specified the wrong number of parameters.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
When pcANYWHERE finds syntax errors, it displays a message box notifying
you that your .SCR file contains errors and asks you if you want to edit the
file. These errors are written to a file with the same filename and the
extension .ERR. You can use the pcANYWHERE Editor to view the .ERR file,
make corrections to the script and attempt compilation again.
To compile a script:
1
Select a script file from the Scripts list box.
2
Click Compile….
If your script file compiles without errors, pcANYWHERE places the
executable file in the same directory as the .SCR file. Your executable
file has the same name as your script file, but with the extension .SCX.
A successful (error-free) compile means that your script is now ready to
run.
If your script file contains errors, pcANYWHERE displays the message
shown in Figure 3-7.
Figure 3-7
pcANYWHERE notifies you when syntax errors appear
in your script file.
pcANYWHERE loads both the script file and its error file into editing
windows when you click Yes.
Correcting Errors
If you have syntax errors, click Yes when prompted to launch the
pcANYWHERE Editor and load your source file and its .ERR file. Then, using
the line numbers provided in the .ERR file, locate each of your errors and
make the necessary corrections. Line numbers are displayed at the bottomleft corner of the editing window.
For a complete listing of syntax errors and possible causes, see Appendix B,
“Error Messages.”
57
58
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
To correct errors in your script file:
1
Choose TILE from the Window menu to place the editing windows
containing the script file and .ERR file side by side. You might also
want to maximize the editing windows in order to display more of
the contents of each file.
Each error in the script file is listed individually by line number,
followed by a short description of the error.
Remember, the current line’s number appears at the bottom of your
document window. Use this to help locate the line containing the error.
TIP: To jump directly to the line in your script file containing the
error, click the editing window that contains your script and choose
GOTO LINE… from the Search menu. Enter a line number in the Goto
Line dialog box and click OK.
2
Make the necessary changes to your script file, then choose SAVE
from the File menu.
You’re ready to recompile your script file.
Running a Script
Within pcANYWHERE, you can run a script using the following methods:
■
Choose SCRIPTS… from the Utilities menu, select a file from the
Scripts list box and click Run…. You can use this method to “test”
your script without first having to make a connection.
■
Specify the name of the script file to execute automatically upon
connection with a host or an online service. The name of the script
file is specified in the Advanced Host Options dialog box or the
Advanced Settings for Online Service dialog box.
■
When connected to an online service, choose SCRIPTS… from the File
menu. Select a file from the Scripts list box and click Run….
■
When connected to a pcANYWHERE host, choose SCRIPTS… from
the Online menu, select a file from the Scripts list box and click
Run….
For details on launching a script using any of the methods listed above, see
the pcANYWHERE User’s Guide.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Other Editor Features
The next few sections explain other features of the pcANYWHERE Editor that
you may want to use, such as recording macros, searching and replacing text,
setting preferences, and customizing the keyboard.
Recording and Playing Macros
The pcANYWHERE Editor provides a simple keyboard macro facility to
automate repetitive editing tasks. You can record a series of keystrokes and
then play the sequence back as often as you like during that editing session.
Note the following limitations on macros:
■
Only one macro can be stored at a time.
■
Macros are limited to 256 events (keystrokes and menu selections). If
this limit is reached, the macro definition is terminated automatically.
■
Macros do not work inside dialog boxes.
■
The macro is deleted when you exit the pcANYWHERE Editor.
You can use the recorded macro in any open window. To change the macro,
simply record the new keystrokes. REC appears on the status line while you
are recording a macro.
To record a macro:
1
Choose RECORD MACRO from the Edit menu (F7).
2
Type the keystrokes and execute the mouse functions in the order in
which you want to record them.
To stop recording:
■
Choose STOP RECORDING MACRO from the Edit menu (F7).
To play back the recorded macro:
■
Choose PLAY BACK MACRO from the Edit menu (F8).
Searching and Replacing Text
The search and replace features let you find specified character strings in a
file, and optionally replace them. The pcANYWHERE Editor’s special search
features include:
■
Searching forward or backward to find or find and replace text.
59
60
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
■
Searching for special characters (such as tabs) and blank lines.
■
Searching for ranges of characters.
■
Using wildcards to search for multiple strings at one time.
■
Specifying case-sensitive searches.
■
Searching multiple files for the same string in a single operation.
As a special time-saving feature, the pcANYWHERE Editor remembers your
previous search strings so you can use them again without retyping. You can
use the keystrokes listed in Table 3-2 to perform search and replace functions
quickly.
Table 3-2
Search-and-Replace Keystrokes
Action
Keyboard
Start a search operation.
Press Ctrl+S.
Start a search-and-replace operation.
Press Ctrl+R.
Find the next occurrence of the search
string.
Press Ctrl+A.
Find all files containing a specific search Press Ctrl+F.
string.
Review the list of files containing the
search string.
Press Ctrl+L.
Find (go to) a specific line in your file.
Press Ctrl+G.
Specifying the Search Pattern
When you use any of the search commands (FIND…, REPLACE…, or FIND FILES
CONTAINING…), you must specify the character string you want to find. The
pcANYWHERE Editor remembers your previous ten search patterns, so you
can easily repeat an earlier search. Search patterns can contain embedded
spaces.
To specify a search pattern:
■
Select the text in your current document, then select the command to
start your search.
Or,
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
■
Select the appropriate search command, then type the search string
in the Pattern text box or choose a previous pattern.
By default, the pcANYWHERE Editor treats your search string literally—it
looks for character strings that match your entry exactly.
The Regular Expression option lets you perform nonliteral searches by
embedding special characters in your search patterns. (Literal searches are
faster than searches that use regular expressions.) Some of these characters
operate as wildcards; others let you search for ranges of characters or special
characters, such as tabs. The Regular Expression option is available when
you use any of the search commands (FIND…, REPLACE…, or FIND FILES
CONTAINING…).
Table 3-3 describes the characters that take on special meanings if you select
the Regular Expression option. If the option is not selected, these characters
are treated literally. For example, a search pattern of be? with Regular
Expression enabled finds strings such as bed, bee, and beg. If the option is
disabled, only the string be? would be found.
To define a search using regular expressions:
1
Use one or more of the special characters shown in Table 3-3 when
you enter your search pattern in the Pattern text box.
2
Check the Regular Expression check box.
Table 3-3
Wildcards for Regular Expression
Character
Effect in a Search
?
Matches any single character.
*
Matches zero or more occurrences of any
character.
@
Matches zero or more occurrences of the
previous character or expression.
% or <
Matches the beginning of a line.
$ or >
Matches the end of a line.
% $ or < >
Matches a blank line.
61
62
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Table 3-3
Wildcards for Regular Expression (continued)
Character
Effect in a Search
[chars ]
Matches any of the characters listed between the
brackets. Use a hyphen (-) to specify a range of
characters. Examples: [abc] matches a, b, or c; [az] matches any lowercase letter; [A-Za-z] matches
any upper- or lowercase letter.
[~chars ]
Matches any character except those listed. Use a
hyphen (-) to specify a range of characters.
Examples: [~A] matches any character except A;
[~abc] matches any character except a, b, or c;
[~A-Za-z] matches any nonalphabetic character.
\
Escape character indicating that the next
character should be taken literally rather than as
a wildcard. The escape character is required
only if you use the Regular Expression option.
Examples: \* searches for an asterisk; \\
searches for a backslash.
\t
Matches a tab character.
\f
Matches a form feed character.
Searching for Character Strings
The FIND… and FIND AGAIN commands search for character strings in your
current file. Use FIND… to find either the next or the previous occurrence of
a search pattern. Use FIND AGAIN to repeat the last search, using the same
pattern, direction and options.
The search begins at the cursor and ends at the end of the document (or the
beginning of the document if you’re searching backward). The search is
conducted line-by-line; patterns that span line boundaries are not found.
To search for a character string in a file:
1
Choose FIND… from the Search menu (Ctrl+S).
The Find dialog box appears (Figure 3-8).
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Figure 3-8
Match text exactly or use regular expressions.
2
Enter the character string in the Pattern combination box or select it
from the list of previously specified strings.
3
To perform a case-sensitive search, click the Match Upper/Lowercase
check box.
4
To use a regular expression in your search, check the Regular
Expression check box.
5
Click Next to search forward from the cursor, or click Previous to
search backward.
To find another occurrence of the same string:
■
Choose FIND AGAIN from the Search menu (Ctrl+A).
Replacing Text
The REPLACE… command lets you substitute one character string for another
wherever it is found in your file. You specify the search pattern and the new
pattern you wish to substitute. By default, you are prompted for confirmation
before each substitution is made. You can disable this option to make a
global replacement.
The replace operation always starts from your cursor and moves forward. If
you want to search the entire file, make sure you move the cursor to the
beginning of the file before you start. When the search and replace is
completed, the status line reports the number of changes made.
To replace a character string:
1
Choose REPLACE… from the Search menu (Ctrl+R).
The Replace dialog box appears (Figure 3-9).
63
64
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Figure 3-9
Replace one character string with another.
2
Type the text you want to find in the Search For combination box or
select it from the list of previously specified strings.
3
Enter the text you want to substitute in the Replace With
combination box or select it from the list of previously specified
strings.
4
If you do not want to confirm each change, uncheck the Confirm
Changes check box.
5
To perform a case-sensitive search, click the Match Upper/Lowercase
check box.
6
To use a regular expression in your search, check the Regular
Expression check box.
7
Click OK.
Searching Multiple Files
The FIND FILES CONTAINING… command lets you look for a pattern in multiple
files at the same time. The files do not have to be open.
You specify the files you want to search, using wildcards or by entering
multiple filenames separated by spaces. For example, the following entry
specifies all .TXT files, the TEST.BAT file, and all files whose names start with
Q1:
*.TXT TEST.BAT Q1*.*
The pcANYWHERE Editor builds a list of the files that contain the search
pattern. The search is conducted line-by-line, so patterns that span line
boundaries are not found.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
To find all files with a given character string:
1
Choose FIND FILES CONTAINING… from the Search menu (Ctrl+F).
The Find Files Containing dialog box appears (Figure 3-10).
Figure 3-10
You can search multiple files for a character string.
2
Enter the character string to search for in the Pattern combination
box or select it from the list of previously specified strings.
3
The Directory text field displays the drive and directory to be
searched. If the Directory you want to search is not the one
identified in the dialog box, click Directory and select the proper
directory.
4
Enter the name(s) of the file(s) you want to search in the Files
combination box or select it from the list of previously specified files.
5
Click OK.
When the search is completed, the List Found Files dialog box appears
(Figure 3-11). It lists the files (with the names you specified) that contain the
search pattern. You can select a file from the list and edit or review it.
When you open a file from the List Found Files dialog box, its name is
removed from the list. This helps you work your way through all of the files.
The list of unselected files is retained until you exit the Editor or use Find
Files Containing… again.
65
66
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Figure 3-11
Select a file to edit from one of those found during the search.
To select a file to edit or review:
1
If the List Found Files dialog box is not displayed, choose LIST
FOUND FILES from the Search menu (Ctrl+L).
2
Select the file you want to review from the Files list box.
3
Click Open.
The file appears in a pcANYWHERE Editor document window. The first
occurrence of the character string you searched for is selected.
4
Edit or review the file, as appropriate. To move to the next
occurrence of the search pattern, choose FIND AGAIN from the Search
menu (Ctrl+A).
5
To work with another file that contains the search pattern, repeat
steps 1 through 4. This file no longer appears in the Files list box in
the List Found Files dialog box. If the List Found Files command is
dimmed, you have selected all of the files.
Finding a Specific Line
You can jump quickly to any line in your current file. If you specify a line
number higher than the last line in the file, you move to the beginning of the
last line.
To go to a specific line in your file:
1
Choose GOTO LINE… from the Search menu (Ctrl+G).
The Goto Line dialog box appears.
2
Enter the number of the line to which you want to move.
3
Click OK.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Setting Document Preferences
Using the Document Preferences category, you can set various formatting
options, such as word wrap and tab spacing. You can change the settings for
your current document only, or you can specify that the changes are to be
used for all documents and in all future editing sessions.
To change the document preferences:
1
Choose DOCUMENT PREFERENCES… from the Options menu.
The Document Preferences dialog box appears (Figure 3-12).
Figure 3-12
Select your document preferences.
2
Set each option according to your preferences, as described in the
following sections.
3
If you want these settings to be the default for all subsequent
documents, check the Save As Default Settings check box.
4
Click OK.
Tab Spacing
Enter the number of characters (1 through 16) that you want between tab
stops. The default is 8.
Right Margin
Enter the rightmost column (32 through 512) that can contain a character.
The default is 65. This value is used only if you use the Wrap Text As It Is
Typed option.
67
68
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Wrap Text As It Is Typed
Do not use this word-wrap option when writing scripts. Each statement in a
script must appear on only one line regardless of the margins.
This option makes the pcANYWHERE Editor end lines automatically when
the right margin is reached. If the last word on the line doesn’t fit, it is moved
to the next line. By default, lines are ended only when you press Enter.
Auto Indent
Check this option if you want Enter to move the cursor to the next line
directly under the first nonblank character on the preceding line. By default,
pressing Enter moves the cursor to column 1 of the next line.
Expand Tabs with Spaces
Check this option if you want the number of characters specified for a tab
inserted into your file instead of a Tab character when you press a Tab
character. By default, pressing Tab inserts a Tab character.
Save as Default Settings
Check this option if you want the changes you made to tab spacing, margin
size, and word wrapping in the Document Preferences dialog box to affect
all files and all future edit sessions. By default, the changes affect the current
file only.
Setting Editor Preferences
The Editor Preferences… command lets you control how the pcANYWHERE
Editor manages the files you edit. Using this option, you can configure the
Autosave and back up file options, set the number of Undo levels, and
control the appearance of the cursor. The changes you make here apply to
all document windows and all Editor sessions.
To change the Editor preferences:
1
Choose EDITOR PREFERENCES… from the Options menu.
The Editor Preferences dialog box appears (Figure 3-13).
2
Set each option according to your preferences, as described in the
following sections.
3
Click OK.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Figure 3-13
Select your editing preferences.
Font
By default, the Editor displays characters in System Fixed Font, the font used
by Windows for menus, dialog box components, and so forth. You can
change this to ANSI Fixed Font or OEM Fixed Font (which are specified in
the [boot] section of your SYSTEM.INI file as FIXEDFON.FON and
OEMFONTS.FON, respectively).
Cursor
By default, the cursor that marks your typing position is a blinking vertical
bar. Use this section if you prefer a rectangular cursor (Block) or an
underscore (Underline). If you want a steady cursor, uncheck the Blinking
check box.
Autosave
The Autosave feature saves your open files at predefined intervals based on
time, activity, or both. By default, Autosave is disabled. To save your files on
a time basis, enter the number of minutes between saves in the first Autosave
field. To save your files on an activity basis, enter the number of changes
between saves in the second Autosave field. To disable either Autosave
method, enter 0. To disable the Autosave feature entirely, set both fields to 0.
69
70
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Undo Levels
Enter the number of operations (1 through 300) for which Undo information
is to be stored for each open buffer. Enter 0 to disable the Undo feature. The
default is 100. Increasing this setting increases the amount of memory the
Editor uses for the Undo feature. At any given time, the exact amount of
memory required to store Undo information for a buffer depends on the mix
of operations you’ve performed.
Restore Session
Check this option if you would like the files that were loaded when the last
session was ended to be reloaded the next time the Editor is run. This saves
you time if you tend to work on the same files from session to session. By
default, the Editor does not load any files at start-up.
Typing Replaces Selection
If you select text and then start typing, your newly typed characters replace
the selected text. If you would rather have your new characters inserted in
front of the selected text (leaving the selected text as is), uncheck this check
box.
Make Backup Files
By default, the Editor automatically creates a backup file (extension .BAK)
each time you save a file. You can use these .BAK files to recover your old
file if you save changes by mistake. If you do not want automatic backup
files, uncheck this check box.
File Locking
By default, the files the Editor is using are accessible by other applications. If
you prefer to lock the files against shared use, check the File Locking check
box. To use this feature, SHARE.EXE must be loaded before starting
Windows. If you use file locking, the number of open files is limited to 35.
Cut/Copy Current Line if No Text is Selected
By default, using the cut or copy feature when no text is selected has no
effect. Check this check box if you want to cut or copy the current line when
no text is selected.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
Remove Trailing Spaces
Check this option if you want the Editor to delete any spaces and tabs after
the last nonblank character on a line when a file is loaded. By default, the
Editor retains these spaces and tabs.
Customizing the Keyboard
You can customize your keyboard to perform complex operations with a
single key combination, or simply to make the pcANYWHERE Editor
keystrokes more like a text editor that you already know. More than 100
pcANYWHERE Editor functions are available for assignment.
NOTE: For a complete list of pcANYWHERE Editor key functions, refer to
Function list box in the Key Assignment dialog box (Figure 3-14).
To assign a function to a keystroke:
1
Choose KEY ASSIGNMENTS… from the Options menu.
The Key Assignments dialog box appears (Figure 3-14).
Figure 3-14
2
Select your keystroke preferences.
Scroll through the Function list box and highlight the function you
want to assign.
The name now appears in the Function text box. If it is already
assigned to a keystroke, the key names appear in the Current Keys list
box. If no key is assigned, the box is empty.
71
72
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
NOTE: You can assign a function to more than one keystroke. For
example, both Ctrl+C and Ctrl+Insert can copy text from the
Clipboard.
3
Scroll through the Key list box until you find the keystroke you want
to use.
If the key is already being used for some other function, the function
name appears in the Current Function list box. If no function is
assigned to that keystroke, the box stays empty.
NOTE: You cannot assign a keystroke to more than one function.
For example, the Ctrl+C can only copy text from the Clipboard.
4
Click Assign to make the assignment.
5
Click Save to make the change permanent. Otherwise, your key
assignment lasts only for this session.
6
Click OK.
To change a keystroke assignment:
1
Choose KEY ASSIGNMENTS… from the Options menu.
The Key Assignments dialog box appears.
2
Scroll through the Key list box until you find the keystroke you want
to reassign.
The function name currently assigned to the keystroke appears in the
Current Function list box.
3
Use the Function list box to highlight a different pcANYWHERE
Editor function.
4
Click Assign.
5
Click Save to make the change permanent. Otherwise, your key
assignment lasts only for this session.
6
Click OK.
To delete a keystroke assignment:
1
Choose KEY ASSIGNMENTS… from the Options menu.
The Key Assignments dialog box appears.
2
Find the key/function combination in the Key and Function list
boxes.
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
3
Click Unassign.
4
Click Save to make the change permanent. Otherwise, your key
assignments last only for this session.
5
Click OK.
Using Menu Bar Accelerators
The menu accelerator keys (the combination of Alt plus the underlined
character in a menu name) can be used to open menu. For example, if
accelerators are enabled, Alt+F opens the File menu. When the menu
accelerator keys are disabled, Alt+F can be assigned to a function in the Key
Assignments dialog box.
Disabling the accelerator keys does not prevent you from accessing the menu
items by pressing Alt to access the menu bar and then using the arrow keys
to move to the desired item. You can also use the mouse.
To disable menu bar accelerators:
1
In the Key Assignments dialog box (see Figure 3-14), uncheck the
Enable Menu Accelerators check box.
2
Click OK.
Using Keyboard Configurations Files
A keyboard configuration file stores all key assignments. You can create
keyboard configuration files that contain special keyboard configurations.
For example, you can use one set of key assignments when editing scripts
and another set when editing documents. People who share a workstation
can store their key preferences in separate files. For convenience in loading
your keyboard configuration files later, use the file extension .KEY when
naming the files.
When you start the pcANYWHERE Editor, it always loads the last keyboard
configuration file you loaded or saved.
To load an existing keyboard configuration file:
1
In the Key Assignments dialog box (see Figure 3-14), type the name
of a keyboard configuration file in the Keyboard Configuration File
text box.
2
Click Load.
73
74
Chapter 3 • Managing Scripts in pcANYWHERE for Windows
3
Click OK.
To create a new keyboard configuration file:
1
In the Key Assignments dialog box (see Figure 3-14), modify the key
assignments, as necessary.
2
In the Keyboard Configuration File text box, type a name for the
new file.
3
Click Save.
4
Click OK.
Script Language
Command Reference
4
This chapter is an alphabetical reference to pcANYWHERE’s script
commands. The entry for each command includes its syntax,
description, and parameters, the changes it makes to reserved variables
(such as $Result and $Error), an example of its use, and a “See Also”
section that lists any related commands. For information about the
general syntax of script language commands, see Chapter 2,
“Components and Concepts.” This chapter assumes that you have at
least skimmed through the first two chapters.
Most of the commands in the script language are designed for use in
scripts that perform online sessions. A few are designed exclusively for
use in scripts that perform remote control sessions. Some commands,
such as those that control how the script is executed, can be used in
either type of script. In this chapter, the icon next to each command’s
name indicates which type of script is appropriate for the command.
When the command can be used in either type of script, both icons are
used. Some of the commands designed for online sessions can be used
in scripts written for remote control sessions so long as the commands
are not executed during the remote control session. The only icon next
to these commands is the icon for online sessions; information about
the use of the command in scripts for remote control sessions is
included as part of each command’s description. Figure 4-1 shows both
icons.
Figure 4-15 Remote Control and Online Session Icons
Remote control icon
Online session icon
76
Chapter 4 • Script Language Command Reference
Answer
Description:
This command works for all device types. Use it to wait for an incoming
call. The command terminates when a connection is made or when the
user presses Esc.
Syntax:
Answer
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example loads a hardware configuration and waits for a
call.
Load Config "COM1: Hayes modem"
Answer
See Also:
Break, Dial Host, Dial Number, Dial OnlSvc, Hang
Beep
Description:
Use this command to sound an audible alarm on the remote PC. This
command can be used in scripts that perform remote control sessions so
long as the command is not executed during the remote control session.
Syntax:
Beep
Reserved Variables: $Result
Example:
Set to 0.
The following example beeps twice.
Type String "Attention! An error has occurred."
Beep
Beep
See Also:
MessageBox, Type Line, Type String
Chapter 4 • Script Language Command Reference
Break
Description:
This command applies to serial devices only. Use it to place a break
signal on the communication line. The duration of the break signal is
specified by the $BrkLen reserved variable, and is measured in tenths of
a second. By default, $BrkLen is set to 0.
Syntax:
Break
Reserved Variables: $Result
Example:
Set to 0.
The following example causes a .2-second break.
$BrkLen = 2
Break;breaks the connection
See Also:
Answer, Dial Host, Dial Number, Dial OnlSvc, Hang
CD
Description:
This command applies to the remote PC only. Use it to change the
current directory on the current drive to the specified directory. This
command can be used in scripts that perform remote control sessions so
long as the command is not executed during the remote control session.
Syntax:
CD pathname
Parameters:
pathname
Reserved Variables: $Result
Example:
String literal or string variable containing the full
pathname of the new current directory. You must
include a backslash (\) at the beginning of the pathname
for the root directory on the current drive and between
directory names. The drive letter is optional.
Set to 0. If an error occurs, set to the value of $Error.
$Error
Standard errors. See Appendix B, “Error Messages.”
$CurDir
Set to string containing the name of the current directory
on the current drive.
The following example changes the current directory on the current
drive so you can access files in that directory.
77
78
Chapter 4 • Script Language Command Reference
CD "\AW"
The next example prompts the user for the new current directory.
String newpath[66]
;prompt the user for the path
Type Line "Enter a directory: "
;read the pathname into the newpath variable
Input newpath 66
;change the directory using the newpath variable
CD newpath
The last example reads the new current directory from a file.
String newpath[66]
;open a data file, read the path from it,
;and close the file
Open 1 "datafile.txt"
Read String 1 newpath 66
Close 1
;change the directory using the newpath variable
CD newpath
See Also:
Dir, MD, RD, SessOpr Host Run, SessOpr Remote Run
Clear BOL (Beginning of Line)
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to clear all characters in the current row from the beginning of the
row (column 1) up to but not including the current cursor position.
Each character in the row is replaced by a normal video space. The
cursor position does not change.
Syntax:
Clear BOL
Reserved Variables: $Result
Example:
Set to 0.
The following example positions the cursor at row 10, column 15 and
uses Clear BOL to clear the characters in row 10, columns 1 through 14.
Cursor Position 10 15
Chapter 4 • Script Language Command Reference
Clear BOL
See Also:
Clear BOP, Clear EOL, Clear EOP, Clear Screen
Clear BOP (Beginning of Page)
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to clear all characters from the upper-left corner of the screen
(row 1, column 1) up to but not including the current cursor position.
Each character is replaced by a normal video space. The cursor position
does not change.
Syntax:
Clear BOP
Reserved Variables: $Result
Example:
Set to 0.
The following example positions the cursor at row 10, column 15 and
uses Clear BOP to clear the screen from row 1, column 1 to row 10,
column 14.
Cursor Position 10 15
Clear BOP
See Also:
Clear BOL, Clear EOL, Clear EOP, Clear Screen
Clear EOL (End of Line)
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to clear all characters in the current row from the current cursor
position to the end of the row (inclusive). Each character is replaced by
a normal video space. The cursor position does not change.
Syntax:
Clear EOL
Reserved Variables: $Result
Example:
Set to 0.
The following example positions the cursor at row 10, column 15 and
uses Clear EOL to clear the characters in row 10, starting with column 15
and ending with the last character in the row.
Cursor Position 10 15
79
80
Chapter 4 • Script Language Command Reference
Clear EOL
See Also:
Clear BOL, Clear BOP, Clear EOP, Clear Screen
Clear EOP (End of Page)
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to clear the screen from the current cursor position to the lowerright corner of the screen (inclusive). Each character is replaced by a
normal video space. The cursor position does not change.
Syntax:
Clear EOP
Reserved Variables: $Result
Example:
Set to 0.
The following example positions the cursor at row 10, column 15 and
uses Clear EOP to clear the screen from row 10, column 15 to last
column of the last row.
Cursor Position 10 15
Clear EOP
See Also:
Clear BOL, Clear BOP, Clear EOL, Clear Screen
Clear Screen
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to clear the entire screen and move the cursor to the upper-left
corner (row 1, column 1). Each character is replaced by a normal video
space.
Syntax:
Clear Screen
Reserved Variables: $Result
Example:
Set to 0.
The following example clears the screen and places the cursor at row 1,
column 1.
Clear Screen
See Also:
Clear BOL, Clear BOP, Clear EOL, Clear EOP
Chapter 4 • Script Language Command Reference
Close
Description:
This command applies to the remote PC only. Use it to close the file
associated with the specified file number. Once a file is closed, it cannot
be read from or written to. Any file left open when script processing
terminates is closed automatically. This command can be used in scripts
that perform remote control sessions so long as the command is not
executed during the remote control session.
TIP: Although it is not necessary to close files when you have finished
working with them, it is generally a good practice to do so. When files
are open, they are vulnerable to corruption. If your script should
terminate unexpectedly, any open files could be damaged.
Syntax:
Close file_number
Parameters:
file_number
Reserved Variables: $Result
$Error
Example:
Integer literal used by Open or Create command to
identify the file. Valid values are 1 through 9.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example opens TESTFILE.DAT, gives it the file number 1,
writes one line, then closes the file.
Open 1 "testfile.dat"
Write Line 1 "Sample entry."
Close 1
See Also:
Copy, Create, Del, Open, Ren
Copy
Description:
This command applies to source and destination files on the remote PC
only. Use it to make an exact copy of a file with a different name or
with the same name in a different directory. This command can be used
in scripts that perform remote control sessions so long as the command
is not executed during the remote control session.
81
82
Chapter 4 • Script Language Command Reference
Syntax:
COPY source destination
Parameters:
source
String literal or string variable containing the pathname
(optional) and filename of the source file to copy. If only
a filename is specified, the file must be in the current
directory.
destination
String literal or string variable containing the pathname
(optional) and filename for the destination file. If only a
filename is specified, the copy is made in the current
directory.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example makes a backup copy of REFERENC.TXT.
COPY "\docs\referenc.txt" "\olddocs\referenc.txt"
The next example prompts the user for the new filename then creates a
copy using that name.
String newname[12]
;prompt the user for filename
Type Line "Enter the name of the new file: "
;read the destination (from screen)
Input newname
COPY "file1.txt" newname
See Also:
Close, Create, Del, Open, Ren, SessOpr Host Run, SessOpr Remote Run
Create
Description:
This command applies to the remote PC only. Use it to create and open
a new file. This command can be used in scripts that perform remote
control sessions so long as the command is not executed during the
remote control session.
TIP: Using the Create command on an existing file with read/write
attributes is an easy way to clear the file’s contents. The existing file
length is truncated to 0. If the truncation is successful, the file is opened.
Syntax:
Create file_number filename [attributes]
Chapter 4 • Script Language Command Reference
Parameters:
file_number
Integer literal used to identify the file. Valid identifiers are
1 through 9.
filename
String literal or string variable containing the name of the
file.
attributes
(Optional) string literal or string variable containing
attributes you want the file to have. The default is nonsharable read/write.
Use a combination of the following attributes:
Reserved Variables: $Result
$Error
R
read-only
W
read/write
S
sharable
Set to 0. If an error occurs, set to the value of $Error.
Set to -9 if the file already exists, except in cases where
the attributes variable is set to read/write.
All other standard errors apply. See Appendix B, “Error
Messages.”
Example:
The following example creates NEWFILE.TXT, a sharable read/write file
named in the current directory.
Create 1 "newfile.txt" "SW"
The next example uses a variable to provide the name of the new file.
String filename[12]
;assign the filename to the string variable
filename = "newfile.txt"
;create and open the new file with the
;default setting
Create 1 filename
See Also:
Close, Copy, Del, Open, Ren, Set File Attr, Set File Date, Set File Size, Set
File Time
Cursor Block
Description:
This command applies to the remote PC’s display buffer. Use it to
change the shape of the cursor to a rectangular block, or to show a
cursor hidden using the Cursor Off command.
83
84
Chapter 4 • Script Language Command Reference
Syntax:
Cursor Block
Reserved Variables: $Result
Example:
Set to 0.
The following example changes the cursor’s shape to indicate that the
user has entered insert mode.
Cursor Block
See Also:
Cursor Down, Cursor Home, Cursor Left, Cursor Line, Cursor Off, Cursor
Position, Cursor Restore, Cursor Right, Cursor Save, Cursor Up
Cursor Down
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to move the cursor down the specified number of rows, or one
row if no number is specified. If the number exceeds the number of
rows below the current position, the cursor moves to the bottom of the
screen. The cursor remains in the same column.
Syntax:
Cursor Down [count]
Parameters:
count
Reserved Variables: $Result
Example:
(Optional) integer literal or integer variable containing
number of rows to move cursor. The default is 1.
Set to 0.
The following example moves the cursor down five rows.
Cursor Down 5
The next example moves the cursor down the number of rows specified
in the count variable.
Integer count
count = 5
Cursor Down count
See Also:
Cursor Block, Cursor Home, Cursor Left, Cursor Line, Cursor Off, Cursor
Position, Cursor Restore, Cursor Right, Cursor Save, Cursor Up
Cursor Home
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to move the cursor to the upper-left corner of the screen (row 1,
column 1).
Chapter 4 • Script Language Command Reference
Syntax:
Cursor Home
Reserved Variables: $Result
Example:
Set to 0.
The following example moves the cursor to row 1, column 1.
Cursor Home
See Also:
Cursor Block, Cursor Down, Cursor Left, Cursor Line, Cursor Off, Cursor
Position, Cursor Restore, Cursor Right, Cursor Save, Cursor Up
Cursor Left
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to move the cursor left the specified number of columns, or left
one column if no number is specified. If the number exceeds the
number of columns to the left of the current position, the cursor moves
to the leftmost column. The cursor remains in the same row.
Syntax:
Cursor Left [count]
Parameters:
count
Reserved Variables: $Result
Example:
(Optional) integer literal or integer variable containing
the number of columns to move the cursor. The default
is 1.
Set to 0.
The following example moves the cursor left 5 columns.
Cursor Left 5
The next example moves the cursor left the number of columns
specified in the count variable.
Integer count
count = 5
Cursor Left count
See Also:
Cursor Block, Cursor Down, Cursor Home, Cursor Line, Cursor Off,
Cursor Position, Cursor Restore, Cursor Right, Cursor Save, Cursor Up
Cursor Line
Description:
This command applies to the remote PC’s display buffer. Use it to
change the cursor shape to a single underscore (underline), or to show
a cursor previously hidden by a Cursor Off command.
85
86
Chapter 4 • Script Language Command Reference
Syntax:
Cursor Line
Reserved Variables: $Result
Example:
Set to 0.
The following example changes the cursor to indicate that the user has
entered overwrite mode.
Cursor Line
See Also:
Cursor Block, Cursor Down, Cursor Home, Cursor Left, Cursor Off,
Cursor Position, Cursor Restore, Cursor Right, Cursor Save, Cursor Up
Cursor Off
Description:
This command applies to the remote PC’s display buffer. Use it to hide
the cursor. The cursor position does not change. Show the cursor by
using either the Cursor Block or Cursor Line command.
Syntax:
Cursor Off
Reserved Variables: $Result
Example:
Set to 0.
The following example hides the cursor.
Cursor Off
See Also:
Cursor Block, Cursor Down, Cursor Home, Cursor Left, Cursor Line,
Cursor Position, Cursor Restore, Cursor Right, Cursor Save, Cursor Up
Cursor Position
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to move the cursor to a specific position on the screen. For
example, row 1, column 1 is the upper-left corner of the screen.
Syntax:
Cursor Position row column
Parameters:
row
Integer literal or integer variable specifying the row you
want to move the cursor to. The top row of the screen is
row 1. An asterisk (*) indicates that the row position does
not change.
column
Integer literal or integer variable specifying the column
you want to move the cursor to. The leftmost column of
Chapter 4 • Script Language Command Reference
the screen is column 1. An asterisk (*) indicates that the
column position does not change.
Reserved Variables: $Result
Example:
Set to 0.
The following example moves the cursor to column 20 of the current
row.
Cursor Position * 20
The next example moves the cursor to row 15. The column position
does not change.
Cursor Position 15 *
The last example uses the variables row and column to position the
cursor at row 7, column 10.
Integer row, column
column = 10
row = 7
Cursor Position row column
See Also:
Cursor Block, Cursor Down, Cursor Home, Cursor Left, Cursor Line,
Cursor Off, Cursor Restore, Cursor Right, Cursor Save, Cursor Up
Cursor Restore
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to restore the position, shape (block or underscore), and video
attributes of a cursor. This command is valid only for a cursor you saved
using the Cursor Save command.
Syntax:
Cursor Restore
Reserved Variables: $Result
Example:
Set to 0.
The following example moves the cursor to row 12, column 20; changes
it to a block; then saves all the information about the cursor. Later, it
restores the saved cursor.
Cursor Position 12 20
Cursor Block
;saves the cursor at row 12, column 20
;with block form
Cursor Save
Clear Screen
87
88
Chapter 4 • Script Language Command Reference
;changes the cursor's position and shape
Cursor Position 23 10
Cursor Line
;restores the cursor to row 12, column 20
;and block form
Cursor Restore
See Also:
Cursor Block, Cursor Down, Cursor Home, Cursor Left, Cursor Line,
Cursor Off, Cursor Position, Cursor Right, Cursor Save, Cursor Up
Cursor Right
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to move the cursor right the specified number of columns, or
right one column if no number is specified. If the number exceeds the
number of columns to the right of the current position, the cursor
moves to the rightmost column. The cursor remains in the same row.
Syntax:
Cursor Right [count]
Parameters:
count
Reserved Variables: $Result
Example:
(Optional) integer literal or integer variable containing
the number of columns to move right. The default is 1.
Set to 0.
The following example moves the cursor right five columns.
Cursor Right 5
The next example moves the cursor right the number of columns
specified in the count variable.
Integer count
count = 5
Cursor Right count
See Also:
Cursor Block, Cursor Down, Cursor Home, Cursor Left, Cursor Line,
Cursor Off, Cursor Position, Cursor Restore, Cursor Save, Cursor Up
Cursor Save
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to save the position, shape (block or underscore), and video
Chapter 4 • Script Language Command Reference
attributes of the cursor. To restore the cursor’s position and attributes,
use the Cursor Restore command.
Syntax:
Cursor Save
Reserved Variables: $Result
Example:
Set to 0.
The following example moves the cursor to row 12, column 20; changes
it to a block; then saves all the information about the cursor. Later, it
restores the saved cursor.
Cursor Position 12 20
Cursor Block
;saves the cursor at row 12, column 20
;with block form
Cursor Save
Clear Screen
;changes the cursor's position and shape
Cursor Position 23 10
Cursor Line
;restores the cursor to row 12, column 20
;and block form
Cursor Restore
See Also:
Cursor Block, Cursor Down, Cursor Home, Cursor Left, Cursor Line,
Cursor Off, Cursor Position, Cursor Restore, Cursor Right, Cursor Up
Cursor Up
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to move the cursor up the specified number of rows, or one row
if no number is specified. If the number exceeds the number of rows
above the current position, the cursor moves to the top of the screen.
The cursor remains in the same column.
Syntax:
Cursor Up [count]
Parameters:
count
Reserved Variables: $Result
Example:
(Optional) integer literal or integer variable containing
the number of rows to move the cursor. The default is 1.
Set to 0.
The following example moves the cursor up five rows.
Cursor Up 5
89
90
Chapter 4 • Script Language Command Reference
The next example moves the cursor up the number of rows specified in
the count variable.
Integer count
count = 5
Cursor Up count
See Also:
Cursor Block, Cursor Down, Cursor Home, Cursor Left, Cursor Line,
Cursor Off, Cursor Position, Cursor Restore, Cursor Right, Cursor Save
Decrypt
Description:
Use this command to decrypt a string which has been encrypted using
the Encrypt command. To retrieve the original, unencoded string, you
must use the exact same key string in both the Encrypt and Decrypt
commands. Both the source string and key string are case-sensitive.
This command can be used in scripts that perform remote control
sessions so long as the command is not executed during the remote
control session.
Syntax:
Decrypt source key
Parameters:
source
String variable to decrypt. The string variable can contain
any combination of characters and numbers.
key
String literal or string variable containing the encryption
key. The key can contain any combination of characters
and numbers.
Reserved Variables: $Result
$Error
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
WARNING: If the wrong key is used to decrypt the data, no error is
generated. The resulting string is incorrect and it overwrites the source
string.
Example:
The following example reads an encrypted password from a file,
decrypts the password for later use, and dials CompuServe.
String filename[66]
String password[12]
filename = "compusrv.dat"
Find First filename
Chapter 4 • Script Language Command Reference
If ($Result==0) GoTo @end
Open 1 filename
Read Line 1 password
Close 1
Decrypt password "passkey"
Trim password
Dial OnlSvc "CompuServe"
;send password, etc. to CompuServe
...
@end
End
See Also:
Encrypt
Del
Description:
This command applies to the remote PC only. Use it to delete a file or
group of files. It is extremely useful in deleting any temporary files you
create during script processing. This command can be used in scripts
that perform remote control sessions so long as the command is not
executed during the remote control session.
Syntax:
Del filename
Parameters:
filename
Reserved Variables: $Result
$Error
Example:
String literal or string variable containing the full path
and filename of the file you want to delete. Wildcards (?
or *) are allowed.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example deletes the file DATA.TMP.
Del "c:\temp\data.tmp"
The next example deletes all files with the extension .TMP.
Del "c:\temp\*.tmp"
The last example deletes the file or files specified by the user.
String filename[66]
;prompt user for a filename
Type Line "Enter the name of the file to delete: "
Input filename
;delete file
91
92
Chapter 4 • Script Language Command Reference
Del filename
See Also:
Close, Copy, Create, Open, Ren, SessOpr Host Run, SessOpr Remote
Run
Delete Char
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to delete one or more characters in the current row, beginning
with and including the current cursor position. The characters in the
current row to the right of the deleted characters are shifted left to fill
the gap. If the last character in the row is deleted, it is replaced by a
normal video space. The cursor position does not change.
NOTE: This command affects only characters in the current row.
Deleting characters at the end of a row has no effect on the row
beneath.
Syntax:
Delete Char [count]
Parameters:
count
Reserved Variables: $Result
Example:
(Optional) integer literal or integer variable containing
number of characters to delete. The default is 1.
Set to 0.
The following example deletes five characters to the right of the cursor.
Delete Char 5
See Also:
Delete Line, Insert Char, Insert Line
Delete Line
Description:
This command manipulates characters in the remote PC’s display buffer.
Use it to delete one or more rows on the screen, beginning with and
including the current row, in which the cursor appears. Undeleted rows
below the current row are shifted up the specified number of rows. If
the last row on the screen is deleted, it is replaced by normal video
spaces. The cursor is moved to column 1 of the current row.
Syntax:
Delete Line [count]
Chapter 4 • Script Language Command Reference
Parameters:
count
Reserved Variables: $Result
Example:
(Optional) integer literal or integer variable containing
the number of rows to delete. The default is 1.
Set to 0.
The following example deletes the five rows down from the current
row.
Delete Line 5
See Also:
Delete Char, Insert Char, Insert Line
Description
Description:
Use this command to add a brief description to your script file. You
should have at most one Description command in each of your scripts.
Normally, you enter a description of your script as one of the first lines
in your script file. The description is for informational purposes only.
In pcANYWHERE for Windows, the description appears in the Scripts
dialog box to the right of the script name after the script file is compiled.
Syntax:
Description string
Reserved Variables: (none)
Parameters:
string
String literal containing a brief description of the script
file.
Example:
The following example describes the script’s purpose.
Description "Auto logon to my office PC"
Dial Host
Description:
This command can be used for any connection type. Use it to both load
the specified remote control session configuration (along with the
hardware configuration it includes) and initiate a connection.
Syntax:
Dial Host host_name
Parameters:
host_name
Reserved Variables: $Result
$Error
String literal or string variable containing the name of the
remote control session configuration.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
93
94
Chapter 4 • Script Language Command Reference
Example:
The following example calls and attempts to connect with “Office PC.”
Dial Host "Office PC"
See Also:
End Terminal, Answer, Break, Dial Number, Dial OnlSvc, Hang
Dial Number
Description:
Use this command to dial the specified phone number and make a
connection using the current configuration. (You can load a
configuration using Load Config, Load HostInfo, or Load OnlSvcInfo.)
Use this command when a phone number does not already appear in
the configuration or if you want to override that number.
Syntax:
Dial Number number
Parameters:
number
Reserved Variables: $Result
$Error
Example:
String literal or string variable containing telephone
number to dial. The maximum length of the string is 255
characters.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example loads the hardware configuration, then dials that
number.
Load Config "Hayes Ultra on COM1"
Dial Number "1-500-555-5555"
See Also:
End Terminal, Answer, Break, Dial Host, Dial OnlSvc, Hang, Load
Config, Load HostInfo, Load OnlSvcInfo.
Dial OnlSvc
Description:
This command can be used for any connection type. Use it to both load
the specified online session configuration (along with the hardware
configuration it includes) and initiate a connection.
Syntax:
Dial OnlSvc online_svc
Parameters:
online_svc
String literal or string variable containing the name of the
online service you are calling. The name must be as it
appears in your list of online services.
Chapter 4 • Script Language Command Reference
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example dials the online service you defined as
“CompuServe.”
Dial OnlSvc "CompuServe"
End Terminal
See Also:
Answer, Break, Dial Host, Dial Number, Hang
Dir
Description:
This command applies to the remote PC only. Use it to display a list of a
directory’s files on the screen. This command can be used in scripts that
perform remote control sessions so long as the command is not
executed during the remote control session.
Syntax:
Dir filespec
Parameters:
filespec
String literal or string variable containing the full path or
filename for the contents of the desired directory.
Wildcards (? or *) are allowed. If no drive is specified, the
current drive is the default.
Reserved Variables: $Result
Set to the number of matching files found and displayed,
or 0 if no files are found. If an error occurs, set to the
value of $Error.
$Error
Example:
Standard errors. See Appendix B, “Error Messages.”
The following example displays all the files in the DATA directory with
the extension .DAT. It also displays the number of files found.
String total[6]
;get directory information and set total to $Result
Dir "c:\data\*.dat"
total = $Result
Type Line "^MTotal number of files: "
Type String total;display total number of files
See Also:
CD, MD, RD, SessOpr Host Run, SessOpr Remote Run
95
96
Chapter 4 • Script Language Command Reference
Emulate
Description:
This command applies to the remote PC only. Use it to emulate a
terminal type when in terminal mode or when character sequences are
output to the screen from a script. Each emulation has its own set of
screen sequences to control cursor positioning, clearing the screen,
screen attributes, and other behavior.
Emulate resets Load Translation to the default translation. If you load an
online session configuration after the Emulate command, the emulation
is reset to the one in the configuration.
Syntax:
Emulate terminal_name
Parameters:
terminal_name The name of the following predefined terminal
emulations:
Terminal Emulated
Name
Standard ANSI Terminals
ANSI
DEC VT-100
VT100
DEC VT-102
VT102
DEC VT-220, 7-bit mode
VT220-7
DEC VT-220, 8-bit mode
VT220-8
DEC VT-52
VT52
Televideo 912
TVI912
Televideo 920
TVI920
Televideo 925
TVI925
IBM 3101
IBM3101
Data General Dasher 100
DG100
Data General Dasher 200
DG200
Wyse 50
WYSE50
Hazeltine 1500
HAZ1500
Chapter 4 • Script Language Command Reference
Terminal Emulated
Name
LSI ADM-3A
ADM3A
ADDS Viewpoint
ADDSVPT
X3270
X3270
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example emulates a VT-100 terminal.
Emulate VT100
See Also:
Reset, Terminal
Encrypt
Description:
Use this command to convert the source string into a code based upon
the key string. Both the source string and key string are case-sensitive.
This command prevents unauthorized access to the information
contained in the source string.
To retrieve the original, unencoded string, you must use the exact same
key string in both the Encrypt and Decrypt commands. Encryption is
commonly used to protect passwords and personal information. You
can encrypt data and safely write it to a data file for retrieval later.
This command can be used in scripts that perform remote control
sessions so long as the command is not executed during the remote
control session.
Syntax:
Encrypt source key
Parameters:
source
String variable to encrypt. The string variable can contain
any combination of characters and numbers.
key
String literal or string variable containing the encryption
key. The key can contain any combination of characters
and numbers.
Reserved Variables: $Result
$Error
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
97
98
Chapter 4 • Script Language Command Reference
Example:
The following example makes “passkey” the key and prompts the user
for a password. After the password is encrypted, it is written to a file for
later reference.
String password[12]
String key[12]
key = "passkey"
;prompt user for password
Type Line "Enter your password: "
;set password variable
Input password
;encrypt and decrypt password
Encrypt password key
Open 1 "compusrv.dat" "CW"
Write Line 1 password
Close 1
See Also:
Decrypt
End
Description:
This command ends current script processing. If the script was executed
from a menu, dialog box, or window, control is returned to that menu,
dialog box, or window. If the script was called by another script, control
returns to the calling script. For pcANYWHERE for DOS only, if the
script was started from a DOS command line, pcANYWHERE is
terminated.
Syntax:
End [return_code]
Parameters:
return_code
Reserved Variables: $Result
$Error
Example:
(Optional) integer literal or integer variable to return
from called script to calling script. Its value is also stored
in $Result.
Set to the value of return_code so it can be used by the
calling script. Set to zero when return_code is not used.
Unchanged.
In the following example, the MAIN.SCR script file calls the
ANOTHER.SCR script file. ANOTHER.SCR uses the global variables
declared in MAIN.SCR.
Chapter 4 • Script Language Command Reference
MAIN.SCR
Integer temp
;declare $1 and $2 as global integers
Integer $1, $2
$1 = 5;set $1 variable
$2 = 5;set $2 variable
Script ANOTHER;call ANOTHER.SCR
temp = $Result;store return value in temp
Type String "The value is: "
;print product of $1 and $2 (25) to the screen
Type Line temp
Wait Time 3
End;end script processing
ANOTHER.SCR
value = $1 * $2;calculate product of $1 and $2
;end processing of ANOTHER.SCR,
;return control, and pass value to MAIN.SCR
End value
See Also:
End Menu, End Terminal, Exit
End Menu
Description:
This command ends the current script, exits terminal mode, and returns
control to the Main menu, regardless of how the script was invoked. If a
connection was made, it is disconnected.
Syntax:
End Menu
Reserved Variables: $Result
$Error
Example:
Set to 0.
Unchanged.
The following example ends script processing and returns to the main
menu.
End Menu
See Also:
End, End Terminal, Exit
99
100
Chapter 4 • Script Language Command Reference
End Terminal
Description:
Use this command to end all script processing and return control to the
terminal mode of pcANYWHERE, regardless of how the script was
invoked. This allows you to continue to use pcANYWHERE with your
online session even though the script has ended.
Unlike the Terminal command, when terminal mode is exited, control
does not return to the script containing the End Terminal command.
Syntax:
End Terminal
Reserved Variables: (none)
Example:
The following example ends script processing, but leaves you
connected to your online session and leaves pcANYWHERE running.
End Terminal
See Also:
End, End Menu, Exit
Exit
Description:
Use this command to end all script processing and exit pcANYWHERE.
Unless the Online parameter is specified, the connection is also
terminated. With Online, the user can continue using the online service.
Syntax:
Exit [Online]
Parameters:
Online
(Optional) does not lower the DTR signal on exit.
Essentially, if a serial connection is in progress (modem
or other), this command leaves the connection alive even
after you have exited the application. Used for online
service serial connections only.
Reserved Variables: (none)
Example:
The following example ends the program and exits pcANYWHERE.
Exit
The following example ends the program but keeps the connection to
the online service open.
Chapter 4 • Script Language Command Reference
Exit Online
See Also:
End, End Menu, End Terminal
Find First
Description:
This command applies to the remote PC only. Use it to search the drive
for the first file that matches the file specification. This command can be
used in scripts that perform remote control sessions so long as the
command is not executed during the remote control session.
NOTE: You can also use this command to check if a file exists; for
example, before performing a Create command.
Syntax:
Find First search_for [match_found]
Parameters:
search_for
String literal or string variable containing the name of the
file you want to search for. The filename can contain
wildcards (? or *). If no drive is specified, the current
drive is the default.
match_found
(Optional) string variable used to store the matched
filename, if found. When not used, the filename is not
retrieved.
Reserved Variables: $Result
$Error
Example:
Set to 1 if a match is found; 0 if no match is made. If an
error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example determines if a file with the .DAT extension
exists in the current directory on the C: drive.
Find First "C:*.DAT"
;if found, go to @found
If ($Result == 1) GoTo @found
Type Line "No matching files found."
GoTo @end;if not found, go to @end
@found:
Type Line "Matching files found."
@end:
101
102
Chapter 4 • Script Language Command Reference
End;end processing
See Also:
Dir, Find Next
Find Next
Description:
This command applies to the remote PC only. Use it to search for
additional instances of the file or file types specified in the Find First
command. This command can be used in scripts that perform remote
control sessions so long as the command is not executed during the
remote control session.
Syntax:
Find Next [match_found]
Parameters:
match_found
Reserved Variables: $Result
$Error
Example:
(Optional) string variable used to store the matched
filename, if found. When not used, the filename is not
retrieved.
Set to 1 if a match is found; 0 if no match is made. If an
error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example starts the search for files with .DAT as an
extension with the Find First command. Every time a match is found,
Find Next is repeated to find an additional matching file.
Integer count
String match[12]
;initialize count to 0
count = 0
;search for matching files
Find First "C:*.DAT" match
;if a match is found, continue at @found
If ($Result == 1) GoTo @found
;If no match is found, display message
;and terminate script
Type Line "No matching files found."
GoTo @end
@found:
Type Line "Matching files found."
count = count + 1;increment count by 1
Type String match;display filename
Chapter 4 • Script Language Command Reference
Type String "^M";hard carriage return
;search for next instance until no more are found
Find Next match
If ($Result == 1) GoTo @found
;when no more .DAT files found, display total
Type String "Number of *.DAT files found: "
Type Line count
@end:
End;end processing
See Also:
Dir, Find First
Get Environment
Description:
This command applies to the remote PC only. Use it to retrieve the
setting for a DOS environment variable. The names of environment
variables usually appear in Set statements in the AUTOEXEC.BAT file.
This command can be used in scripts that perform remote control
sessions so long as the command is not executed during the remote
control session.
Syntax:
Get Environment variable value
Parameters:
variable
String literal or string variable containing the name of an
environment variable.
value
String variable that will store the value of the specified
environment variable. If the variable is not found, this is
a null string.
Reserved Variables: $Result
$Error
Example:
Set to 1 if a match is found; otherwise set to 0. If an error
occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example retrieves the value of the AW environment
variable and places it in the awpath string variable.
String awpath[80]
Get Environment "AW" awpath
103
104
Chapter 4 • Script Language Command Reference
Get File Attr
Description:
This command applies to the remote PC only. Use it to retrieve the
attributes for the specified file. This command can be used in scripts that
perform remote control sessions so long as the command is not
executed during the remote control session.
Syntax:
Get File Attr filename [attributes]
Parameters:
filename
String literal or string variable containing the full path
and name of the file whose attributes you want.
Wildcards are not allowed.
attributes
(Optional) integer variable used to store the sum of the
values for the file’s attributes for filename. Its value is
also stored as an integer in $Result.
This values for the attributes are:
Attribute
Value
Read-only
1
Hidden
2
System file
4
Volume label
8
Subdirectory
16
Archive
32
For example, suppose the attributes value for the IO.SYS
file is 7. Because 7 is the sum of 1, 2, and 4, so IO.SYS is
read-only, hidden system file. If the sum is 0, the file is a
Normal file.
Reserved Variables: $Result
$Error
Example:
Contains the file attributes integer. A non-negative value
indicates that valid attribute information has been
obtained. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example retrieves the attributes for a file, converts each
attribute to a character (such as N for normal), then displays the
characters.
Chapter 4 • Script Language Command Reference
Integer attr
String description[10]
;set description to null
description = ""
;get file attributes for COMMAND.COM
Get File Attr "COMMAND.COM" attr
;if all bits are 0, write N (normal) to the string
If (attr == 0) Then StrCat description "N"
;if bit 0 is 1, write R (read-only) to the string
If ((attr & 1) == 1) Then StrCat description "R"
;if bit 1 is 1, write H (hidden) to the string
If ((attr & 2) == 2) Then StrCat description "H"
;if bit 2 is 1, write S (system file) to the string
If ((attr & 4) == 4) Then StrCat description "S"
;if bit 3 is 1,
;write V (volume label) to the string
If ((attr & 8) == 8) Then StrCat description "V"
;if bit 4 is 1, write D (directory) to the string
If ((attr & 16) == 16) Then StrCat description "D"
;if bit 5 is 1, write A (archive) to the string
If ((attr & 32) == 32) Then StrCat description "A"
Type String "The file is a "
Type Line description
See Also:
Get File Date, Get File Size, Get File Time, Set File Attr, Set File Date, Set
File Size, Set File Time
Get File Date
Description:
This command applies to the remote PC only. Use it to retrieve the date
that a file was created or last modified. This command can be used in
scripts that perform remote control sessions so long as the command is
not executed during the remote control session.
Syntax:
Get File Date filename [date]
Parameters:
filename
String literal or string variable containing the full path
and name of the file whose date you want. Wildcards are
not allowed.
105
106
Chapter 4 • Script Language Command Reference
date
Reserved Variables: $Result
$Error
Example:
(Optional) string variable used to store the date in the
appropriate international date format (for example, YY/
MM/DD for the United States). When not used, the date
is not retrieved in string form. Its value is also stored as
an integer in $Result.
Stores the date as an integer. The format is YYMMDD. A
non-negative value indicates that a valid date was
retrieved. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example finds the date for the COMMAND.COM file and
stores it in $Result.
String filename[12]
filename = "command.com"
;get the file date for COMMAND.COM
Get File Date filename
Type Line $Result;display date
See Also:
Get File Attr, Get File Size, Get File Time, Set File Attr, Set File Date, Set
File Size, Set File Time
Get File Size
Description:
This command applies to the remote PC only. Use it to retrieve the size,
in bytes, of the file specified in filename. This command can be used in
scripts that perform remote control sessions so long as the command is
not executed during the remote control session.
Syntax:
Get File Size filename [size]
Parameters:
filename
String literal or string variable containing the full path
and name of the file whose size you want. Wildcards are
not allowed.
size
(Optional) string variable used to store the size of the file.
When not used, the size is not retrieved in string form.
Its value is also stored as an integer in $Result.
Reserved Variables: $Result
$Error
Stores the file size as an integer. Set to a non-negative
value indicates a valid file size was retrieved. If an error
occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
Chapter 4 • Script Language Command Reference
Example:
The following example determines the size of the COMMAND.COM file.
String size[10]
;get the file size and display it
Get File Size "COMMAND.COM" size
Type String "The size of COMMAND.COM is: "
Type Line size
See Also:
Get File Attr, Get File Date, Get File Time, Set File Attr, Set File Date, Set
File Size, Set File Time
Get File Time
Description:
This command applies to the remote PC only. Use it to retrieve the time
that the file specified in filename was created or last modified. This
command can be used in scripts that perform remote control sessions so
long as the command is not executed during the remote control session.
Syntax:
Get File Time filename [time]
Parameters:
filename
String literal or string variable containing the full path
and name of the file whose time you want. Wildcards are
not allowed.
time
(Optional) string variable used to store the time. The time
format is HHMM on a 24-hour clock. The leading zero is
dropped. When not used, the time is not retrieved in
string form. Its value is also stored as an integer in
$Result.
Reserved Variables: $Result
$Error
Example:
Stores the retrieved time as an integer. A non-negative
value indicates that a valid time was retrieved. The time
format is HHMM on a 24-hour clock (no leading zero). If
an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example determines the time for the COMMAND.COM
file and stores the time as a string in the time variable.
String filename[12]
String time[4]
;set filename to COMMAND.COM
filename = "command.com"
;store the time in the time variable
Get File Time filename time
107
108
Chapter 4 • Script Language Command Reference
See Also:
Get File Attr, Get File Date, Get File Size, Set File Attr, Set File Date, Set
File Size, Set File Time
Get Free Disk
Description:
This command applies to the remote PC only. Use it to determine the
amount of space remaining on the specified disk. This command can be
used in scripts that perform remote control sessions so long as the
command is not executed during the remote control session.
Syntax:
Get Free Disk drive [freespace]
Parameters:
drive
String literal or string variable specifying the drive you
are polling. You can specify only one drive at a time.
freespace
(Optional) string variable containing the amount of space
available (in bytes). When not used, the amount of space
is not retrieved in string form. This value is also stored as
an integer in $Result.
Reserved Variables: $Result
$Error
Example:
Stores the amount of space available (number of bytes)
as an integer. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example determines and displays the amount of free
space on drive C.
String size[12]
;and get free space on drive C:
Get Free Disk C size
;display the amount of space available on drive C:
Type String "Free space on drive C: "
Type Line size
See Also:
Dir
Chapter 4 • Script Language Command Reference
GoSub
Description:
Use this command to call a subroutine from within the current script
file. When the subroutine ends, the script resumes processing with the
line immediately following the GoSub command.
To correctly return control from the subroutine to the body of the script,
each subroutine must end with a Return command. An End command
should separate any subroutine or series of subroutines from the rest of
the script so that the lines are executed only when a GoSub command is
executed. Subroutines can be nested ten levels deep.
Syntax:
GoSub label
Parameters:
label
Reserved Variables: $Result
$Error
Example:
A label within the current script. The label can contain
numbers, letters or characters.
Unchanged.
Unchanged.
The following example contains a subroutine called getInput that asks
the user for a string.
String instring[255]
;call to getInput subroutine
GoSub @getInput
;if no input, end processing
If ($Result == 0) GoTo @end
Send String instring;send instring
@end:
End;end processing
@getInput:;getInput subroutine
Input instring;input string
StrLen instring;get string length of instring
Return $Result;return string length of instring
See Also:
GoTo, Link, Return, Script
109
110
Chapter 4 • Script Language Command Reference
GoTo
Description:
Use this command to branch, or jump, to a label within the current
script file.
Syntax:
GoTo label
Parameters:
label
Reserved Variables: $Result
$Error
Example:
A label within the current script. The label can contain
numbers, letters or characters.
Set to 0.
Unchanged.
The following example uses a GoTo command to end the search for
matching files when none or no more are found. For every file that is
found, the script displays the filename and updates the count.
Integer count
String match[10]
count = 0;set count to 0
;search for matching files
Find First "C:*.DAT" match
;if match found, go to @found
If ($Result == 1) GoTo @found
Type Line "No matching files found."
GoTo @end;if not found, go to @end
@found:
Type Line "Matching files found."
@foundmore:
count = count + 1;increment count by 1
Type String match;display filename
Type String "^M";hard carriage return
;search for next instance until no more are found
Find Next match
If $Result == 1 GoTo @foundmore
Type String "Number of *.DAT files found: "
Type Line count;display count
@end:
End;end processing
Chapter 4 • Script Language Command Reference
See Also:
GoSub, Link, Return, Script
Hang
Description:
Use this command to terminate any connection.
Syntax:
Hang
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example connects to a host PC, then later terminates that
connection.
Dial Host "Office PC"
...
Hang;terminate connection
See Also:
Answer, Break, Dial Host, Dial Number, Dial OnlSvc
If…Then or If…GoTo
Description:
Use this command for conditional processing. If the specified
expression is true, the command is executed. If the expression is false,
the command is ignored and script processing continues with the next
command.
Syntax:
If expression Then command
Or,
If expression GoTo label
Parameters:
expression
Logical expression that results in a true or value.
Expressions cannot be used to compare values in strings
containing both characters and numbers, because the
string variables are converted to their numeric
equivalents. For example, the string "123ABX" has the
numeric value of 123.
label
A label within the current script. The label can contain
numbers, letters or characters.
command
Any valid script command.
111
112
Chapter 4 • Script Language Command Reference
Reserved Variables: $Result
$Error
Example:
Unchanged.
Unchanged.
The following example uses If...GoTo commands to control the search
for matching files. When a file is found, the search continues by going
to the found or foundmore label. For every matching file, the script
displays the filename and updates the count.
Integer count
String match[10]
count = 0;set count to 0
;search for matching files
Find First "C:*.DAT" match
;if match found, go to @found
If ($Result == 1) GoTo @found
Type Line "No matching files found."
GoTo @end;if not found, go to @end
@found:
Type Line "Matching files found."
@foundmore:
count = count + 1;increment count by 1
Type String match;display filename
Type String "^M";hard carriage return
;search for next instance until no more are found
Find Next match
If $Result == 1 GoTo @foundmore
Type String "Number of *.DAT files found: "
Type Line count;display count
@end:
End;end processing
See Also:
GoTo
Index
Description:
Use this command to locate the starting position of one string within
another. The first character of a string is at position 1. This command
Chapter 4 • Script Language Command Reference
can be used in scripts that perform remote control sessions so long as
the command is not executed during the remote control session.
Syntax:
Index source_str search_str [position]
Parameters:
source_str
String literal or string variable to be searched.
search_str
String literal or string variable you want to search for.
position
(Optional) integer variable used to store the starting
position of the first instance of the search string. Its value
is also stored in $Result.
Reserved Variables: $Result
$Error
Example:
Stores the starting position of the first instance of the
search string. If no match is found, set to 0.
Unchanged.
The following example finds the starting position of a substring within a
string.
String source[20]
Integer position
position = 2
source = "ABCDEFGHIJ"
;search for FGH in source
;and store the result in position
Index source "FGH" position
See Also:
Lower, Set IgnoreCase, StrCat, StrCmp, StrLen, StrSet, SubStr, Trim,
Upper
Input
Description:
Use this command to retrieve data entered by the user from the
keyboard. Input retrieves all the characters entered before the Enter key,
up to the specified maximum length, or up to the length of the
destination string. The user can use any of the following keys to edit the
entry before pressing Enter:
Keystroke
Operation
LeftArrow
Moves the cursor one column to the left
RightArrow
Moves the cursor one column to the right
113
114
Chapter 4 • Script Language Command Reference
Keystroke
Operation
Backspace
Deletes the character before the cursor
Return
Terminates data input
This command can be used in scripts that perform
remote control sessions so long as the command is
not executed during the remote control session.
Syntax:
Input data_string [maxlength]
Parameters:
data_string
String variable where the retrieved data is stored.
maxlength
(Optional) integer literal or integer variable containing
the maximum number of characters accepted into the
string. The default value is the declared length of the
data_string.
Reserved Variables: $Result
$Error
Example:
Contains the total number of characters entered
(excluding the terminating carriage return). If an error
occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example retrieves the user’s response to “Enter your
name...”.
String username[30]
Type Line "Enter your name (up to 30 characters): "
;retrieve the name typed by the user
;and store it in the username variable
Input username 30
Send Line username;send username
See Also:
Input Key, Keyboard Flush, Keyboard Hit
Input Key
Description:
Use this command to retrieve a single character typed by the user from
the keyboard. The entry is not echoed to the screen and the user does
not have to press Enter. This command can be used in scripts that
perform remote control sessions so long as the command is not
executed during the remote control session.
Chapter 4 • Script Language Command Reference
Syntax:
Input Key character
Parameters:
character
Reserved Variables: $Result
$Error
Example:
String variable where the retrieved character is stored.
Stores the ASCII value of the keystroke entered.
Unchanged.
The following example asks the user for a Y or an N for yes or no until
one is received. If the response (stored in the yn variable) is a Y, the
script continues. If it is an N, the script ends.
String yn[1]
Type Line "Enter Y to continue; N to exit: "
;loop until the user presses y or n
@loop:
Input Key yn
Upper yn;convert user input to uppercase
;compare user input with "Y" and "N"
StrCmp yn "Y"
If ($Result == 0) GoTo @yes
StrCmp yn "N"
If ($Result == 0) GoTo @no
;beep and keep looping if user presses
;key other than y or n
Beep
GoTo @loop
@no:
Exit
@yes:
;continue processing the remainder of the script
...
See Also:
Input, Keyboard Flush, Keyboard Hit
Insert Char
Description:
Use this command to declare the number of characters to be inserted at
the current cursor position, then use Type String to insert the desired
characters. Insert Char is always used in conjunction with the Type
115
116
Chapter 4 • Script Language Command Reference
String command. The character originally marked by the cursor and the
rest of the characters in that row are shifted to the right. Characters that
are shifted off the screen are lost. The cursor position does not change.
Syntax:
Insert Char [count]
Parameters:
count
Reserved Variables: $Result
$Error
Example:
(Optional) integer literal or integer variable containing
number of characters to be inserted. The default is 1.
Set to 0.
Unchanged.
The following example moves the cursor to an appropriate position and
inserts a message in a previously typed line.
Type string “This is a test”
Cursor Left 10
Wait Time 2
;prepare for insertion
Insert Char 21
;insert the characters
Type String "Waiting for signal..."
See Also:
Delete Char, Delete Line, Insert Line
Insert Line
Description:
Use this command to insert one or more rows of normal video spaces at
the row containing the cursor. The row originally containing the cursor
and all rows beneath it are shifted down. Rows that are shifted off of the
screen are lost. The row position for the cursor does not change, but it
is moved to column 1 (if it was not already there).
Syntax:
Insert Line [count]
Parameters:
count
Reserved Variables: $Result
$Error
Example:
(Optional) integer literal or integer variable containing
number of rows to insert. The default is 1.
Set to 0.
Unchanged.
The following example inserts three rows above the current row.
Integer count
count = 3
Chapter 4 • Script Language Command Reference
Insert Line count;insert 3 rows at current row
See Also:
Delete Char, Delete Line, Insert Char
Keyboard Flush
Description:
Use this command to clear the keyboard buffer containing any
characters that the user may have typed ahead. Immediately before
retrieving keyboard input (using Input or Input Key), use Keyboard
Flush to clear the keyboard buffers. This ensures that you retrieve only
the characters the user types in response to a prompt. This command
can be used in scripts that perform remote control sessions so long as
the command is not executed during the remote control session.
Syntax:
Keyboard Flush
Reserved Variables: $Result
$Error
Example:
Set to 0.
Unchanged.
The following example clears the keyboard buffer prior to accepting a
filename typed by the user.
String filename[12]
Type Line "Enter the name of the file to delete: "
Keyboard Flush;clear the keyboard buffer
Input filename;set the filename variable
Del filename;delete the file
See Also:
Input, Input Key, Keyboard Hit
Keyboard Hit
Description:
Use this command to determine if a character has been entered, but not
yet read using an Input or Input Key command. This command can be
used in scripts that perform remote control sessions so long as the
command is not executed during the remote control session.
Syntax:
Keyboard Hit [flag]
Parameters:
flag
(Optional) integer variable used as a flag indicating
whether or not a key has been pressed. Becomes a 1 if a
key has been pressed; becomes a 0 otherwise. Its value
is also stored in $Result.
117
118
Chapter 4 • Script Language Command Reference
Reserved Variables: $Result
$Error
Example
Set to 1 if a key has been pressed; 0 otherwise.
Unchanged.
The following example determines if the user has pressed Esc.
@checkesc:;beginning of subroutine
Keyboard Hit;check for keystroke
;if not, go back to calling routine
If ($Result == 0) then Return 0
Input Key inkey;if yes, input keystroke
StrCmp inkey "^[";is it the Esc key?
;if yes, Return a value of 1
If ($Result == 0) then Return 1
;repeat loop until all keys are entered and checked
GoTo @checkesc
See Also:
Input, Input Key, Keyboard Flush
Let
Description:
Use this command to assign an expression to a variable. You do not
need to use the reserved word Let unless the variable name you are
using is identical to a reserved word, such as a command name.
Syntax:
[Let] variable = expression
Parameters:
Let
(Optional) reserved word; the command may be
shortened.
variable
Integer variable or string variable.
expression
Any expression containing integers, strings, and
operators.
Reserved Variables: (none)
Example:
The following example assigns a string literal to the echo variable and
numeric expressions to the variables named base and number.
String echo[10]
Integer base, number
Let echo = "ABC";set echo to the string ABC
base = 1
number = base * 10
Chapter 4 • Script Language Command Reference
Link
Description:
Use this command to terminate one script, losing all its local variables
and their values, and start another.. Control is transferred to the script
named in the command. A script called using the Link command can be
thought of as a continuation of the original calling script, except that the
original script’s local variables are lost.
This differs from the Script command in that control returns to the
calling script after the called script terminates.
For example, consider an original calling script named MAIN.SCR. This
script is responsible for all processing during a session. At one point, an
item needs to be printed. Using the Script command, MAIN calls a
secondary script, CHSPRNT.SCR, which determines which print routine
to call (see Figure 4-2). CHSPRNT uses a Link command to call the
routine for the selected printer. When the item has been sent to the
printer, the linked script terminates and control is returned to MAIN.SCR
(bypassing CHSPRNT.SCR entirely).
Figure 4-16 Once the selected print routine has finished executing,
control returns to MAIN.SCR.
Syntax:
Link script_name
119
120
Chapter 4 • Script Language Command Reference
Parameters:
script_name
Reserved Variables: $Result
$Error
Example:
String literal or string variable containing the name of the
script file to link to. The string must not contain the .SCR
file extension.
Set to 0.
Unchanged.
The following example ends one script and starts another to which the
first script has been linked.
Type Line "This script passes control to another."
Link "Script2"
See Also:
GoSub, GoTo, Return, Script
Load Config
NOTE: The Load Config script command is not supported in
pcANYWHERE, version 7.0 or later. For pcANYWHERE, version 7.0 or
later, use Load HostInfo, or Load OnlSvcInfo
Description:
Use this command to load the hardware configuration before attempting
to connect to an online service. However, you may prefer to use Load
OnlSvc which loads a session configuration. Session configurations
include hardware configurations.
Syntax:
Load Config hardware_config
Parameters:
hardware_configString literal or string variable containing the name of
the hardware configuration to load. The name must be
as it appears in the list of hardware configurations.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example loads the hardware configuration for a modem,
then dials an online service.
;load the hardware configuration
Load Config "Hayes Ultra on COM1"
;dial phone number of a host PC
Chapter 4 • Script Language Command Reference
Dial Number "1-500-555-5555"
See Also:
Dial Host, Dial Number, Dial OnlSvc, Load FKeys, Load HostInfo, Load
OnlSvcInfo, Load Translation
Load FKeys
Description:
Use this command to load a function key file containing programmable
function key information. Function key translations are in effect only in
terminal mode (not during script execution).
Syntax:
Load FKeys keyboard_file
Parameters:
keyboard_file
Reserved Variables: $Result
$Error
Example:
String literal or string variable containing name of
function key file. Do not include a filename extension
(.MK6 is assumed).
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example loads the remote control session configuration
and function keys information for the host PC named MCI Mail, then
dials the host.
;load remote control session configuration
Load HostInfo "MCI Mail"
;load function key table for use with MCI
Load FKeys "MCI-MAIL"
;call MCI Mail
Dial Number "9,555-5555"
End Terminal;go to terminal mode
See Also:
Dial Host, Dial Number, Dial OnlSvc, Load Config, Load HostInfo, Load
OnlSvcInfo, Load Translation
Load HostInfo
Description:
Use this command to load a remote control session configuration. The
hardware configuration associated with the specified remote control
session configuration is automatically loaded at the same time. This
command is used primarily when you need to prompt the user for or
override some information in the remote control session configuration.
121
122
Chapter 4 • Script Language Command Reference
If you don’t want to change any settings, you may prefer to use Dial
Host.
Syntax:
Load HostInfo host_name
Parameters:
host_name
Reserved Variables: $Result
$Error
Example:
String literal or string variable containing the name of the
remote control session configuration to load.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example loads the remote control session configuration
named Office PC, then dials the host.
;load remote control session configuration that has
;no phone number
Load HostInfo "Office PC"
;attempt to connect with office PC
Dial Number "555-5555"
See Also:
Dial Host, Dial Number, Dial OnlSvc, Load Config, Load FKeys, Load
OnlSvcInfo, Load Translation
Load OnlSvcInfo
Description:
Use this command to load the specified online session configuration.
The hardware configuration associated with the specified online session
configuration is automatically loaded at the same time. This command is
used primarily when you need to prompt the user for or override some
information in the online session configuration. If you don’t want to
change any settings, you may prefer to use Dial OnlSvc.
Syntax:
Load OnlSvcInfo online_svc_name
Parameters:
online_svc_name String literal or string variable containing the name of
the online session configuration to load. The name must
be as it appears in the pcANYWHERE list of online
services.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example loads the online session configuration, asks the
user for the phone number, then dials that number.
String phone_number[12]
Chapter 4 • Script Language Command Reference
;load CompuServe session configuration
;that has no phone number
Load OnlSvcInfo "CSwoPHONE"
Type Line "Enter CompuServe phone number: "
Input phone_number 12
;attempt to connect with online service
Dial Number phone_number
See Also:
Dial Host, Dial Number, Dial OnlSvc, Load Config, Load FKeys, Load
HostInfo, Load Translation
Load Translation
Description:
Use this command to load a translation table file for both incoming and
outgoing character streams. A translation table is used to translate one
character set to another or to filter out unwanted characters. You must
load the configuration before the Load Translation command is
executed. The Set Translation command indicates whether or not to use
the loaded translation file.
Syntax:
Load Translation translation_file
Parameters:
translation_file String literal or string variable containing the translation
filename to load. Do not include the .TRN filename
extension.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example loads the strip high bits translation table, loads a
remote control session configuration, enables the translation, and calls
the host. The order of these commands must be as shown.
Load OnlSvcInfo "ACE BBS";load configuration
Load Translation "STRIPHIG"
Set Translation On
...
Dial Number ACS_BBS;attempt connection
See Also:
Load Config, Load FKeys, Load HostInfo, Load OnlSvcInfo, Set
Translation
123
124
Chapter 4 • Script Language Command Reference
Lower
Description:
Use this command to convert all uppercase characters in a string to
lowercase. Characters that are already lowercase are not affected. This
command can be used in scripts that perform remote control sessions so
long as the command is not executed during the remote control session.
Syntax:
Lower string
Parameters:
string
Reserved Variables: $Result
$Error
Example:
String variable to convert.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example converts the specified string to all lowercase
characters.
String mixed[10]
mixed = "aBC"
Lower mixed
;display string (abc is displayed)
Type String mixed
See Also:
Set IgnoreCase, StrCat, StrCmp, StrLen, StrSet, SubStr, Trim, Upper
MD
Description:
This command applies to the remote PC only. Use it to create a new
directory. This command can be used in scripts that perform remote
control sessions so long as the command is not executed during the
remote control session.
Syntax:
MD dirname
Parameters:
dirname
Reserved Variables: $Result
$Error
String literal or string variable containing the full path
and name of the directory you want to create.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
Chapter 4 • Script Language Command Reference
Example:
The following example creates a new subdirectory named AW.
MD "AW"
The next example asks the user for the name of the new subdirectory.
String newdir[66]
Type Line "Enter the directory: "
;read path into the newdir variable
Input newdir 66
;make the directory based upon the newdir variable
MD newdir
The last example creates a new subdirectory using a pathname read
from a file.
String newdir[66]
Open 1 "datafile.txt";open the data file
Read String 1 newdir 66;read in the path string
Close 1;close the data file
;make the directory based upon the newdir variable
MD newdir
See Also:
CD, Dir, RD, SessOpr Host Run, SessOpr Remote Run
MessageBox
Description:
Use this command to display a message box. The value you use for the
options parameter dictates the appearance of the message box. This
command can be used in scripts that perform remote control sessions so
long as the command is not executed during the remote control session.
Syntax:
MessageBox title text [options]
Parameters:
title
String literal or string variable containing the title of the
message box.
text
String literal or string variable containing the text to
appear in the message box.
options
(Optional) integer literal or integer variable which is the
sum of the numbers representing the buttons to appear
in the message box, the button that is selected by default,
and (in Windows only) the icon to display to the left of
the text.
125
126
Chapter 4 • Script Language Command Reference
When options is not specified in DOS, the default is 0—
an OK button which is selected by default; in Windows,
the default is 21—the Retry and Cancel buttons (with
Retry selected by default) and a Stop icon.
Values for the options parameter are:
Value
Buttons to Display
0
OK
1
OK and Cancel
2
Abort, Retry, and Ignore
3
Yes, No, and Cancel
4
Yes and No
5
Retry and Cancel
Value
Default Button
0
Button 1
256
Button 2
512
Button 3
Value
Icon to Display
0
None
16
Stop sign
32
Question mark
48
Exclamation point
64
Information
Chapter 4 • Script Language Command Reference
Reserved Variables: $Result
$Result
Button Pressed
1
OK
2
Cancel
3
Abort
4
Retry
5
Ignore
6
Yes
7
No
$Error
Example:
Set to one of the following values depending on which
button the user pressed:
Standard errors. See Appendix B, “Error Messages.”
The following example produces a message box. In pcANYWHERE for
Windows, the message box is as shown in Figure 4-3.
Session Dial "Office PC"
String message
String filename
message = "Do you want to view the file now?"
filename = "c:\excel\excel.exe 4th_qtr.xls"
Type Line "Launching application on host..."
MessageBox "View File" message 35
If ($Result == 6) Then SessOpr Host Run filename
Figure 4-17
See Also:
The 35 in the MessageBox command gives this Windows
message box its question mark as well as the Yes, No,
and Cancel buttons.
Type Line, Type String
127
128
Chapter 4 • Script Language Command Reference
On Cancel
Description:
Use On Cancel to specify a command to be executed if the user presses
Esc during the execution of a Wait or Receive command. If the previous
Set Cancel command was set to on and the user presses Esc, the
command following On Cancel is executed. If Set Cancel was not
executed or set to off, On Cancel is ignored.
Syntax:
On Cancel [command]
Parameters:
command
Reserved Variables: $Result
$Error
(Optional) command to execute if Esc is pressed. If no
command is specified, then $Cancel is set to 0 and On
Cancel processing is disabled (same effect as executing
Set Cancel Off).
Unchanged.
Unchanged.
NOTE: The command that is executed may set $Result and $Error.
Example:
The following example enables the Cancel operation, then specifies
what to do when the user cancels (by pressing Esc).
Set Cancel On;enable Cancel operation
;specify where to branch when Esc pressed
On Cancel GoTo @cancel
;dial an online service
Dial OnlSvc "CompuServe"
;wait for a specific string
Wait String "Enter password"
...
;control goes here when Esc pressed
@cancel:
Type String "^M^JOperator canceled"
See Also:
On Disconnect, On Error, On Receive, On Timeout, Set Cancel
Chapter 4 • Script Language Command Reference
On Disconnect
Description:
Use On Disconnect to specify the command to execute if a connection
is lost. If the previous Set Disconnect command was set to on and the
connection is lost, the command following the On Disconnect
command is executed. If Set Disconnect was not executed or set to off,
On Disconnect is ignored.
Syntax:
On Disconnect [command]
Parameters:
command
Reserved Variables: $Result
$Error
(Optional) command to execute if the connection is lost.
If no command is specified, then $Disconnect reserved
variable is set to 0 and On Disconnect processing is
disabled (same effect as executing Set Disconnect Off).
Unchanged.
Unchanged.
NOTE: The command that is executed may set $Result and $Error.
Example:
The following example enables the Disconnect operation, then specifies
what to do when the connection is lost.
Set Disconnect On;enable disconnect operation
;specify where to branch when connection is lost
On Disconnect GoTo @disconnect
;attempt to connect with CompuServe
Dial OnlSvc "CompuServe"
Wait Time 2
;send Ctrl+C to alert online service
Send Char 3
;end script processing and return to terminal mode
End Terminal
;control branches here when connection is lost
@disconnect:
End
See Also:
On Cancel, On Error, On Receive, On Timeout, Set Disconnect
129
130
Chapter 4 • Script Language Command Reference
On Error
Description:
Use On Error to specify the command to execute when the $Error
reserved variable is set to a non-zero value by another command. It
applies to errors that occur within the same script and as a result of
commands executed after the On Error command is executed. Each
nested script must declare its own On Error as appropriate.
The On Error command does not reset $Error to zero before the next
command is executed. You should manually reset $Error=0 to avoid
reprocessing one error over and over.
Syntax:
On Error [command]
Parameters:
command
Reserved Variables: $Result
$Error
(Optional) command to execute if an error occurs. If no
command is specified, then On Error execution is
disabled.
Unchanged.
Unchanged.
NOTE: The command that is executed may set $Result and $Error.
Example:
In the following example, if an error occurs between the On Error
command and the End command, script control transfers to the label
named @error.
$Error = 0;set $Error to 0
;specify where to branch when an error occurs
On Error GoTo @error
;attempt to connect with CompuServe
Dial OnlSvc "CompuServe"
;end script processing and return to terminal mode
End Terminal
Wait Carrier
;send carriage return to alert CompuServe
Send Char 13
@end:
End;end script processing
@error:;prints messages to screen
Chapter 4 • Script Language Command Reference
Type Line "An error has occurred.^M^J"
Type Line "Ending script processing."
GoTo @end
See Also:
On Cancel, On Disconnect, On Receive, On Timeout
On Receive
Description:
Use On Receive to specify a command to execute if the specified string
is received during the execution of a Wait or Receive command. If no
parameters are set, the On Receive command is disabled. This
command is most useful for automatic transmission of passwords and
other codes.
Syntax:
On Receive [string command]
Parameters:
string
String literal or string variable containing the characters
that, if received, cause the command to execute.
command
Command to execute if string is received. To disable On
Receive processing, don’t specify a command.
Reserved Variables: $Result
Unchanged.
$Error
Unchanged.
$RXString
Stores specified string.
NOTE: The command that is executed may set $Result and $Error.
Example:
The following example enables On Receive and specifies a GoSub
command to execute if “Enter password:” is received.
On Receive "Enter password: " GoSub @sendPW
;wait for this string, but if "Enter password:" is received,
then branch to subroutine
Wait String "Enter selection: "
End;end script processing
@sendPW:
;send password followed by carriage return
Send String "acx14^M"
131
132
Chapter 4 • Script Language Command Reference
Return;return control to calling point
See Also:
On Cancel, On Disconnect, On Error, On Timeout
On Timeout
Description:
Use On Timeout to specify a command to be executed if nothing is
entered or received in the time allotted and a timeout occurs. If the time
limit set previously by a Set Timeout command expires, the command
following the On Timeout command is processed. If Set Disconnect was
not executed or set to Off, the On Timeout command is ignored.
Syntax:
On Timeout [command]
Parameters:
command
Reserved Variables: $Result
$Error
(Optional) command to execute if the allotted time
expires. If command is not specified, then On Timeout
processing is disabled and the $Timeout reserved
variable is set to 0.
Unchanged.
Unchanged.
NOTE: The command that is executed may set $Result and $Error.
Example:
The following example sets a Timeout value of 60 seconds. The On
Timeout command indicates what the script will do if that time limit is
exceeded.
Set Timeout 60;set the default timeout value
;specify where to branch if timeout occurs
On Timeout GoTo @timeout
;wait for a specific string
Wait String "Enter password: "
...
;control goes here if timeout occurs
@timeout:
Type Line "Timeout!"
Type Line "Exiting..."
Exit
See Also:
On Cancel, On Disconnect, On Error, On Receive
Chapter 4 • Script Language Command Reference
Open
Description:
This command applies to the remote PC only. Use it to open an existing
file for reading or writing. No more than nine files can be open at the
same time. This command can be used in scripts that perform remote
control sessions so long as the command is not executed during the
remote control session.
TIP: To prevent “File not found” errors from occurring, specify a “C”
attribute in addition to other attributes. This flag tells pcANYWHERE to
create the file if it doesn’t exist and prevents script processing from
interruption. This is especially helpful during unattended sessions.
Syntax:
Open file_number filename [attributes]
Parameters:
file_number
Integer literal used to identify the file. Valid identifiers are
1 through 9.
filename
String literal or string variable containing the name of the
file to open.
attributes
(Optional) string literal or string variable used to set the
attributes of the file. The default is non-sharable read/
write.
The following are valid attribute settings:
Reserved Variables: $Result
$Error
Example:
R
Read-only
W
Read/write
S
Sharable
C
Create file if it doesn’t already exist
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example opens FILE1.TXT as a sharable read/write file in
the current directory. The file must already exist.
Open 1 "file1.txt" "SW"
Or,
133
134
Chapter 4 • Script Language Command Reference
String filename[12]
;assign the filename to the string variable
filename = "file1.txt"
;create the new file with read/write attributes
Open 1 filename "CW"
See Also:
Close, Copy, Create, Del, Ren
Print File
Description:
Use this command to print a file to the remote PC’s current printer. This
command can be used in scripts that perform remote control sessions so
long as the command is not executed during the remote control session.
Syntax:
Print File filename
Parameters:
filename
Reserved Variables: $Result
$Error
Example:
String literal or string variable containing the full path
and filename of the file to print.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example prints TEST.SCR using the current printer.
String filename[80]
filename = "c:\aw\test.scr"
Print File filename;print the file
See Also:
Print Line, Print String, Printer
Print Line
Description:
Use this command to print a string to the remote PC’s current printer.
Once the string has been printed, the contents of the reserved variable
$TLineEnd are also printed. The default value for $TLineEnd is a single
carriage return and a single linefeed (^M^J). This command can be used
in scripts that perform remote control sessions so long as the command
is not executed during the remote control session.
Syntax:
Print Line string
Parameters:
string
String literal or string variable containing the information
to print.
Chapter 4 • Script Language Command Reference
Reserved Variables: $Result
$Error
Example:
Set to number of characters output. The quotation marks
surrounding the string are not included in the count, but
the contents of $TLineEnd are. If an error occurs, set to
the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example prints “abc” followed by the contents of
$TLineEnd.
Print Line "abc"
See Also:
Print File, Print String, Printer
Print String
Description:
Use this command to print a string to the remote PC’s current printer.
The Print String command differs from Print Line in that $TLineEnd is
not appended to the end of the string. This command can be used in
scripts that perform remote control sessions so long as the command is
not executed during the remote control session.
Syntax:
Print String string
Parameters:
string
Reserved Variables: $Result
$Error
Example:
String literal or string variable containing the information
to print.
Set to number of characters output. The quotation marks
surrounding the string are not included in the count. If
an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example prints "abc" followed by a carriage return and a
linefeed.
Print String "abc^M^J"
See Also:
Print File, Print Line, Printer
Printer
Description:
Use this command to turn simultaneous printing on and off. When on,
data that is sent to the screen is also sent to the remote PC’s current
135
136
Chapter 4 • Script Language Command Reference
printer. This includes screen sequences used to perform special
functions, such as repositioning the cursor or setting screen attributes.
Simultaneous printing occurs in the following situations:
■ Data received when after a Set Echo On command
■
Output from a File, Type Line, and Type String commands
■
Data received in terminal mode after a Printer On command
This command can be used in scripts that perform remote control
sessions so long as the command is not executed during the remote
control session.
Syntax:
Printer On | Off
Parameters:
On
Toggles simultaneous printing on.
Off
Toggles simultaneous printing off.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example turns simultaneous printing on, sends data to
the printer, then turns the printing off.
Printer On
Type Line "This is sent to the printer."
Type Line "^M^J"
Printer Off
Type Line "This is not sent to the printer."
See Also:
Print File, Print Line, Print String, Set Echo, Type File, Type Line, Type
String
RD
Description:
This command applies to the remote PC only. Use it to remove an
empty directory. This command can be used in scripts that perform
remote control sessions so long as the command is not executed during
the remote control session.
Syntax:
RD dirname
Parameters:
dirname
Reserved Variables: $Result
String literal or string variable containing the full name
and path of the directory you want to remove.
Set to 0. If an error occurs, set to the value of $Error.
Chapter 4 • Script Language Command Reference
$Error
Example:
If the directory is not empty, $Error is set to -33. See
Appendix B, “Error Messages.”
The following example removes the TEMP directory.
RD "C:\TEMP"
The next example prompts the user for a directory to remove.
String deldir[66]
Type Line "Enter the directory: "
;read path (input by user) into the deldir variable
Input deldir 66
;remove the directory
RD deldir
The last example removes a directory whose path is read from a file.
string deldir[66]
;open the data file, read a path from it,
;and close the file
Open 1 "DATAFILE.TXT"
Read String 1 deldir 66
Close 1
;remove the directory
RD deldir
See Also:
CD, Dir, MD, SessOpr Host Run, SessOpr Remote Run
Read Line
Description:
This command applies to the remote PC only. Use it to read a line from
a file and store it in a variable. By default, a line is terminated by an
end-of-line character. You can specify the line length to a maximum of
255 characters. This command can be used in scripts that perform
remote control sessions so long as the command is not executed during
the remote control session.
NOTE: A terminating character of 0xFF (255 in decimal) cannot be
used.
Syntax:
Read Line file_number data_string [length
[termchar]]
137
138
Chapter 4 • Script Language Command Reference
Parameters:
file_number
Integer literal used by Open or Create command to
identify the file. Valid identifiers are 1 through 9.
data_string
String variable where the data is stored. The terminating
characters are not stored.
length
(Optional) integer literal or integer variable specifying
the maximum number of characters to read. The default
value is the declared length of data_string. Termination
characters are not included.
termchar
(Optional) A literal or variable (that can be either an
integer or string type) specifying the line’s terminator.
The default terminator is the contents of $RLineEnd
(whose default value is a carriage return/linefeed). A
terminating character is expressed as its ASCII decimal
equivalent. (For example, a carriage return is expressed
as ASCII decimal 13.) To specify a terminating character,
you must also specify the length parameter. To specify
more than one terminating character, use a string literal
or string variable and separate the ASCII values for the
characters with a space.
Reserved Variables: $Result
$Error
Example:
Set to the number of characters read. If an error occurs,
set to the value of $Error. When an end-of-file marker is
encountered, $Result is set to -12.
Standard errors. See Appendix B, “Error Messages.”
The following example opens a data file, reads a line containing a path
from it, and closes the file. Then the script changes the current directory
to that path.
string newpath[66]
Open 1 "datafile.txt"
Read Line 1 newpath 66
Close 1
;change directory to the newpath variable
CD newpath
See Also:
Read String, Write Line, Write String
Chapter 4 • Script Language Command Reference
Read String
Description:
This command applies to the remote PC only. Use it to read a string of
characters from a file and store it in a variable. Each read command
advances the file pointer. This command can be used in scripts that
perform remote control sessions so long as the command is not
executed during the remote control session.
Syntax:
Read String file_number data_string [length]
Parameters:
file_number
Integer literal used by Open or Create command to
identify the file. Valid identifiers are 1 through 9.
data_string
String variable which stores the data. The terminating
characters are not stored.
length
(Optional) integer literal or integer variable specifying
the maximum number of characters to read. The default
value is the declared length of data_string.
Reserved Variables: $Result
$Error
Example:
Set to the number of characters read. If an error occurs,
set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example opens the data file, reads its first 80 characters,
its next 52 characters, then closes the file.
String data1[80]
String data2[80]
Open 1 "datafile.txt"
Read String 1 data1 80
Read String 1 data2 52
Close 1
See Also:
Read Line, Write Line, Write String
Receive Char
Description:
Use this command to receive a single character from the
communications port and store it in a variable.
139
140
Chapter 4 • Script Language Command Reference
Syntax:
Receive Char data [timeout]
Parameters:
data
Integer variable or string variable where the received
character is stored. If data is a string variable, the
character received is stored in the first position in the
string.
timeout
(Optional) integer defining a timeout value (in seconds).
If this parameter is omitted, the current $Timeout value
is used.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example retrieves and displays characters until six
seconds goes by without a character being typed.
String char[1]
Set Timeout 6;6 second time limit set
;where to branch when time expires
On Timeout GoTo @end
@loop:
Receive Char char;receive a character into char
Type String char;display char
GoTo @loop
@end:
;on timeout display message
Type Line "Timeout!"
Exit
See Also:
Set Cancel, Set Disconnect, Set Timeout, Send commands, other Receive
commands
Receive Clear
Description:
Use this command to clear the receive buffer of any data not yet read
using Receive commands.
Syntax:
Receive Clear
Reserved Variables: $Result
Set to 0. If an error occurs, set to the value of $Error.
Chapter 4 • Script Language Command Reference
$Error
Example:
Standard errors. See Appendix B, “Error Messages.”
The following example clears the receive buffer and receives a string
into the data variable.
String data[60]
Receive Clear
Receive String data
See Also:
Set Cancel, Set Disconnect, Set Timeout, Send Commands, other Receive
commands
Receive File
Description:
Use this command to receive a file using the protocol previously
specified by a Set Protocol command. During the transfer, a status
screen displays the transfer’s progress.
Syntax:
Receive File [filename]
Parameters:
filename
Reserved Variables: $Result
$Error
Example:
(Optional) string literal or string variable containing the
path and filename where the incoming file will be stored.
Some protocols do not allow you to specify a filename,
since part of the protocol dictates that the sender informs
the receiving machine what filename to use.
Set to a non-negative integer value. If an error occurs, set
to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example performs a file transfer using the XMODEM
protocol.
Set Protocol XMODEM
Receive File "c:\data\datafile.txt"
See Also:
Set Cancel, Set Disconnect, Set Timeout, Send Commands, other Receive
commands
141
142
Chapter 4 • Script Language Command Reference
Receive Line
Description:
Use this command to receive a string from the communications port and
store it in a variable. The Receive Line command is terminated when
one of the following occurs:
■ The string has been filled
■
A line terminating sequence has been specified: either termchar
(if it has been specified) or the characters equal to $RLineEnd (if
termchar has not been specified)
■
The elapsed time is equal to the specified timeout value
NOTE: A terminating character of 0xFF (255 decimal) is not allowed.
Syntax:
Receive Line data_string [length [termchar
[timeout]]]
Parameters:
data_string
String variable used to store the received data. The
terminating characters are not stored.
length
(Optional) integer literal or integer variable specifying
the maximum number of characters to read. The default
value is the declared length of data_string. Termination
characters are not included.
termchar
(Optional) A literal or variable (that can be either an
integer or string type) specifying a line terminator. The
default terminator is the contents of $RLineEnd (whose
default value is a carriage return/linefeed). A terminating
character is expressed as its ASCII decimal equivalent.
(For example, a carriage return is expressed as ASCII
decimal 13.) To specify a terminating character, you must
also specify the length parameter. To specify more than
one terminating character, use a string literal or string
variable and separate the ASCII values for the characters
with a space.
timeout
(Optional) integer defining a timeout value (in seconds).
If this parameter is omitted, the current $Timeout value
is used. To specify a timeout value, you must also specify
values for both length and termchar.
Chapter 4 • Script Language Command Reference
Reserved Variables: $Result
$Error
Example:
Set to the length of the received string. If an error occurs,
set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example receives the first 80 characters of the line into
the data variable.
String data[80]
Receive Line data
The next example receives characters into the data variable until the first
of three situations occur: 50 characters have been received, a carriage
return has been encountered, or 20 seconds have elapsed.
String data[80]
Receive Line data 50 13 20
See Also:
Set Cancel, Set Disconnect, Set Timeout, Send Commands, other Receive
commands
Receive String
Description:
Use this command to receive a string from the communications port and
store it in a variable. Input is terminated when the string is full, when
the specified length has been read or when the timeout value has
elapsed.
Syntax:
Receive String data_string [length [timeout]]
Parameters:
data_string
String variable used to store the received data. The
terminating characters are not stored.
length
Integer literal or integer variable specifying the maximum
number of characters to read. The default value is the
declared length of data_string.
timeout
(Optional) integer defining a timeout value (in seconds).
If this parameter is omitted, the current $Timeout value
is used. If you specify a timeout value, you must also
specify a value for length.
Reserved Variables: $Result
Set to the length of the received string. If an error occurs,
set to the value of $Error.
$Error
The error value for a timeout is -4. See Appendix B,
“Error Messages.”
143
144
Chapter 4 • Script Language Command Reference
Example:
The following example receives the first 30 characters into the data
variable.
String data[80]
Receive String data 30
The following example receives 20 characters into the data variable or
times out after 10 seconds.
String data[80]
Receive String data 20 10
See Also:
Set Cancel, Set Disconnect, Set Timeout, Send Commands, other Receive
commands
Ren
Description:
This command applies to the remote PC only. Use it to change the name
of a file or directory. The Ren command moves a file from one directory
to another if you specify a different pathname, but cannot be used to
move a file from one drive to another. This command can be used in
scripts that perform remote control sessions so long as the command is
not executed during the remote control session.
Syntax:
Ren old_name new_name
Parameters:
old_name
String literal or string variable containing the original
path and filename or directory.
new_name
String literal or string variable containing the new name
of the file or directory. The new name must not be the
name of an existing file or directory.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example renames DRAFT1.TXT to DRAFT2.TXT.
Ren "draft1.txt" "draft2.txt"
The next example prompts the user for the new name of a file.
String newname[12]
Type Line "Enter the name of the new file: "
Input newname
Chapter 4 • Script Language Command Reference
Ren "draft1.txt" newname
See Also:
Close, Copy, Create, Del, Open, SessOpr Host Run, SessOpr Remote
Run
Reset
Description:
Use this command to reset the terminal emulation screen displayed on
the remote PC. The screen is cleared of all characters, and the video
attribute is cleared and reset to normal. All special modes, such as
simultaneous print and monitor, are set to off. The cursor is moved to
row 1, column 1.
Syntax:
Reset
Reserved Variables: $Result
$Error
Example:
Set to 0.
Unchanged.
The following example resets the terminal emulation screen. You may
want to use it between calls to different online services.
Reset;reset terminal
See Also:
Emulate, Terminal
Return
Description:
Use this command to terminate the processing of a subroutine. Control
is passed back to the line immediately following the GoSub command
that initiated the subroutine.
Syntax:
Return [return_code]
Parameters:
return_code
Reserved Variables: $Result
$Error
Example:
(Optional) integer literal or integer variable passed back
to the calling script. Its value is also stored in $Result.
Set to return_code. If return_code is not used, set to 0.
Standard errors. See Appendix B, “Error Messages.”
The subroutine in the following example asks the user for a string, then
determines and returns the length of that string. After the subroutine
terminates, the string is sent through the communications port (unless
its length is 0).
145
146
Chapter 4 • Script Language Command Reference
String instring
Integer len
GoSub @getInput;call getInput subroutine
;if no input, end processing
If (len == 0) GoTo @end
Send String instring;send instring
@end:
End
@getInput:;begin getInput subroutine
Input instring;retrieve user entry string
;get string length of instring
StrLen instring len
;return string length of instring to caller
Return len
See Also:
GoTo, GoSub, Link, Script
Run
Description:
This command applies to the remote PC only. Use it to execute a DOS
or Windows command line on the remote PC.
NOTE: An application may not be able to run if there is not sufficient
memory available.
Syntax:
Run command_line
Parameters:
command_line String literal or string variable containing the full path
and application to execute. If no path is specified, the
current directory and the PATH is searched. In addition
to the executable filename, you can specify parameters.
Reserved Variables: $Result
$Error
Example:
Set to the DOS errorlevel.
Standard errors. See Appendix B, “Error Messages.”
The following example runs EDIT.COM.
Run "c:\dos\edit.com";run DOS editor
Chapter 4 • Script Language Command Reference
In the Windows environment, the next example loads AUTOEXEC.BAT
into NOTEPAD.EXE, ready for editing.
String launch[40]
launch = "c:\windows\notepad.exe c:\autoexec.bat"
;launch Windows Notepad and load autoexec.bat file
Run launch
See Also:
End, End Menu, End Terminal, Exit
Screen Restore
Description:
This command applies to the remote PC’s display buffer. Use it to
restore a previously saved screen image, including cursor position and
attributes. The Screen Restore command is ignored if no image has been
saved.
Syntax:
Screen Restore
Reserved Variables: (none)
Example:
The following example saves the contents of the screen and later
restores those contents.
;move the cursor to row 12, column 20
Cursor Position 12 20
Dir;display the current directory
Screen Save;save the screen
Clear Screen;clear the screen
Screen Restore;restore the screen
See Also:
Clear Screen, Screen Save, Type File, Type Line, Type String
Screen Save
Description:
This command applies to the remote PC’s display buffer. Use it to take a
snapshot of the screen. Everything on the screen, including the cursor
type and position, is stored to a buffer so that it can be restored later in
the script. To restore the screen, use Screen Restore. For example, when
an error occurs that requires the user’s attention, save the screen,
display information that lets the user remedy the error, then restore the
screen and continue processing.
147
148
Chapter 4 • Script Language Command Reference
Syntax:
Screen Save
Reserved Variables: (none)
Example:
The following example saves the contents of the screen and later
restores those contents.
;move the cursor to row 12, column 20
Cursor Position 12 20
Dir;display the current directory
Screen Save;save the screen
Clear Screen;clear the screen
Screen Restore;restore the screen
See Also:
Clear Screen, Screen Restore, Type Line, Type File, Type String
Script
Description:
Use this command to launch a second script from within the current
script. The first script is the calling script, and the second script is the
called script.
Control returns to the first script when the second script terminates
(with an End command), and the first script’s execution continues at the
line immediately following the one containing the Script command.
Scripts can be nested ten levels deep.
Syntax:
Script script_name
Parameters:
script_name
Reserved Variables: $Result
$Error
Example:
String literal or string variable containing the name of the
script to execute. Do not include the .SCR filename
extension.
Set to the integer value (if any) returned from the second
script when it ends.
Standard errors. See Appendix B, “Error Messages.”
In the following example, MAIN.SCR calls ANOTHER.SCR. After
ANOTHER.SCR completes, MAIN.SCR continues executing.
MAIN.SCR
Integer $1, $2;declare $1 and $2 as global integers
$1 = 5
$2 = 5
Type Line "The value is: "
Chapter 4 • Script Language Command Reference
Script ANOTHER;call ANOTHER.SCR script file
;print product of $1 and $2 (25) to the screen
Type Line $Result
End Terminal;end script processing
ANOTHER.SCR
value = $1 * $2;calculate product of $1 and $2
;end script processing, return control
;and pass value to MAIN.SCR
End value
See Also:
GoSub, GoTo, Link, Return
Seek
Description:
This command applies to the remote PC only. Use it to position the file
pointer at a specified location in the file. The next Read or Write
command starts at that position. This command can be used in scripts
that perform remote control sessions so long as the command is not
executed during the remote control session.
Syntax:
Seek file_number offset option
Parameters:
file_number
Integer literal used by the Open or Create command to
identify the file. Valid identifiers are 1 through 9.
offset
Integer literal or integer variable containing the number
of spaces to move, or offset, from the starting point
specified by the option parameter. A positive number
moves the pointer to the right; a negative number moves
the pointer to the left.
option
Integer literal or integer variable declaring the starting
point for the offset parameter.
Valid values for option are:
Value
Result
0
Moves the pointer to the beginning of the file and then
moves the pointer the value of offset. (Offset must be
positive.)
149
150
Chapter 4 • Script Language Command Reference
Value
Result
1
Moves the pointer from the current position the value of
offset.
2
Moves the pointer to the end of the file plus the value of
offset. (Offset must be negative.)
Reserved Variables: $Result
$Error
Example:
Set to the new position of the pointer within the file. If
an error occurs, set to the value of $Error. If you move
the pointer past either end of the file, the end-of-file error
(-12) occurs.
Standard errors. See Appendix B, “Error Messages.”
The following example opens a sharable read/write file
(NEWFILE.TXT), moves the read/write pointer to the end, appends a
string, then closes the file.
Open 1 "newfile.txt" "SW"
Seek 1 0 2
Write String 1 "End of File."
Close 1
See Also:
Close, Open, Read Line, Read String, Write Line, Write String
Send Char
Description:
Use this command to send a single character using the currently active
communications device. You can send characters as strings or their
ASCII decimal value.
Syntax:
Send Char character
Parameters:
character
Reserved Variables: $Result
$Error
Example:
A literal or variable (that can be either an integer or string
type) containing the character to send. If a string is
specified, only the first character of the string is sent.
Set to a non-negative integer value. If an error occurs, set
to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example sends a carriage return followed by an A.
Send Char 13;send a carriage return
Chapter 4 • Script Language Command Reference
Send Char "A";send the character "A"
See Also:
Receive Char, Receive Clear, Receive File, Receive Line, Receive String,
Send Clear, Send File, Send Line, Send String
Send Clear
Description:
Use the command to clear the send buffer of any data not yet
transmitted. Data can be in the send buffer if the communications rate is
slow (such as a low serial data rate) or if the transmission is halted due
to a flow control error or recovery situation.
Syntax:
Send Clear
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example clears the send buffer before it sends a string.
String string1[14]
string1 = "Initializing..."
Wait Silence 5;wait for 5 seconds of line silence
Send Clear;clear the send buffer
Send String string1
See Also:
Receive Char, Receive Clear, Receive File, Receive Line, Receive String,
Send Char, Send File, Send Line, Send String
Send File
Description:
Use this command to send a file using the protocol specified by the Set
Protocol command. When the transfer begins, a status screen displays
the transfer’s progress.
Syntax:
Send File filename
Parameters:
filename
Reserved Variables: $Result
$Error
String literal or string variable containing the full name
and path of the outgoing file. For multi-file protocols, the
name may contain wildcards (? or *).
Set to a non-negative integer value. If an error occurs, set
to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
151
152
Chapter 4 • Script Language Command Reference
Example:
The following example sends a file using the ZMODEM protocol.
Set Protocol zmodem
Send File "c:\data\datafile.txt"
See Also:
Receive Char, Receive Clear, Receive File, Receive Line, Receive String,
Send Char, Send Clear, Send Line, Send String
Send Line
Description:
Use this command to send a string and its terminating character through
the communications port. The terminating character is the value of the
reserved variable $SLineEnd (whose default value is a carriage return).
Syntax:
Send Line string
Parameters:
string
Reserved Variables: $Result
$Error
Example:
String literal or string variable containing the data to
send.
Set to the number of characters sent. If an error occurs,
set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example sends a string followed by the line-terminating
character(s) in $SLineEnd.
String string1[14]
string1 = "Processing..."
Send Line string1;send string1
See Also:
Receive Char, Receive Clear, Receive File, Receive Line, Receive String,
Send Char, Send Clear, Send File, Send String
Send ScanCode
Description:
Use this command to translate each character of the specified string to
one or more IBM scan codes, then send them through the current
communications port.
Syntax:
Send ScanCode string [length]
Chapter 4 • Script Language Command Reference
Parameters:
string
String literal or string variable containing the data to
send.
length
(Optional) integer containing the number of characters to
send. The default value is the size of string.
Reserved Variables: $Result
$Error
Example:
Set to the number of characters sent. If an error occurs,
set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example sends the codes for D, I, R, Ctrl, and M. Ctrl+M
is a carriage return.
Send ScanCode "Dir^M"
The next example sends codes for W, e, l, c, o, m, e and !.
String string1[14]
string1 = "Welcome!"
Send ScanCode string1
See Also:
Dial Host
Send String
Description:
Use this command to send a string through the communications port.
The entire string is sent, unless a length is specified. No terminating
characters are sent.
Syntax:
Send String string [length]
Parameters:
string
String literal or string variable containing the data to
send.
length
(Optional) integer literal or integer variable containing
the number of characters to send. The default value is the
size of string.
Reserved Variables: $Result
$Error
Example:
Set to the number of characters sent. If an error occurs,
set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example sends a password.
String password[14]
password = "parley"
153
154
Chapter 4 • Script Language Command Reference
Send String password
See Also:
Receive Char, Receive Clear, Receive File, Receive Line, Receive String,
Send Char, Send Clear, Send File, Send Line
Session Delay
Description:
Use this command to specify the number of minutes between retries of
the Session Dial command.
Syntax:
Session Delay [minutes]
Parameters:
minutes
(Optional) integer literal or integer variable containing
the number of minutes to delay. The default is 0.
Reserved Variables: (none)
Example:
The following example calls the Office PC and sends a file remotely.
The Session Delay command stipulates the number of minutes to wait
before redialing.
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
;what to do if file conflict occurs
Session Overwrites Older
;set the timeout value in seconds
Session Timeout 10
;set the number of retries to attempt
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
;send a file from the remote to the host
SessOpr Remote Send "c:\data\wk1030.txt"
Session End;terminate the session
See Also:
Session Dial, Session End, Session ExitMode, Session Retry, Session
Overwrites, Session Timeout, SessOpr Host Run, SessOpr Host Send,
SessOpr Remote Run, SessOpr Remote Send
Chapter 4 • Script Language Command Reference
Session Dial
Description:
Use this command to initiate a remote control session by dialing a
pcANYWHERE host PC.
Syntax:
Session Dial host_name [time [date]] [script_name]
Parameters:
host_name
String literal or string variable containing the name of the
remote control session configuration.
time
(Optional) integer literal or integer variable containing
the time of day that you want to first attempt the connect.
The time format is HHMM. The default is the current
time.
date
(Optional) integer literal or integer variable containing
the date to first attempt the connect. The date parameter
cannot be used unless a value for time is also specified.
Its format is YYMMDD. The default is the current date.
script_name
(Optional) string literal or string variable containing the
name of the script file to launch after connection is made.
Do not include the .SCR file extension.
Reserved Variables: $Result
$Error
Example:
Set to a non-negative integer value. If an error occurs, set
to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example calls the Office PC and sends a file remotely.
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
;what to do if file conflict occurs
Session Overwrites Older
;set the timeout value in seconds
Session Timeout 10
;set the number of retries to attempt
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
155
156
Chapter 4 • Script Language Command Reference
;send a file from the remote to the host
SessOpr Remote Send "c:\data\wk1030.txt"
Session End;terminate the session
See Also:
Session Delay, Session End, Session ExitMode, Session OnError, Session
Overwrites, Session Retry, Session Timeout, SessOpr Host Run, SessOpr
Host Send, SessOpr Remote Run, SessOpr Remote Send
Session End
Description:
Use this command to terminate a session initiated with a Session Dial
command. If the phone is still connected when the Session End
command is executed, the phone is hung up.
Syntax:
Session End
Reserved Variables: (none)
Example:
The following example calls the Office PC and sends a file remotely.
Then it terminates the session.
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
;what to do if file conflict occurs
Session Overwrites Older
;set the timeout value in seconds
Session Timeout 10
;set the number of retries to attempt
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
;send a file from the remote to the host
SessOpr Remote Send "c:\data\wk1030.txt"
Session End;terminate the session
...
See Also:
Session Delay, Session Dial, Session ExitMode, Session OnError, Session
Overwrites, Session Retry, Session Timeout, SessOpr Host Run, SessOpr
Host Send, SessOpr Remote Run, SessOpr Remote Send
Chapter 4 • Script Language Command Reference
Session ExitMode
Description:
Use this command to specify the state in which to leave the host PC
when a remote control session terminates. This command must be
executed before the Session Dial command. If the host PC is configured
to prevent the remote user from modifying the host state, this command
has no effect.
Syntax:
Session ExitMode Wait | Idle | Accept | Original |
Cancel
Parameters:
Wait
Disconnects remote user from the host, leaving the
pcANYWHERE host as the active application. No host
activities can be performed until there is a connection.
See note below.
Idle
Disconnects remote user from the host, leaving
pcANYWHERE running in the background. A session
cannot begin until a host user presses the host hotkey.
See note below.
Accept
Disconnects remote user from the host, leaving the host
to automatically accept another call. pcANYWHERE stays
in memory and a session starts when a remote user calls
the host—no action is required from the host user. In
fact, the host user cannot prevent calls from coming in.
Also use this mode when you want to start a possibly
long job on the host, hang up, then call back later to
check the results. The host PC can continue processing
even though the remote PC is no longer watching.
Original
Disconnects remote user from the host and leaves the
host in the same state it was in before the remote session
occurred.
Cancel
Disconnects remote user from the host and removes the
host software from memory, preventing the host from
accepting incoming calls.
157
158
Chapter 4 • Script Language Command Reference
NOTE: In pcANYWHERE for Windows, when the host TSR is not
running, Idle and Wait have the same functionality as Accept.
Reserved Variables: $SesHostExitModeSet to 0 for Wait, 1 for Idle, 2 for Accept, 3 for Original,
or 4 for Cancel.
Example:
The following example sets the exit mode to accept, calls the Office PC,
and sends a file remotely.
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
;what to do if file conflict occurs
Session Overwrites Older
;set the timeout value in seconds
Session Timeout 10
;set the number of retries to attempt
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
;send a file from the remote to the host
SessOpr Remote Send "c:\data\wk1030.txt"
Session End;terminate the session
See Also:
Session Delay, Session Dial, Session End, Session OnError, Session
Overwrites, Session Retry, Session Timeout, SessOpr Host Run, SessOpr
Host Send, SessOpr Remote Run, SessOpr Remote Send
Session OnError
Description:
Use this command to specify what should occur if one of the following
commands fails: SessOpr Host Run, SessOpr Host Send, SessOpr
Remote Run, or SessOpr Remote Send. The command can terminate the
script or allow processing to continue. This command takes precedence
over the On Error command.
The Session OnError command does not reset $Error to zero before the
next command is executed. You should do that to avoid reprocessing
one error over and over.
Syntax:
Session OnError Ignore | Next | End
Chapter 4 • Script Language Command Reference
Parameters:
Ignore
Ignores the command that caused the error and advances
to the next command.
Next
Advances to the matching Session End command.
End
Ends the script and returns control to pcANYWHERE.
Reserved Variables: $SesOnError
Example:
Set to 0 for Ignore, 1 for Next, or 2 for End.
The following example specifies that the script should end if an error
occurs. Then it calls the Office PC and sends a file remotely.
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
;what to do if file conflict occurs
Session Overwrites Older
;set the timeout value in seconds
Session Timeout 10
;set the number of retries to attempt
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
;send a file from the remote to the host
SessOpr Remote Send "c:\data\wk1030.txt"
Session End;terminate the session
See Also:
Session Delay, Session Dial, Session End, Session ExitMode, Session
Overwrites, Session Retry, Session Timeout, SessOpr Host Run, SessOpr
Host Send, SessOpr Remote Run, SessOpr Remote Send
Session OverWrites
Description:
Use this command to specify whether or not to overwrite existing files
during the execution of a SessOpr Host Send or SessOpr Remote Send
command. Execute this command before attempting file transfers, so
script execution is not suspended when a conflict occurs.
Syntax:
Session OverWrites Always | Never | Older
Parameters:
Always
Causes the destination file to be overwritten.
Never
Causes the file sent to be ignored.
159
160
Chapter 4 • Script Language Command Reference
Older
Causes the file at the destination to be overwritten if the
file being transferred is more recent (compares date/time
stamp).
Reserved Variables: $SesOverwrites Set to 0 for Always, 1 for Never, or 2 for Older.
Example:
The following example specifies that transferred files can overwrite files
that are older. Then it calls the Office PC and sends a file remotely.
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
;what to do if file conflict occurs
Session OverWrites Older
;set the timeout value in seconds
Session Timeout 10
;set the number of retries to attempt
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
;send a file from the remote to the host
SessOpr Remote Send "c:\data\wk1030.txt"
Session End;terminate the session
See Also:
Session Delay, Session Dial, Session End, Session ExitMode, Session
OnError, Session Retry, Session Timeout, SessOpr Host Run, SessOpr
Host Send, SessOpr Remote Run, SessOpr Remote Send
Session Retry
Description:
Use this command to specify the number of times to redial the host
specified in the Session Dial command.
Syntax:
Session Retry [count]
Parameters:
count
(Optional) integer literal or integer variable containing
the number of times to attempt initiating a session. The
default is 1.
Reserved Variables: (none)
Example:
The following example sets the number of retries to three. Then it calls
the Office PC and sends a file remotely.
Chapter 4 • Script Language Command Reference
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
;what to do if file conflict occurs
Session Overwrites Older
;set the timeout value in seconds
Session Timeout 10
;set the number of retries to attempt
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
;send a file from the remote to the host
SessOpr Remote Send "c:\data\wk1030.txt"
Session End;terminate the session
See Also:
Session Delay, Session Dial, Session End, Session ExitMode, Session
Overwrites, Session Timeout, SessOpr Host Run, SessOpr Host Send,
SessOpr Remote Run, SessOpr Remote Send
Session Timeout
Description:
Use this command to specify the inactivity timeout value (in seconds)
for a remote control session. This command is for DOS sessions only.
Syntax:
Session Timeout seconds
Parameters:
seconds
Reserved Variables: $SesTimeout
Example:
Integer literal or integer variable specifying the number
of seconds before a timeout occurs.
Set to specified number of seconds.
The following example specifies a timeout after 10 seconds, then calls
the Office PC and sends a file remotely.
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
;what to do if file conflict occurs
Session Overwrites Older
;set the timeout value in seconds
Session Timeout 10
;set the number of retries to attempt
161
162
Chapter 4 • Script Language Command Reference
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
;execute a file on the host
;edit.com ends when the user exits or when session timeout
seconds expire
SessOpr Remote Send “wk1030.txt” “mrd.txt”
SessOpr Host Run "c:\dos\edit.com"
Session End;terminate the session
See Also:
Session Delay, Session Dial, Session End, Session ExitMode, Session
OnError, Session Overwrites, Session Retry, SessOpr Host Run, SessOpr
Host Send, SessOpr Remote Run, SessOpr Remote Send
SessOpr Host Run
Description:
Use this command to launch an application on the host PC during a
session initiated with a Session Dial command. If you do not specify
Wait or NoWait, Wait is the default.
When using this command to run DOS commands from
COMMAND.COM, such as COPY, you must use COMMAND.COM with
the /C option as part of the command line:
SessOpr Host Run "command /c copy *.* b:"
Syntax:
SessOpr Host Run [Wait | NoWait] command_line
Parameters:
Wait
(Optional) causes the script to pause until the launched
program is completed. The launched program ends
when the user exits it or it is automatically terminated
after the number of seconds specified by the Session
Timeout command.
NoWait
(Optional) tries to launch the specified program and
continue. Used under Windows only.
command_line String literal or string variable containing the command
line for the application.
Reserved Variables: $Result
$Error
Set to the errorlevel returned by the application.
Standard errors. See Appendix B, “Error Messages.”
Chapter 4 • Script Language Command Reference
Example:
The following example calls the Office PC and remotely executes a file
on the host.
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
;what to do if file conflict occurs
Session Overwrites Older
;set the timeout value in seconds
Session Timeout 10
;set the number of retries to attempt
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
;execute file on the host
SessOpr Host Run "c:\dos\move.bat"
Session End;terminate the session
See Also:
Session Delay, Session Dial, Session End, Session ExitMode, Session
OnError, Session Overwrites, Session Retry, Session Timeout, SessOpr
Host Send, SessOpr Remote Run, SessOpr Remote Send
SessOpr Host Send
Description:
Use this command to send a file from the host PC to the remote PC
during a session initiated with a Session Dial command. It automates file
transfers when connected to a pcANYWHERE host. Be sure to use the
Session Overwrites command to specify what to do if the file you are
transferring already exists at the destination.
Syntax:
SessOpr Host Send "source""dest"
Parameters:
“source” “dest” String literal or string variable containing:
a
(Required) the complete or partial pathname to
the file(s) being sent. Wildcards (* or ?) are
permitted.
b
(Optional) a space followed by the complete or
partial destination pathname. If one file is sent,
this can be a filename.
163
164
Chapter 4 • Script Language Command Reference
The current directory is always the default path.
Reserved Variables: $Result
Set to the number of files actually sent. If an error occurs,
set to the value of $Error.
$Error
Example:
Standard errors. See Appendix B, “Error Messages.”
The following example calls the Office PC and copies a file from the
host.
Session
Session
Session
Session
Session
Session
ExitMode Accept;mode to leave host in
OnError End;what to do if error occurs
Overwrites Older
Timeout 10
Retry 3
Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session
;send a
SessOpr
Session
Dial "Office PC" 0400 940504
file from the host to the remote
Host Send "\budget\*.xls “ “\updates"
End;terminate the session
NOTE: To use the above sample script with pcANYWHERE,
version 5.0, the host must be configured to run AWSEND.
See Also:
Session Delay, Session Dial, Session End, Session ExitMode, Session
OnError, Session Overwrites, Session Retry, Session Timeout, SessOpr
Host Run, SessOpr Remote Run, SessOpr Remote Send
SessOpr Remote Run
Description:
Use this command to launch an application on the remote PC during a
session initiated with a Session Dial command. If you do not specify
Wait or NoWait, Wait is the default.
When using this command to run DOS commands from
COMMAND.COM, such as COPY, you must use COMMAND.COM with
the /C option as part of the command line:
SessOpr Remote Run "command /c copy *.* b:"
Syntax:
SessOpr Remote Run [Wait | NoWait] command_line
Chapter 4 • Script Language Command Reference
Parameters:
Wait
(Optional) causes the script to pause until the launched
program is completed. The launched program ends
when the user exits it or it is automatically terminated
after the number of seconds specified by the Session
Timeout command.
NoWait
(Optional) tries to launch the specified program and
continue. Used under Windows only.
command_line String literal or string variable containing the command
line for the application.
Reserved Variables: $Result
$Error
Example:
Set to the errorlevel returned by the application. If an
error occurs, set to the value $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example calls the Office PC then executes a file from the
remote.
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
Session Overwrites Older
Session Timeout 10
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
SessOpr Remote Run "c:\dos\copy.bat"
Session End;terminate the session
See Also:
Session Delay, Session Dial, Session End, Session ExitMode, Session
OnError, Session Overwrites, Session Retry, Session Timeout, SessOpr
Host Run, SessOpr Host Send, SessOpr Remote Send
SessOpr Remote Send
Description:
Use this to send a file from the remote PC to the host PC during a
session initiated with a Session Dial command. It automates file transfers
when connected to a pcANYWHERE host. Be sure to use the Session
Overwrites command to specify what to do if the file you are
transferring already exists at the destination.
165
166
Chapter 4 • Script Language Command Reference
Syntax:
SessOpr Remote Send "source""dest"
Parameters:
“source” “dest” String literal or string variable containing:
a
(Required) the complete or partial pathname to
the file(s) being sent. Wildcards (* or ?) are
permitted.
b
(Optional) a space followed by the complete or
partial destination pathname. If one file is sent,
this can be a filename.
The current directory is always the default path.
Reserved Variables: $Result
$Error
Example:
Set to the number of files actually sent. If an error occurs,
set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example calls the Office PC and sends a file remotely.
Session ExitMode Accept;mode to leave host in
Session OnError End;what to do if error occurs
;what to do if file conflict occurs
Session Overwrites Older
;set the timeout value in seconds
Session Timeout 10
;set the number of retries to attempt
Session Retry 3
;set the amount of time between retries in minutes
Session Delay 30
;dial Office PC at 4 A.M. on May 4, 1993
Session Dial "Office PC" 0400 940504
;send a file from the remote to the host
SessOpr Remote Send "wk1030.txt mrd.txt"
Session End;terminate the session
See Also:
Session Delay, Session Dial, Session End, Session ExitMode, Session
OnError, Session Overwrites, Session Retry, Session Timeout, SessOpr
Host Run, SessOpr Host Send, SessOpr Remote Run
Chapter 4 • Script Language Command Reference
Set Attribute
Description:
This command applies to the remote PC’s display buffer. Use it to set
colors and other screen attributes for subsequent characters output to
the screen. You can set only one attribute at a time, though you can
have more than one setting active. All changes effect the characters and
spaces following the current cursor position (not inclusive). Settings 1
through 7 are cumulative. Settings 22 through 27 are used to selectively
disable settings 1 through 7. Selecting setting 0 disables all settings 1
through 7.
You can have only one foreground and one background color active at
any time. For example, you can set the screen attributes to a blinking
blue foreground on a black background.
Syntax:
Set Attribute attribute
Parameters:
attribute
Integer literal or integer variable containing the attribute
setting.
Valid settings are:
Value
Video Attribute
0
Normal (disables settings 1 through 7)
1
Intense
4
Underline
5
Blink
7
Reverse
22
Intense Off
24
Underline Off
25
Blink Off
27
Reverse Off
167
168
Chapter 4 • Script Language Command Reference
Value
Foreground Colors
30
Black
31
Red
32
Green
33
Brown
34
Blue
35
Magenta
36
Cyan
37
Light Gray
Value
Background Colors
40
Black
41
Red
42
Green
43
Brown
44
Blue
45
Magenta
46
Cyan
47
Light Gray
Reserved Variables: (none)
Example:
The following examples set and then display a variety of attributes.
Set Attribute 30;set black foreground
Set Attribute 41;set red background
Type String "This is displayed black on red.^M^J"
Set Attribute 44;set blue background
Type String "And this is displayed black on blue.^M^J"
Set Attribute 5;set the text to blink
Type String "And this is displayed blinking black on blue."
Set Attribute 0;turn off the blinking
Chapter 4 • Script Language Command Reference
Type String "Now the blinking is turned off."
See Also:
Clear Screen, Set Palette, Set Quiet
Set Cancel
Description:
Use this command to specify what happens when the user presses Esc.
When on, Wait and Receive commands are terminated and, if an On
Cancel command is active, the command specified by On Cancel is
executed.
Syntax:
Set Cancel On | Off
Parameters:
On
Causes Esc to be understood as canceling.
Off
Causes Esc to be ignored.
Reserved Variables: $Result
Example:
Set to 0.
$Error
Unchanged.
$Cancel
Set to 1 for on or 0 for off.
The following example enables canceling and specifies what is to
happen if the user presses Esc.
Set Cancel On;enable canceling
On Cancel GoTo @end
;attempt to connect with CompuServe
Dial OnlSvc "CompuServe"
Wait Time 2
;send carriage return to alert host
Send Char 13
;end script processing and return to terminal mode
End Terminal
@end:
End;end script processing
See Also:
On Cancel, Set Disconnect, Set Timeout, Wait and Receive commands
169
170
Chapter 4 • Script Language Command Reference
Set CharDelay
Description:
Use this command to set the default value of the between-character
send delay. The Send String and Send Line commands insert this delay
between each character sent. For most applications, delays are not
necessary, though some mainframes require that data be entered at a
“typing” speed. The current value of the between-character send delay
is stored in the $CDelay reserved variable.
Syntax:
Set CharDelay delay
Parameters:
delay
Reserved Variables: $Result
Example:
Integer literal or integer variable specifying the delay
value (in tenths of a second).
Set to 0.
$Error
Unchanged.
$CDelay
Set to the specified delay.
The following example sets the character delay to 1/10th of a second.
Set CharDelay 1
String string1[14]
string1 = "Processing..."
Send String string1
See Also:
Send Line, Send String
Set Disconnect
Description:
Use this command to specify what happens when a connection is lost.
When on, Wait and Receive commands are terminated, and if an On
Disconnect command is active, the command specified by On
Disconnect is executed.
Syntax:
Set Disconnect On | Off
Parameters:
On
Causes a lost connection to end Wait and Receive
commands.
Off
Causes no action to be taken when a connection is lost.
Chapter 4 • Script Language Command Reference
Reserved Variables: $Result
Example:
Set to 0.
$Error
Unchanged.
$Disconnect
Set to 1 for on or 0 for off.
If the connection is lost during the execution of the following example,
the script ends.
Set Disconnect On;enable disconnect action
On Disconnect GoTo @end
;attempt to connect with CompuServe
Dial OnlSvc "CompuServe"
Wait Time 2
Send Char 13
;end script processing and return to terminal mode
End Terminal
@end:
End;end script processing
See Also:
On Disconnect, Set Cancel, Set Timeout, Wait and Receive commands
Set DTR
Description:
This command applies only to serial communications. Use it to send the
RS-232 Data Terminal Ready (DTR) signal to the serial port. When on,
the signal is raised or ready. When off, the signal is lowered or not
ready. Toggling DTR prior to dialing is a technique for preventing
incoming calls from “colliding” with an outgoing dial. Use this command
prior to making a connection. If you load a hardware configuration after
this command, the state of the signal is reset to that in the configuration.
Syntax:
Set DTR On | Off
Parameters:
On
Raises the DTR signal.
Off
Lowers the DTR signal.
Reserved Variables: $DTR
Example:
Set to 1 for on or 0 for off.
The following example lowers and then raises the DTR signal.
Set DTR Off;lower the DTR signal
Wait 1;for one second
171
172
Chapter 4 • Script Language Command Reference
Set DTR On;then raise it again
See Also:
Exit Online
Set Echo
Description:
Use this command to enable or disable the echoing (displaying) of
characters received during Wait and Receive commands. Set Echo must
be on to display characters received while in the terminal mode. By
default, Set Echo is set to off. Therefore, you usually turn it on during
the log-on process to display the log-on prompt on the remote.
Syntax:
Set Echo On | Off
Parameters:
On
Allows the display of received characters.
Off
Stops the display of received characters.
Reserved Variables: $Echo
Example:
Set to 1 for on or 0 for off.
The following example specifies the display of responses, dials the host,
and waits for a string.
Set Echo On;on to display responses
Dial Host "Office PC";dial the host
;wait for and display password prompt
Wait String "Enter password:"
See Also:
Set Cancel, Set Disconnect
Set File Attr
Description:
This command applies to the remote PC only. Use it to set the attributes
of the specified file. The file must be closed before performing this
operation. This command can be used in scripts that perform remote
control sessions so long as the command is not executed during the
remote control session.
Syntax:
Set File Attr filename new_attribute
Parameters:
filename
String literal or string variable containing the name of the
file to modify.
Chapter 4 • Script Language Command Reference
new_attribute Integer literal or integer variable containing the sum of
the values for the desired attributes. The values are as
follows:
Attribute
Value
Read-only
1
Hidden
2
System file
4
Volume label
8
Subdirectory
16
Archive
32
Using 0 as the attribute, makes the file a Normal file.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example makes DATA.FIL a read-only file.
Set File Attr "C:\DATA.FIL" 1
See Also:
Get File Attr, Get File Date, Get File Size, Get File Time, Set File Date,
Set File Size, Set File Time
Set File Date
Description:
This command applies to the remote PC only. Use it to revise the date
of a file which has otherwise not changed. The file must be closed
before performing this operation. This command can be used in scripts
that perform remote control sessions so long as the command is not
executed during the remote control session.
MS-DOS changes the date of a file when a file is closed after being
opened. In other words, the date is changed when a file is updated, but
not when it is renamed, copied, moved, or has changed its file
attributes.
Syntax:
Set File Date filename new_date
Parameters:
filename
String literal or string variable containing the name of the
file.
new_date
A literal or variable (that can be either an integer or string
type) containing the new date in the format YYMMDD.
173
174
Chapter 4 • Script Language Command Reference
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example sets the date of WK1030.DAT to 11/10/94.
Set File Date "wk1030.dat" 941110
See Also:
Get File Attr, Get File Date, Get File Size, Get File Time, Set File Attr, Set
File Size, Set File Time
Set File Size
Description:
This command applies to the remote PC only. Use it to change the
indicated size of the specified file. The file must be closed before
performing this operation. This command can be used in scripts that
perform remote control sessions so long as the command is not
executed during the remote control session.
WARNING: Use this command cautiously. Changing the way DOS
indicates the size of a file may cause unintentional errors that are
extremely difficult to detect.
Syntax:
Set File Size filename new_size
Parameters:
filename
String literal or string variable containing the name of the
file.
new_size
A literal or variable (that can be either an integer or string
type) containing the new file size (in bytes).
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example changes the size of TEMP.DAT to 1024 bytes.
Set File Size "temp.dat" 1024
See Also:
Get File Attr, Get File Date, Get File Size, Get File Time, Set File Attr, Set
File Date, Set File Time
Chapter 4 • Script Language Command Reference
Set File Time
Description:
This command applies to the remote PC only. Use it to revise the time
of a file which has otherwise not changed. The file must be closed
before performing this operation. This command can be used in scripts
that perform remote control sessions so long as the command is not
executed during the remote control session.
MS-DOS changes the time of a file when a file is closed after being
opened. In other words, the time is changed when a file is updated, but
not when it is renamed, copied, moved, or has changed its file
attributes.
Syntax:
Set File Time filename new_time
Parameters:
filename
String literal or string variable containing the name of the
file.
new_time
A literal or variable (that can be either an integer or string
type) containing the new time in the format HHMM.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example changes the time of NEWFILE.DAT to 8 A.M.
Set File Time "newfile.dat" 0800
See Also:
Get File Attr, Get File Date, Get File Size, Get File Time, Set File Attr, Set
File Date, Set File Size
Set Flow
Description:
This command is generally used only for serial connections. Use it to set
flow control. You can use this command before or after making the
connection. However, if you load a hardware configuration after this
command, the flow is reset to that in the configuration.
XON/XOFF flow control is commonly known as software flow control,
and RTS/CTS is known as hardware flow control. RTS/CTS flow control
is achieved by varying the voltage on the RTS/CTS signal lines between
175
176
Chapter 4 • Script Language Command Reference
the terminal and the modem. XON/XOFF flow control is achieved by
embedding control characters in the data stream.
RTS/CTS flow control is preferred. Use XON/XOFF flow control when
RTS/CTS flow control is not supported, or when otherwise required.
Syntax:
Set Flow RTSCTS | XONXOFF | Both | None
Parameters:
RTSCTS
Sets hardware flow control on and software control off.
XONXOFF
Sets software flow control on and hardware control off.
Both
Sets hardware and software flow control on.
None
Sets hardware and software flow control off.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example sets flow control to RTS/CTS.
Set Flow RTSCTS
See Also:Set RTS
Set IgnoreCase
Description:
Use this command to turn case-checking off or on when comparing
strings or waiting for strings. Set it to off to differentiate between
uppercase and lowercase letters. The default for Set IgnoreCase is on,
which means string comparisons are not case sensitive. This command
can be used in scripts that perform remote control sessions so long as
the command is not executed during the remote control session.
Syntax:
Set IgnoreCase On | Off
Parameters:
On
Ignores case.
Off
Checks case.
Reserved Variables: $Result
Example:
Set to 0.
$Error
Unchanged.
$IgnoreCase
Set to 1 for on or 0 for off.
The following example ignores the case when comparing "ABC" and
"abc".
;case will be ignored by default
Chapter 4 • Script Language Command Reference
StrCmp "ABC" "abc";$Result is set to 0
The next example uses case when comparing “ABC” and “abc”.
Set IgnoreCase Off;case is not ignored
StrCmp "ABC" "abc";$Result is set to -1
See Also:
Lower, StrCmp, Upper, Wait String
Set Palette
Description:
This command is valid in pcANYWHERE for DOS scripts only. It applies
to the remote PC’s display buffer. Each displayable object, such as a
menu or form, has fields that are predefined as having normal, intense,
or reverse video attributes. For example, the options listed on a menu
are normal; the selected option is reverse, and both the menu’s title and
border are intense. Use this command to set a foreground and
background color combination for the specified video attribute on the
specified displayable object. Values set in a script file remain in effect
until the user exits pcANYWHERE.
NOTE: If you are using pcANYWHERE on a monochrome monitor, try
to use colors that have high contrast. Darker shades are more likely to
be distinguishable.
Syntax:
Set Palette attribute color
Parameters:
attribute
Integer literal or integer variable indicating both the
displayable object and the video attribute to change.
Normal Video
Intense
Reverse Video
Menus
3
4
5
Yes/No menus
6
7
8
Errors/Warnings
12
13
14
Help
15
16
17
Status/Info
18
19
20
Terminal Mode
24
25
26
Forms
27
28
29
177
178
Chapter 4 • Script Language Command Reference
color
Hexadecimal integer starting with 0x and indicating the
combination of foreground and background colors. Of
the last two digits, the background color is specified
before the foreground color.
black
0
blue
1
brown
6
cyan
3
dark gray*
8
green
2
light blue*
9
light cyan*
B
light green*
A
light magenta*
D
light red*
C
light gray
7
magenta
5
red
4
white*
F
yellow*
E
*Can be used as foreground colors only
Reserved Variables: (none)
Example:
The following example sets terminal mode to normal and sets the color
to blue on light gray.
Set Palette 24 0x71
See Also:
Screen Restore, Screen Save, Set Attribute, Set Echo, Set Quiet
Chapter 4 • Script Language Command Reference
Set Parity
Description:
This command applies to serial connections only. Use it to change the
current parity type. The parity determines the settings for data bits and
stop bits (see the table below). Both computers must use the same
parity setting. You can use this command before or after making the
connection. However, if you load a hardware configuration after this
command, the parity is reset to that in the configuration.
Parity
Data Bits
Parity Bit
Stop Bit
None
8
N
1
Even
7
E
1
Odd
7
O
1
Mark
7
M
1
Space
7
S
1
Syntax:
Set Parity None | Even | Odd | Mark | Space
Parameters:
None
Use this setting for direct connections and for modem
communications where both the host and remote PCs are
running pcANYWHERE.
Even, Odd,
Use one of these settings when communi-
Mark, Space
cating with a non-pcANYWHERE host PC that requires a
specific parity setting.
Reserved Variables: (none)
Example:
The following example specifies even parity.
Set Parity Even
See Also:
Dial Host, Dial OnlSvc, Load Config, Load HostInfo, Load OnlSvcInfo
179
180
Chapter 4 • Script Language Command Reference
Set Port
Description:
Use this command to select the communications port for subsequent Set
Speed, Set Parity, or Set Flow commands. It changes the port from the
one specified by the current configuration. Use the Set Port command
prior to making a connection. If you load a hardware configuration after
this command, the port is reset to that in the configuration.
Syntax:
Set Port number
Parameters:
number
Reserved Variables: $Result
$Error
Example:
Integer representing communications port to be affected.
Valid values are 1 through 4.
Set to 0.
Set if an invalid port value is specified.
This example combines the Set Port command with the Set Parity
command for a special situation that requires a temporary adjustment of
parity.
Set Port 1;selects com 1
Set Speed 9600;sets bps rate
Dial Number "1-408-973-9834";dials service
Set Parity Even;changes parity to even
See Also:
Dial Host, Load Config, Set Flow, Set Parity, Set Speed
Set Protocol
Description:
Use this command to set the file-transfer protocol to be used for
subsequent Send File and Receive File commands. You can use this
command before or after making the connection. However, if you load
a session configuration after this command, the protocol is reset to that
in the configuration.
ZMODEM is generally regarded to be the fastest file-transfer protocol,
although pcANYWHERE’s proprietary pcANYWHERE protocol (available
only when using AWSEND.EXE) has been tested to be faster. The
pcANYWHERE protocol uses a CRC algorithm for error-correcting and
verifying the integrity of received files, as does ZMODEM. Both
Chapter 4 • Script Language Command Reference
protocols have crash-recovery ability, which enables a partially
completed file transfer to be resumed from the point of interruption.
YMODEM-G is regarded by many to be faster than ZMODEM, although
it has no inherent error-correcting ability, and should be used only with
error-correcting modems, such as those employing MNP-5 or v.42bis
error correction. YMODEM-G does not have crash recovery ability.
Syntax:
Set Protocol type
Parameters:
type
Reserved Variables: $Result
Example:
Selected protocol. Valid types are XMODEM, XMODEMCRC, XMODEM-1K, XMODEM-1KG, YMODEM,
YMODEM-G, ZMODEM, KERMIT, ASCII.
Set to 0.
$Error
Unchanged.
$Protocol
Set to an integer representing the specified protocol.
The following example specifies that the ZMODEM protocol will be
used when transferring files.
Set Protocol ZMODEM
See Also:
Emulate, Receive File, Send File, Send String, Set Flow, Set RTS, Set
Timeout
Set Quiet
Description:
This command applies to the remote PC’s display buffer. Use it to
display or hide progress messages about the commands in the script.
The default state of Set Quiet is off, which displays the messages.
Syntax:
Set Quiet On | Off
Parameters:
On
Hides progress messages.
Off
Displays progress messages.
Reserved Variables: $Result
Example:
Set to 0.
$Error
Unchanged.
$Quiet
Set to 1 for on or 0 for off.
In the following example, information about the copy command is not
displayed, although execution occurs.
Set Quiet On
COPY file1 file2
181
182
Chapter 4 • Script Language Command Reference
See Also:
Set Echo
Set Record
Description:
Use this command to start and stop recording data. When set to on, all
data received is written to the current recording file. The default
recording file is AW.RCD. In the script, you can change the file by
setting the reserved variable $RecordFile to a string containing another
filename.
If you load a session configuration after this command, the value of
$Record is reset to that in the configuration. So is the value of
$RecordFile.
Syntax:
Set Record On | Off
Parameters:
On
Records all received data in the current recording file.
Off
Stops recording of the current session.
Reserved Variables: $Result
Example:
Set to 0.
$Error
Unchanged.
$Record
Set to 1 for on or 0 for off.
The following example turns on recording, dials the host, then turns
recording off.
Set Record On
Dial Host "Office PC"
...
Set Record Off
End
The following example turns on recording and dials the host. When the
script ends, control passes to the remote user.
Set Record On
Dial Host "Office PC"
...
End Terminal
Chapter 4 • Script Language Command Reference
Set RTS
Description:
Use this command to set the state of the RS-232 Request to Send (RTS)
signal. When on (or raised), pcANYWHERE uses hardware flow control
to direct the rate of data flow between your computer and modem. This
is often used with high-speed and error-correcting modems. You can
use this command before or after making the connection. However, if
you load a hardware configuration after this command, the state of the
signal is reset to that in the configuration.
Syntax:
Set RTS On | Off
Parameters:
On
Raises the RTS signal.
Off
Lowers the RTS signal.
Reserved Variables: $Result
Example:
Set to 0.
$Error
Unchanged.
$RTS
Set to 1 for on or 0 for off.
The following example lowers the RTS signal for one second, then
raises it again.
Set RTS Off
Wait Time 1
Set RTS On
See Also:
Set Flow
Set Speed
Description:
This command applies only to serial connections. It sets the bits-persecond (bps) speed of the communications port. The Set Speed
command may be preceded by a Set Port command, which selects the
communications port to be set. Use this command prior to making a
connection. If you load a hardware configuration after this command,
the speed is reset to that in the configuration.
The rate of the communications port affects the speed of data
transmission between modems.
183
184
Chapter 4 • Script Language Command Reference
Syntax:
Set Speed rate
Parameters:
rate
Reserved Variables: $Baud
Example:
Integer literal or integer variable containing the bps rate.
Permitted values are: 75, 300, 600, 1200, 2400, 4800,
9600, 14400, 19200, 38400, 57600 or 115200.
Set to the bps rate.
The following example selects com port 1, then sets the speed to 19200
bps.
Set Port 1
Set Speed 19200
See Also:
Dial Host, Load Config, Set Port
Set Timeout
Description:
Use this command to set timeout values for subsequent Wait and
Receive commands. This can be used to control script execution and
prevent script “locking” in the event that an appropriate value is not
received during the specified timeout period. If an On Timeout
command has been specified, then it is executed if a timeout occurs
during the execution of a Wait or Receive command.
Setting $Timeout to 0 disables the default timeout value for Wait and
Receive commands. Set Timeout may be combined with an On Timeout
command, for error-trapping and controlling script execution. See the
example below.
Syntax:
Set Timeout seconds
Parameters:
seconds
Reserved Variables: $Result
Example:
Integer literal or integer variable specifying the number
of seconds before a timeout occurs.
Set to 0.
$Error
Unchanged.
$Timeout
Set to the number of seconds.
The following example ends the script when a timeout occurs.
Set Timeout 20;set timeout value
;specify where to branch if timeout occurs
On Timeout GoTo @timeout
Chapter 4 • Script Language Command Reference
...
@end:
Beep;let user know script has ended
End Terminal;exit to terminal mode
@timeout:
;a timeout occurred, end the script
Type String "^M^J(timeout)^M^J"
GoTo @end
See Also:
On Timeout, Set Cancel, Set Disconnect, Wait and Receive commands
Set Translation
Description:
Use this command to activate/deactivate a previously loaded translation
table. When on, all transmitted and received data is translated according
to the currently loaded translation table. The name of the file containing
the table is loaded along with the session configuration or with the Load
Translation command. If you load a session configuration after this
command, the active/inactive state is reset to that in the configuration.
Syntax:
Set Translation On | Off
Parameters:
On
Activates the translation table.
Off
Deactivates the translation table.
Reserved Variables: $Result
$Error
Example:
Set to 0.
Unchanged.
The following example loads and activates a translation table. Then it
sends a translated string.
Load Translation "AW"
Set Translation On;activate translation
Send String "translate this"
The next example deactivates a translation table and sends a string
without translation.
Set Translation Off
Send String "do not translate"
See Also:
Load Translation
185
186
Chapter 4 • Script Language Command Reference
StrCat
Description:
Use this command to append one string to the end of another. You may
want to trim leading and trailing blanks (using Trim) before using this
command. This command can be used in scripts that perform remote
control sessions so long as the command is not executed during the
remote control session.
Syntax:
StrCat string1 string2
Parameters:
string1
String variable containing the string to which string2 will
be added. After the command is executed, it contains the
result of concatenating the two strings.
string2
String literal or string variable to be added to the end of
string1.
Reserved Variables: $Result
Set to the length of the resulting string. The quotation
marks surrounding the string are not counted. If an error
occurs, set to the value of $Error.
$Error
Example:
Standard errors. See Appendix B, “Error Messages.”
The following example concatenates "ABCDE" to string1 and sets
$Result to 10.
String string1[15]
string1 = "12345"
;string1 becomes "12345ABCDE"
StrCat string1 "ABCDE"
See Also:
Lower, Set IgnoreCase, StrCmp, StrLen, StrSet, SubStr, Trim, Upper
StrCmp
Description:
Use this command to compare, character by character, the contents of
two strings for equality. The $IgnoreCase reserved variable is used to
determine if case sensitivity is enabled. The case of the characters is
ignored if Set IgnoreCase has been set to on. This command can be
used in scripts that perform remote control sessions so long as the
command is not executed during the remote control session.
Chapter 4 • Script Language Command Reference
Syntax:
StrCmp string1 string2 [length]
Parameters:
string1
First string literal or string variable to be compared.
string2
Second string literal or string variable to be compared.
length
(Optional) integer literal or integer variable containing
the number of characters to be compared. The default is
the length of the shorter of the two strings.
Reserved Variables: $Result
$Error
Example:
Set to 0 if the strings are identical. If string1 precedes
string2 in ASCII order, $Result is set to -1; if string1
follows string2 in ASCII order, $Result is set to 1.
Standard errors. See Appendix B, “Error Messages.”
The following example compares unequal strings. $Result becomes -1
because "ABC" precedes "DEF" in ASCII order.
StrCmp "ABC" "DEF";$Result is set to -1
The next example compares unequal strings. $Result becomes 1
because "123" follows "12" in ASCII order.
String S1[3]
String S2[3]
S1 = "123"
S2 = "12"
StrCmp S1 S2;$Result is set to 1
The last example compares strings that are equal when the case of the
characters is ignored. $Result becomes 0 because they are equal.
Set IgnoreCase On
StrCmp "ABC" "abc";$Result is set to 0
See Also:
Lower, Set IgnoreCase, StrCat, StrLen, StrSet, SubStr, Trim, Upper
StrLen
Description:
Use this command to determine the length of a string; for example, a
password or ID specified by the user. The quotation marks surrounding
the string are not counted. This command can be used in scripts that
perform remote control sessions so long as the command is not
executed during the remote control session.
Syntax:
StrLen source [length]
187
188
Chapter 4 • Script Language Command Reference
Parameters:
source
String literal or string variable whose length is to be
determined.
length
(Optional) integer variable that contains the number of
characters in the string. Its value is also stored in $Result.
Reserved Variables: $Result
$Error
Example:
Set to the length of the string. If an error occurs, set to
the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example determines that "MICKEY" has six characters.
String s1[25]
Integer length
s1 = "MICKEY"
StrLen s1 length;length and $Result are set to 6
See Also:
Lower, Set IgnoreCase, StrCat, StrCmp, StrSet, SubStr, Trim, Upper
StrSet
Description:
Use this command to fill a string with the specified number of the
specified character. This command can be used in scripts that perform
remote control sessions so long as the command is not executed during
the remote control session.
Syntax:
StrSet result_string length character
Parameters:
result_string
String variable to be created.
length
Integer literal or integer variable containing the number
of characters to put in result_string. This becomes the
length of the string.
character
Integer literal or integer variable indicating the ASCII
value of the character, or string literal or string variable
indicating the character itself. If a string literal or string
variable is specified, only the first character in the string
is used.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example creates a string (S1) containing three D's.
StrSet S1 3 "D";s1 is set to DDD
Chapter 4 • Script Language Command Reference
The next example creates a string containing one A because 65 is the
ASCII character for uppercase A.
StrSet S2 1 65
See Also:
Lower, Set IgnoreCase, StrCat, StrCmp, StrLen, SubStr, Trim, Upper
SubStr
Description:
Use this command to extract a portion of a string (called a substring)
and store it. You specify the starting position within the original string
and the number of characters to copy. This command can be used in
scripts that perform remote control sessions so long as the command is
not executed during the remote control session.
Syntax:
SubStr string start length substring
Parameters:
string
String literal or string variable from which a portion is to
be copied.
start
Integer literal or integer variable specifying the starting
position within the first string. The first character in a
string is in position 1.
length
Integer literal or integer variable specifying how many
characters to copy.
substring
String variable that will contain the copied substring.
Reserved Variables: $Result
$Error
Example:
Set to the length of the resulting string. The quotation
marks are not counted in the length.
Standard errors. See Appendix B, “Error Messages.”
In the following example, string1 becomes "BCD" and $Result becomes
3.
String string1[50]
SubStr "ABCDEF" 2 3 string1
See Also:
Lower, Set IgnoreCase, StrCat, StrCmp, StrLen, StrSet, Trim, Upper
189
190
Chapter 4 • Script Language Command Reference
Terminal
Description:
Use this command to go into terminal emulation mode. The last
terminal emulation, port, speed, parity, recording status, and so forth
remain in effect. When terminal mode is ended, control returns to the
current script at the next command.
Syntax:
Terminal
Reserved Variables: $Result
$Error
Example:
Set to 0.
Unchanged.
The following example goes into terminal emulation mode.
Terminal
See Also:
End Terminal
Trim
Description:
Use this command to remove, or trim, leading and trailing spaces and
control codes from the specified string. It trims all ASCII characters with
an ASCII value less than 33. This command can be used in scripts that
perform remote control sessions so long as the command is not
executed during the remote control session.
Syntax:
Trim string
Parameters:
string
Reserved Variables: $Result
$Error
Example:
String variable to be trimmed.
Set to the length of the resulting string. If an error occurs,
set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example trims the spaces from both ends of the S1 string.
String string1[10]
string1 = "
ABC
"
Trim string1;string1 is set to "ABC"
See Also:
Lower, Set IgnoreCase, StrCat, StrCmp, StrLen, StrSet, SubStr, Upper
Chapter 4 • Script Language Command Reference
Type File
Description:
Use this command to display the contents of a file on the screen. To
make the scrolling of the output pause, the user can press Ctrl+S. To
resume scrolling, the user can press any key. The output stops if the
previous Set Cancel command was set to on and the user presses Esc.
This command can be used in scripts that perform remote control
sessions so long as the command is not executed during the remote
control session.
Syntax:
Type File filename
Parameters:
filename
Reserved Variables: $Result
$Error
Example:
String literal or string variable containing path and name
of file whose contents are to be displayed.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example displays the contents of the AUTOEXEC.BAT file
on the screen.
Type File "c:\autoexec.bat"
See Also:
Type Line, Type String
Type Line
Description:
Use this command to display a line on the screen. For example, you can
display comments about the current script operation. Type Line
appends a carriage return/linefeed combination ($TLineEnd) to the end
of the string. The $TLineEnd variable can be changed to alter line
spacing. For example, if $TLineEnd is set to "^M^J^J", lines will be
ended with two carriage returns, creating double-spaced lines.
When the string you are displaying exceeds the number of columns
available in the current row, the remainder of the string automatically
wraps to the next line. If the cursor is currently on a row near the
bottom of the screen, and the string exceeds the number of rows
available, then the remainder of the string is wrapped beginning at row
1, column 1.
191
192
Chapter 4 • Script Language Command Reference
This command can be used in scripts that perform remote control
sessions so long as the command is not executed during the remote
control session.
Syntax:
Type Line string
Parameters:
string
Reserved Variables: $Result
$Error
Example:
Set to the number of characters displayed. If an error
occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example shows each of three comments on separate
double-spaced lines.
$TLineEnd
Type Line
Type Line
Type Line
See Also:
String literal or string variable to be displayed.
= "^M^J^J"
"COMMENT ONE"
"COMMENT TWO"
"COMMENT THREE"
Type File, Type String
Type String
Description:
Use this command to display a string on the screen. For example, you
can display comments about the current script operation. Type String
has the same effect as the Type Line command if the string is followed
by the carriage return/linefeed combination (^M^J).
When the string you are displaying exceeds the number of columns
available in the current row, the remainder of the string is automatically
wrapped to the next line. If the cursor is currently on a row near the
bottom of the screen, and the string exceeds the number of rows
available, then the remainder of the string is wrapped beginning at row
1, column 1.
If you want to insert a string rather than type over video space or other
characters, use Insert Char first. This command can be used in scripts
that perform remote control sessions so long as the command is not
executed during the remote control session.
Syntax:
Type [String] string
Parameters:
String
(Optional) reserved word; the command may be
shortened.
Chapter 4 • Script Language Command Reference
string
Reserved Variables: $Result
$Error
Example:
String literal or string variable to be displayed.
Set to the number of characters displayed. If an error
occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example displays "one, two, three" followed by a carriage
return/linefeed. Each Type (String) command starts where the previous
one left off.
String string1
string1 = "one, "
Type string1
Type "two, "
Type "three^M^J"
The next example moves the cursor to an appropriate position and
inserts a message in a previously typed line.
Cursor Left 10
Wait Time 2
;prepare for insertion
Insert Char 21
;insert the characters
Type String "Waiting for signal..."
See Also:
Type File, Type Line, Insert Char
Upper
Description:
Use this command to convert all lowercase characters in a string to
uppercase. Characters that are already uppercase are not affected. This
command can be used in scripts that perform remote control sessions so
long as the command is not executed during the remote control session.
Syntax:
Upper string
Parameters:
string
Reserved Variables: $Result
$Error
Example:
String literal or string variable to be converted.
Set to 0.
Unchanged.
The following example converts string1 from "Abc" to "ABC", then
displays it.
String string1[3]
193
194
Chapter 4 • Script Language Command Reference
string1 = "Abc"
Upper string1
Type string1
See Also:
Lower, Set IgnoreCase, StrCat, StrCmp, StrLen, StrSet, SubStr, Trim
Wait Carrier
Description:
This command applies only to serial connections. Use it to wait for the
data-carrier-detect signal (CD or DCD), signifying that a connection has
been established. If an On Timeout command is active, it specifies
timeout handling for this command.
Syntax:
Wait Carrier [timeout]
Parameters:
timeout
Reserved Variables: $Result
$Error
Example:
(Optional) integer literal or integer variable specifying
the maximum number of seconds to wait. The default is
the number of seconds specified by the Set Timeout
command.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example dials Office PC and waits two minutes for a
connection. It will redial a total of nine times if necessary.
;show command processing on the remote
Set Echo On
;declare and initialize a counter
Integer count
count = 0
@retry:;the retry loop label
count = count + 1;increment counter
Dial Host "Office PC";dial host
On Timeout GoTo @timeout;set error handling
;wait two minutes for carrier detection
Wait Carrier 120
;display status on remote PC
Type "Connection established..."
...
Chapter 4 • Script Language Command Reference
@timeout:
Type Line "No carrier...";display status
;loop if fewer than ten retries have occurred
If (count < 10) GoTo @retry
Type "Too many retries, try later..."
End;end session
See Also:
Set Cancel, Set Disconnect, Set Timeout, other Wait commands
Wait Receive
Description:
Use this command in network connections to replace the Wait Carrier
command. It waits for any character to be received from the
communications device. If an On Timeout command is active, it
specifies timeout handling for this command.
Syntax:
Wait Receive [timeout]
Parameters:
timeout
Reserved Variables: $Result
$Error
Example:
(Optional) integer literal or integer variable specifying
the maximum number of seconds to wait. The default is
the number of seconds specified by the Set Timeout
command.
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example waits 60 seconds for a character to be received
from the host.
;show command processing on the remote
Set Echo On
Set Timeout 60;establish a default timeout
;declare and initialize a counter
Integer count
count = 0
@retry:;the retry loop label
count = count + 1;increment counter
Dial Host "Office PC";dial host
Wait Receive ;wait 60 seconds for any character
;branch depending on the value for $Error
195
196
Chapter 4 • Script Language Command Reference
;these $Error
If ($Error ==
If ($Error ==
If ($Error !=
...
values are for DOS script
-4) GoTo @timeout
-1) GoTo @canceled
0) GoTo @another_error
@end:
End;end session
@timeout:
Type Line
;retry or
If (count
Type "Too
"A timeout has occurred..."
end session
< 10) GoTo @retry
many retries, try later..."GoTo @end
@canceled:
;end session
Type Line "Operator abort..."
GoTo @end
@another_error:
;end session
Type Line "Error occurred..."
GoTo @end
See Also:
Set Cancel, Set Disconnect, Set Timeout, other Wait commands
Wait Silence
Description:
Use this command to establish a received data timeout for unattended
file transfers. It waits until it receives a specified number of seconds of
communications silence. If an On Timeout command is active, it
specifies timeout handling for this command.
Syntax:
Wait Silence [timeout]
Parameters:
timeout
Reserved Variables: $Result
(Optional) integer literal or integer variable representing
length of silence to wait. The default is the number of
seconds set by the Set Timeout command.
Set to 0. If an error occurs, set to the value of $Error.
Chapter 4 • Script Language Command Reference
$Error
Example
Standard errors. See Appendix B, “Error Messages.”
The following example transfers the C:\FILE1 file from the host to the
remote, waits for a minute of inactivity, then transfers C:\FILE2 to the
host.
$Error = 0;reset $Error
On Error GoTo @error;handle errors
Send String "AWSEND C:\FILE1 to remote"
Receive File "C:\FILE1"
Wait Silence 60;wait for 1 minute of silence
Send String "AWSEND C:\FILE2 to host"
Send File "C:\FILE2"
See Also:
Set Cancel, Set Disconnect, Set Timeout, other Wait commands
Wait String
Description:
Use this command to wait for a specified string, for example, a
password prompt, to be received. Because scripts begin execution as
soon as the remote calls a host, password prompts on the remote PC
can be handled by script commands. If an On Timeout command is
active, it specifies timeout handling for this command.
By default, strings in pcANYWHERE are not case-sensitive. You may
want to use the Set IgnoreCase command to enable case-sensitivity
before prompting the user for a password.
NOTE: Wait String is usually preceded by a Wait Carrier or Wait Receive
command to ensure appropriate script execution.
Syntax:
Wait String string [timeout]
Parameters:
string
String literal or string variable to wait for.
timeout
(Optional) integer literal or integer variable specifying
the number of seconds to wait. The default is the number
of seconds set by the Set Timeout command.
Reserved Variables: $Result
$Error
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
197
198
Chapter 4 • Script Language Command Reference
Example:
The following example waits ten seconds for a password, makes sure
the case of the password’s characters are ignored, and contains error
handling in case no password is given.
$Error = 0;reset $Error to zero
On Error GoTo @nopassword;set-up error handling
Set IgnoreCase On;ignore case
Set Echo On
;wait up to 10 seconds for password
Wait String "Enter password:" 10
...
@nopassword:
;if no password received, hand up the phone and
;try again
Type Line "No password prompt."
Hang
GoTo @retry
See Also:
Set Cancel, Set Disconnect, Set Echo, Set Timeout, other Wait commands
Wait Time
Description:
Use this command to wait for the specified number of seconds. For
example, use the waiting period to display received data (if echo is on),
record received data (if recording is on), or check to see if the data
matches the specified On Receive string (if enabled).
Syntax:
Wait [Time] seconds
Parameters:
Time
(Optional) reserved word; the command may be
shortened.
seconds
Integer literal or integer variable specifying the number
of seconds to wait.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example prepares for a session, then waits 60 seconds
before proceeding with the script.
Set Echo On;display received data
Set Record On;record received data
Chapter 4 • Script Language Command Reference
Wait Time 60;wait for 60 seconds
...
See Also:
Set Cancel, Set Disconnect, Set Timeout, other Wait commands
Wait Until
Description:
Use this command to wait until a specific time and date occurs. For
example, you can delay script completion until after normal working
hours or until a time when controlling a non-dedicated host will not
interfere with other operations. Place the command at the beginning of
the script, before a Dial Host command, and before any loop that redials
(see the example for the Wait Carrier command).
Current time is read from the system clock. (The DOS command Time
displays the current system time.) You can change the system date and
time from the Windows Control Panel using the Date/Time option or
from the DOS prompt using the DOS date and time commands.
Syntax:
Wait Until time [date]
Parameters:
time
Integer literal or integer variable specifying time to wait
for, in the 24-hour format HHMM.
date
(Optional) integer literal or integer variable specifying
date to wait for, in the format YYMMDD. The default is
the current date.
Reserved Variables: $Result
$Error
Example:
Set to 0. If an error occurs, set to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example waits until 10:40 P.M. before completing the
script.
Wait Until 2240
See Also:
Set Cancel, Set Disconnect, Set Timeout, other Wait commands.
Write Line
Description:
This command applies to the remote PC only. Use it to write a string to
a file and append a carriage return/linefeed combination ($TLineEnd).
For example, you can create comments in log files which permanently
199
200
Chapter 4 • Script Language Command Reference
record unattended script operations. The values of string variables may
also be stored in a file for later review.
The $TLineEnd variable may changed to alter line-spacing. For example,
if $TLineEnd is set to "^M^J^J", lines will be ended with two carriage
returns, creating double-spaced lines.
This command can be used in scripts that perform remote control
sessions so long as the command is not executed during the remote
control session.
Syntax:
Write Line file_number string
Parameters:
file_number
Integer literal used by Open or Create command to
identify the file. Valid identifiers are 1 through 9.
string
String literal or string variable to be written to the file.
Reserved Variables: $Result
$Error
Example:
Set to the number of bytes written. If an error occurs, set
to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example opens a log file, positions its file pointer, writes
three double-spaced lines, then closes the log file.
$TLineEnd = "^M^J^J";start double-spacing
Open 1 "logfile" "WC"
Seek 1 0 2
Write Line 1 "First comment"
Write Line 1 "Second comment"
Write Line 1 "Third comment"
Close 1
See Also:
Read Line, Read String, Write String
Write String
Description:
This command applies to the remote PC only. Use it to write a string to
a file without appending a carriage return/linefeed. For example, you
can create comments in log files which permanently record unattended
script operations. The values of string variables may also be stored in a
file for later review.
This command will have the same effect as the Write Line command if
the string is followed by a carriage return/linefeed combination, ^M^J.
Chapter 4 • Script Language Command Reference
This command can be used in scripts that perform remote control
sessions so long as the command is not executed during the remote
control session.
Syntax:
Write String file_number string [length]
Parameters:
file_number
Integer literal used by Open or Create command to
identify the file. Valid identifiers are 1 through 9.
string
String literal or string variable to be written to the file.
length
(Optional) integer literal or integer variable limiting the
number of characters to write. The default is the length
of the string.
Reserved Variables: $Result
$Error
Example:
Set to the number of bytes written. If an error occurs, set
to the value of $Error.
Standard errors. See Appendix B, “Error Messages.”
The following example opens a file, positions its file pointer, writes two
strings side-by-side, then closes the file.
Open 1 "myfile.dat" "WC"
Seek 1 0 2
Write String 1 "First this; "
Write String 1 "then that"
Close 1
See Also:
Read Line, Read String, Write Line
201
THIS PAGE LEFT BLANK INTENTIONALLY
Reserved Words and
Variables
A
This appendix lists both the reserved words used in commands and the
reserved variables that supply information to pcANYWHERE.
Reserved Words
The following table lists all the reserved words in the pcANYWHERE script
language.
Table A-1
Reserved Words
Accept
Break
Del
ADDSVPT
Cancel
Delay
ADM3A
Carrier
Delete
Always
CD
Description
ANSI
Char
DG100
Answer
CharDelay
DG200
ASCII
Clear
Dial
Attr
Close
Dir
Attribute
Config
Disconnect
Beep
Copy
Disk
Block
Create
Down
BOL
Cursor
DTR
BOP
Date
Echo
Both
Decrypt
Emulate
Encrypt
HostInfo
Next
204
Appendix A • Reserved Words and Variables
Table A-1
Reserved Words (continued)
End
IBM3101
None
Environment
Idle
NoWait
EOL
If
Number
EOP
Ignore
Odd
Error
IgnoreCase
Off
Even
Index
On
Exit
Input
OnError
ExitMode
Insert
Online
File
Integer
OnlSvc
Find
KERMIT
OnlSvcInfo
First
Key
Open
FKeys
Keyboard
Original
Flow
Left
Overwrites
Flush
Let
Palette
Free
Line
Parity
Get
Link
Port
GoSub
Load
Position
Goto
Lower
Print
Hang
Mark
Printer
HAZ1500
MD
Protocol
Hit
Menu
Quiet
Home
MessageBox
RD
Host
Never
Read
Receive
Silence
Up
Record
Size
Upper
Appendix A • Reserved Words and Variables
Table A-1
Reserved Words (continued)
Remote
Space
VT100
Ren
Speed
VT102
Reset
StrCat
VT220-7
Restore
StrCmp
VT220-8
Retry
String
VT52
Return
StrLen
Wait
Right
StrSet
Write
RTS
SubStr
WYSE50
RTSCTS
Terminal
X3270
Run
Then
XMODEM
Save
Time
XMODEM-1K
ScanCode
Timeout
XMODEM-1KG
Screen
Translation
XMODEM-CRC
Script
Trim
XONXOFF
Seek
TVI912
YMODEM
Send
TVI920
YMODEM-G
Session
TVI925
ZMODEM
SessOpr
Type
Set
Until
Reserved Variables
The following table lists all of the currently defined reserved variables and an
explanation of the information stored in each. Those noted as read-only
cannot be modified by a script.
205
206
Appendix A • Reserved Words and Variables
All reserved variables can be accessed from within any script. It is
recommended that you do not define any user variable using the name of a
reserved variable.
Table A-2
Reserved Variables
Name
Description
$Baud (read-only)
Stores the current bps rate. This is set to 0 if the
current connection is over a LAN.
$BrkLen
Stores the integer value for the break length in
tenths of seconds.
$Cancel
Set to 0 or 1. You use the Set Cancel command
to modify this value.
$CDelay
Set to the character delay value. You modify this
value with the Set CharDelay command.
$Column (read-only)
Stores the integer indicating the column of the
current cursor position. The leftmost column on
the display is column 1.
$CTS (read-only)
Set to 0 or 1, depending on the state of the CTS
(clear to send) signal.
$CurDir (read-only)
Stores the current directory as a string.
$Date (read-only)
Stores the current date as a string. The date
format is “MM-DD-YYYY” (U.S.).
$DCD (read-only)
Set to 0 or 1, depending on the state of the DCD
(data carrier detect) signal.
$Disconnect
Set to 0 or 1. You use the Set Disconnect
command to modify this value.
$DSR (read-only)
Set to 0 or 1, depending on the state of the DSR
(data set ready) signal.
$DTR
Set to desired state of DTR (data terminal ready).
You modify this value with the Set DTR
command.
$Echo
Set to 0 or 1. You use the Set Echo command to
modify this value.
Appendix A • Reserved Words and Variables
Table A-2
Reserved Variables (continued)
Name
Description
$Error
Set to the last error value. This value is not
automatically cleared except at the start of a first
level script.
$IgnoreCase
Set to 0 or 1. You use the Set IgnoreCase
command to modify this value.
$KeyHit (read-only)
Set to 1 if a keystroke is pending; 0 otherwise.
$LineEnd
String used for end of strings (maximum length
of five characters).
$Password
Stores the password in the current remote
control session configuration as a string.
$Protocol
Set to the current protocol (integer value). You
use the Set Protocol command to modify this
value.
$Quiet
Set to 0 or 1. You use the Set Quiet command to
modify this value.
$Record
Set to 0 or 1. You use the Set Record command
to modify this value.
$RecordFile
Stores the name of the current recording file as a
string.
$RDA (read-only)
Contains state of receiver. Set to 0 if empty; 1 if
not empty.
$Result
Set to the result of the last command executed
(assuming it is one of the commands which
modifies $Result). If the command executed
does not normally modify $Result, then $Result
is set to 0.
$RLineEnd
String containing the end-of-line character(s)
used by the Read Line command.
$Row (read-only)
Stores the integer indicating the row of the
current cursor position. The topmost row of the
display is row 1.
207
208
Appendix A • Reserved Words and Variables
Table A-2
Reserved Variables (continued)
Name
Description
$RTS
Set to desired state of RTSDTR. You use the Set
RTS command to modify this value.
$RXString
Contains string specified as the first parameter of
the On Receive command. If this string is
received, the second parameter (a command) is
executed.
$SesHostExitMode
Specifies the mode to leave the host PC in at the
end of a session. Settings are: 0=Wait, 1=Idle,
2=Accept, 3=Original, 4=Cancel. You use the
Session ExitMode command to modify this
value.
$SesOnErr
Specifies what to do when an error occurs while
in a session. Settings are: 0=Continue, 1=Skip to
next Session End, 2=End script. You use the
Session OnError command to modify this value.
$SesOverwrites
Specifies how to handle existing files during file
transfers (either way) during a session. Settings
are: 0=Overwrite always, 1=Never overwrite,
2=Overwrite older files only. You use the
Session Overwrites command to modify this
value.
$Session
Set to 1 if a remote control session is active; set
to 0 otherwise.
$SesTimeout
Inactivity timeout (in seconds) for remote PC
during a remote control session. You use the
Session Timeout command to modify this value.
$SLineEnd
String containing the end-of-line character(s)
used by the Send Line command.
$TBE (read-only)
Contains state of transmitter. Set to 1 if empty; 0
otherwise.
$Time (read-only)
Stores the current time as a string. The format is
“HH:MM:SS”.
Appendix A • Reserved Words and Variables
Table A-2
Reserved Variables (continued)
Name
Description
$Timeout
Stores the timeout value as an integer value (in
seconds). You use the Set Timeout command to
modify this value.
$TLineEnd
String containing the end-of-line character(s)
used by the Type Line command.
$Translation
Set to 0 or 1. You use the Set Translation
command to modify this value.
209
THIS PAGE LEFT BLANK INTENTIONALLY
B
Error Messages
This appendix lists:
■
The syntax error messages that can occur during compilation of a
script. Each message appears with a short description of the error.
Syntax errors are the same for both pcANYWHERE for DOS and
pcANYWHERE for Windows.
■
The error values that pcANYWHERE assigns to the $Error reserved
variable when a run-time error occurs. Run-time errors are the same
for both pcANYWHERE for DOS and pcANYWHERE for Windows.
Syntax Errors
During compilation, pcANYWHERE checks the script’s syntax and creates a
file with the same name as the script, but with .ERR as its extension, that
contains a message for each syntax error that is found. Table B-1 lists all the
error messages that can appear in the scriptname.ERR file. Where the word
number or string appears in the error message, an actual line number or an
actual string from the script appears in the .ERR file.
Table B-1
Syntax Errors in .ERR File
Syntax Error Message
Meaning
Line number:
Bad command name:
string
The command string is not a supported
command.
Line number:
Duplicate label: string
There are multiple instances of the label
string. Although you can branch to a label
from multiple places in your script, the label
itself can appear only once.
Line number:
Expected command:
string
The compiler expected a command instead
of string.
Line number:
Illegal arithmetic
expression
An arithmetic expression (in an assignment
statement) did not follow standard arithmetic
procedures.
212
Appendix B • Error Messages
Table B-1
Syntax Errors in .ERR File(continued)
Syntax Error Message
Meaning
Line number:
Invalid argument count
The command did not contain the required
number of parameters. Parameters can be
called arguments.
Line number:
Invalid argument type:
string
The string was not of the type required by
the command.
Line number:
Invalid string size
A string exceeds the maximum string
allocation size.
Line number:
Syntax error
The line number did not follow the general
“Command Param1 Param2 _ Paramx”
syntax.
Line number:
Unexpected label: string
The string string is already defined as a label,
and cannot be used in the current context.
Too many variables or
variables too long
The maximum number of variables or the
combined string length of all the variable
names is greater than the allocated space.
Reuse variables if possible or use shorter
variable names.
Undefined labels in
script
There is a branch to a label which has not
been defined.
The $Error Reserved Variable
The $Error reserved variable is set if an error occurs while executing a
command. In many cases this value is also stored in the $Result reserved
variable. Below is a listing of the possible values for $Error and their
meanings. For convenience, the error values are arranged in two tables.
Table B-2 lists the run-time errors in numeric order; Table B-3 lists them
alphabetically by topic.
Appendix B • Error Messages
Table B-2
Script Run-time Errors in Numerical Order
Error Value
Meaning
-1
Operator aborted script.
-4
The timeout value expired.
-6
Out of resources (Windows only).
-7
Disk write error.
-8
File not found.
-9
File create error.
-11
Not enough memory to execute the specified
command.
-12
End of file.
-15
A connection could not be established.
-18
Invalid path or invalid file number.
-19
File already exists.
-20
Invalid path specified.
-23
Transfer error; AWSEND not running or background
file transfer not selected.
-26
Former connection still active.
-29
Calls nested too deeply.
-30
Invalid script file.
-32
Directory entry not found.
-33
Unable to access file/device.
-34
Data out of bounds (too large).
-35
GoSub/Return nesting error.
-36
Invalid number of parameters.
-37
Invalid parameter type.
213
214
Appendix B • Error Messages
Table B-2
Script Run-time Errors in Numerical Order(continued)
Error Value
Meaning
-38
Invalid parameter/argument value.
-39
Invalid arithmetic expression.
-40
Too many open files. You can have a maximum of
nine files open at the same time.
-42
Global variable redefinition.
Table B-3
Script Run-time Errors
Meaning
Error Value
Arithmetic: Invalid arithmetic expression.
-39
Canceled: User aborted script.
-1
Connection could not be established.
-15
Connection: Former connection still active.
-26
Data out of bounds (too large).
-34
Devices: Unable to access file/device.
-33
Directory entry not found.
-32
File Transfer: AWSEND not running or background -23
file transfer not selected.
Files: End of file.
-12
Files: File already exists.
-19
Files: File create error.
-9
Files: File not found.
-8
Files: Invalid path or invalid file number.
-18
Files: Invalid script file.
-30
Files: Too many open files. You can have a
maximum of nine files open at the same time.
-40
Appendix B • Error Messages
Table B-3
Script Run-time Errors(continued)
Meaning
Error Value
Files: Unable to access file/device.
-33
Global variable redefinition.
-42
Host not set up for Session commands.
-100
Memory: Not enough memory to execute the
specified command.
-11
Nesting: Calls nested too deeply.
-29
Nesting: GoSub/Return nesting error.
-35
Parameters: Invalid number of parameters.
-36
Parameters: Invalid parameter type.
-37
Parameters: Invalid parameter value.
-38
Path: Invalid path or invalid file number.
-18
Path: Invalid path specified.
-20
Resources: Out of resources (Windows only).
-6
Timeout: The timeout value expired.
-4
215
THIS PAGE LEFT BLANK INTENTIONALLY
G
G
Glossary
append
To add to the end of something, such as adding data to the
end of a file or characters to the end of a string.
ASCII
Acronym for American Standard Code for Information
Interchange. Numeric values are assigned to letters, numbers,
punctuation marks, and a few additional characters.
Computers and computer programs using these standard
codes are able to exchange information.
Values 0 to 31 are assigned as control codes, such as
backspace and carriage return, and are generally nonprinting
characters. In some fonts, these characters represent graphical
symbols.
Values from 32 to 127 represent the numbers 0 to 9, common
punctuation marks, and the uppercase and lowercase letters of
the alphabet.
ASCII file
A file containing characters or text without machine code or
control characters. An ASCII file can contain carriage returns
and spaces and an end-of-file marker, but is otherwise in a
“generic” format. See text file.
assignment operator
The pcANYWHERE assignment operator is the equal sign (=).
It assigns the value on its right side to the variable on its left
side. The assignment operator can be used with integers or
strings.
assignment statement
In programming, a statement that assigns a value to a variable.
An assignment statement usually has three parts: a variable, an
operator, and an expression. When the expression is
evaluated, the resulting value is stored in the memory location
for the variable. The pcANYWHERE script language
assignment operator is =.
asterisk
The character ( * ). In DOS, it is a wildcard character that can
be used in place of zero or more characters in a file
specification. In an arithmetic expression, the asterisk indicates
multiplication.
218
Glossary
attribute
One of the properties of an object. For example, a file on a
local disk drive (floppy or hard disk) can have up to four
attributes: archive, hidden, read-only, and system. The
attributes of your screen display control the color, underlining,
blinking cursor, and so on.
Backus-Naur Form (BNF)
A meta-language used to describe the syntax of programming
languages.
batch file
A file containing a series of commands executed in sequence
by the computer instead of being entered one by one at the
keyboard. Often used to automate routines as a shortcut for
keystroke entry. DOS batch files have the file extension .BAT.
binary operator
An operator having two operands. pcANYWHERE can use
binary arithmetic operators, relational operators and logical
operators. Compare to unary operator.
bitwise And
Usually used in masking, a bit-by-bit Anding of two binary
values. The bit 1 is true and the bit 0 is false. The result of
Anding two bits is true (or 1) when both bits are 1. The result
is false (or 0) when either or both bits are 0. See mask.
bitwise Or
Usually used in masking, a bit-by-bit Oring of two binary
values. The bit 1 is true and the bit 0 is false. The result of
Oring two bits is true (or 1) when either or both bits are 1. The
result is false (or 0) when both bits are 0. See mask.
Boolean expression
A mathematical expression using operators such as And, Or, or
Exclusive Or to define logical conditions. Such an expression
yields a Boolean value (true or false). See logical expression.
bug
Any problem that exists within a program.
call
In programming, to transfer execution to some other script or
part of a script.
case-sensitivity
Indicates that the case of the letters in a word can affect the
meaning of the data. The pcANYWHERE script language is not
case-sensitive. For example, the Dial Number command can
be written as DIAL NUMBER, dial number, or any other
combination of uppercase and lowercase letters.
Within a script, you can turn case-sensitivity on and off while
comparing strings or waiting for strings. For example, during a
case-sensitive comparison, the string “Password” does not
match “PASSWORD.”
character
A letter of the alphabet, a digit, or another computer symbol
that can be used in a string. Each character is one byte long.
Glossary
character code
The computer code that represents a particular character in a
character set. For example, the ASCII code for the ¢ sign is
162.
command
An instruction to pcANYWHERE. Each command has a name
consisting of one or more reserved words, followed by zero or
more parameters. Parameters provide additional information
about how the instruction is to be executed. See parameter.
comment
A string that is ignored by the pcANYWHERE compiler and is
not executed. Use comments in your script files to provide
documentation and to serve as reminders during subsequent
modifications to the script. A comment is designated by a
semicolon ( ; ) that is not within delimiting quotation marks.
pcANYWHERE considers all text to the right of the semicolon
as a comment. A comment can be entered on a line by itself,
or added to the end of a command line.
compare
To check two items, such as strings or logical expressions, to
determine whether they are alike or different.
compile
To translate all the source code of a script into executable
code. The program that performs this task is called the
compiler. Syntax errors are discovered when a script is being
compiled.
compile time
Refers to the events that occur during the compilation process.
compiler
The program that translates the source code of a script so it
can be executed.
concatenate
To combine two data strings so that one immediately follows
the other.
condition
The state of an expression. For example, a result can be either
true or false.
conditional
An action or operation that takes place based on whether or
not a certain condition is true.
conditional expression
An expression that yields a value of true or false, sometimes
called a logical expression or Boolean expression. See Boolean
expression, logical expression.
current directory
The directory that you are currently working in.
cursor
A flashing line, point, square, or dot that indicates the position
of data entry.
219
220
Glossary
data declaration
A statement within a script that specifies the characteristics of
a variable. Most programming languages allow (or require)
you to specify a variable’s name and data type and possibly its
initial value, as well.
data type
In programming, a definition of a set of data that specifies the
possible range of values of the set, the operations that can be
performed on the values, and the way in which the values are
stored in memory.
data validation
The process of testing to make sure data is current, consistent,
within established boundaries, and otherwise accurate.
declaration
The binding of an identifier to the information that relates to it.
For example, to “declare a variable” means to bind the name
of the variable with its value. Declaration occurs in the source
code of a script; the actual binding can take place at compile
time or at run-time.
default
A preset choice used by a script as the value of a parameter
unless you explicitly specify another choice.
delimit
To set the limits of some entity using a special character called
a delimiter. The pcANYWHERE script language delimits
strings, comments, and commands.
delimiter
A special character that separates individual entities or marks
their endpoints. For example, commas separate or delimit
parameters in a function or subroutine call. Double or single
quotation marks indicate the endpoints of string literals. A
semicolon separates a comment from a command, and a
carriage return/linefeeds separate commands in a script.
directory
A way of grouping files together on a disk. The root directory
contains files and other directories, called subdirectories.
display
The visual output of a computer, as it appears on a video
screen; commonly a CRT-based video display.
DOS
Disk Operating System. Also shorthand for Microsoft DOS, or
MS-DOS, the most common operating system for PCs. DOS
manages the computer system’s resources, such as memory,
disks, keyboard, files, and so forth, and provides an interface
between the user and application programs.
editor
A simple program that lets you create and modify text files.
Similar to a word processor, but usually less powerful.
Glossary
empty string
A string containing no characters. An empty string has a
location in memory, but there is nothing stored at that
location. In a script, an empty string is represented as an
empty string literal ( "" ).
end-of-file (EOF)
The code placed after the last byte of a file to mark that there
is no more data.
environment
The resources available to the user in a particular computer
system. For example, Microsoft Windows is known as a
windowing environment.
environment variable
A variable used to store a piece of information needed by the
operating system, such as the directories in your path, the
location of the command processor (typically
COMMAND.COM), and what to put in your DOS prompt.
Environment variables are generally set up in the
AUTOEXEC.BAT and CONFIG.SYS files.
equality operator
The symbol testing whether the values on each side of it are
equal. pcANYWHERE’s equality operator is a double-equal
sign (==). See relational operator.
error message
A message from the system or a script advising the user of an
error that requires human intervention to be solved.
Exclusive Or
Usually used in masking, a bit-by-bit Exclusive Oring of two
binary values. The bit 1 is true and the bit 0 is false. The result
of Exclusive Oring two bits is true (or 1) when one bit is 1 and
the other bit is 0. The result is false (or 0) when both bits are
the same. See mask.
executable file
A file containing a program that is in the proper format and
ready for DOS or Windows to run.
execute
To load a compiled program into memory and run it.
expression
A combination of symbols (operands and operators) that
yields a result when evaluated. In programming, the resulting
value might then be assigned to a variable, passed as a
parameter, tested within a command such as If...Then, or used
as part of another expression.
extension
The one, two, or three letters after the period in a DOS
filename. In the filename AUTOEXEC.BAT, the extension is
.BAT. An extension often identifies the type of file; for
example, .EXE identifies an executable file, whereas .TXT is a
common file extension for a text file.
221
222
Glossary
file attribute
A setting for a file that indicates a trait of the file, such as readonly, archive, system, or hidden. File attributes can restrict a
file’s use.
file pointer
Keeps track of the next position to be read from or written to
a file. The first position in the file is position 0.
file specification
Determines a file or set of files used in an operation, such as
copy, delete, or find. A file specification may include DOS
wildcard characters, as in *.EXE or ????90.TXT.
filename
The name of a file. See pathname.
find
See search.
global
Universal, in the sense of being related to an entire file,
document, program, or other entity. A global variable in a
script is one that can be accessed by other scripts that are
linked to or called by the executing script. See global
operation.
global operation
An operation that affects the entire script. A global search-andreplace operation, for example, finds one word and replaces it
with another throughout a document.
global variable
Global variables are variables whose values are remembered
and remain accessible while you are running linked or nested
scripts. These variables retain their values for the duration of
the script execution. pcANYWHERE contains 127 global
variables, named $1 through $127. See variable.
GoTo command
A control command used in scripts to transfer execution to
some other command. The high-level equivalent of a branch
or jump instruction.
hexadecimal
The base-16 number system that consists of the digits 0
through 9 and the letters A through F. Commonly used in
programming to represent the binary numbers used by the
computer.
hide
To remove from visibility. For example, the Cursor Off
command hides the cursor.
identifier
Identifiers are the names supplied for variables, parameters,
labels, and commands in scripts. An identifier is a sequence of
letters and/or digits that begins with a letter. Only the first
eight characters of an identifier determine its uniqueness
within the script.
If…Then command
A control command that executes another command if a
logical expression evaluates to true.
Glossary
input
Information entered into the computer, usually from a
keyboard or from a stored file; also the process of entering
that information.
insertion point
A blinking vertical bar that indicates where text will be
inserted.
integer
Any whole (non-fractional) number, such as 0, 1, or 9275.
integer expression
A numeric expression that contains an integer.
integer literal
Any value built from the digits 0 through 9. Unlike string
literals, integer literals are not delimited by quotation marks.
Integer literals in pcANYWHERE can have a value from 2,147,483,648 to 2,147,483,647 and cannot contain any
commas or decimal points.
label
An identifier that serves as a destination address or marker. In
the script language, a label is used with the GoTo and GoSub
commands. The location to which the GoTo or GoSub
command transfers control is indicated by a label name
followed by a colon.
literal
A value expressed as itself rather than represented by a
variable or an expression containing operators and operands.
For example, 4 is an integer literal and “abc” is a string literal.
local variable
A variable whose scope is limited to the script in which it is
declared.
logical expression
An expression that evaluates to either true or false. It can be a
mathematically constructed expression using relational and/or
logical operators.
logical And
Used in logical expressions. The result of Anding two
expressions is true when both expressions are true. The result
is false when either or both expressions are false.
logical operator
An operator that manipulates binary values at the bit level or
manipulates true and false values. The logical operators are
And, Or, and Exclusive Or.
logical Or
Used in logical expressions. The result of Oring two
expressions is true when either or both expressions are true.
The result is false when both expressions are false.
loop
In programming, a process that repeats itself, usually until a
variable condition returns a specified value. The script
language uses GoTo commands, in conjunction with If...Then
commands, to set up loops.
223
224
Glossary
macro
In the pcANYWHERE for Windows Editor, a set of keystrokes
and mouse movements that save time because they can be
replayed by selecting Play Back Macro from the Edit menu.
mask
A binary value used to selectively screen out or let through
certain bits in a data value. Masking is performed by using a
logical operator (bitwise And, bitwise Or, or Exclusive Or) to
combine the mask and the data value.
mathematical expression
An expression that uses numeric values (such as integer
literals) and arithmetic operators (such as * for multiplication).
memory
Computer hardware that stores data and provides for retrieval
of the data. Generally, the term refers to RAM, which is used
to run applications as well as temporarily store data during
program execution.
Microsoft Windows
An advanced software program that acts as a graphical user
interface between the command line of a DOS-based machine
and the user. See Windows.
monospaced
Letters spaced so that every letter is given the same width of
space (for example, the space for an “i” is as wide as the space
for a “w”).
nesting
A programming term that refers to embedding one construct
inside of another. A nested expression is an expression whose
result is used as an operand in another expression. The
expressions in the innermost parentheses are evaluated first.
For example, the command If ((a == b) && (c != d))
Then GoTo @continue contains two nested expressions:
(a==b) and (c != d). These expressions are evaluated first, and
their results are used as the operands for the logical And (&&)
expression.
numeric expression
An expression that evaluates to a value of type integer. A
numeric expression can be a numeric variable, numeric literal,
or any combination of these bound into one expression by
numeric operators.
operand
The object of a mathematical operation or a computer
instruction. An operand can be a value (such as a string or
integer literal), or it can be the location in memory at which
data is stored (such as a variable).
Glossary
operator
In programming and computer applications, a symbol or other
character indicating an operation that acts on one or more
operands. For example, the equal sign (=) is the assignment
operator, and the double-equal sign (==) is the equality
relational operator.
operator precedence
The order in which the various operators in an expression are
evaluated. Parentheses are often used to establish precedence.
For example, (2 + 3) * 4 = 20; but 2 + (3 * 4) = 14. The
expression between the parentheses is evaluated before the
rest of the expression. Otherwise, the order of precedence is:
multiplication and division, addition and subtraction, the
relational operators, and the logical operators. When operators
are of equal precedence (such as addition and subtraction),
they are evaluated from left to right.
Or
See bitwise Or, logical Or, and Exclusive Or.
output
The results of computer processing. Output can be sent to the
screen, a printer, or a file.
parameter
Information that is supplied to a command. Parameters follow
the command name and are separated by spaces. Some
parameters must be specified; others are optional.
path
A list of directories where DOS automatically searches for files
when it cannot find requested files in the current directory. A
PATH= statement is typically placed at the beginning of an
AUTOEXEC.BAT file. One advantage of specifying a path is
that programs located in directories listed in the path can be
executed from any directory.
pathname
In a hierarchical filing system, a listing of the drive and/or
directories that lead to a directory, file, or set of files. A
complete pathname, such as C:\WINAW\SCRFILES\*.SCX,
starts with the drive letter.
precedence
The order in which the various operators in an expression are
evaluated. See operator precedence.
program
A sequence of instructions that a computer can execute,
including all the commands and files it needs.
program file
An executable file that launches an application. A program file
has an .EXE, .PIF, .COM, or .BAT extension. For example,
AW.EXE is the program file that launches pcANWHERE for
DOS.
225
226
Glossary
range
The spread between specified low and high values or
beginning and ending times or dates.
read
For a computer, to collect information from an input source
such as a file.
record
The basic component of a data file. Usually each record is a
line of the file.
regular expression
When searching, a way to specify a range of possible matches.
This is also known as using wildcards. For example, when
searching for a DOS file, a question mark ( ? ) represents any
character, but only one character and an asterisk ( * )
represents any series of characters.
The pcANYWHERE for Windows Editor has its own set of
regular expressions:
[chars]
Any one of the characters between the
brackets
[~chars]
Any one of the characters except for those
specified between the brackets
[char1 - char2] Any one of the characters ranging from the
first to the last specified character (in ASCII
order)
@
Zero or more of the previous character
% or <
The beginning of a line
$ or >
The end of a line
\t
A tab character (0x08 in hexadecimal)
\f
A formfeed character (0x0c in hexadecimal)
\char
The character. For example, \\ means \
relational expression
An expression that uses a relational operator such as less than
(<) or greater than (>) to express the relation between two or
more values.
relational operator
A binary operator that allows you to compare two values or
expressions. The relational operators are <, >, ==, !=, =>, and
<=. The script language can use relational operators with
either integers or strings.
replace
To put new data in the place of other data, usually after
conducting a search for the data to be replaced. See search
and replace.
Glossary
reserved variable
Reserved variables are variables that have special meaning to
pcANYWHERE. They may contain, for example, current
parameter settings, results of operations, or the current date
and time. You can use reserved variables anywhere that
variables of the appropriate type (integer or string) are
allowed. See variable and Appendix A, “Reserved Words and
Variables.”
reserved word
Reserved words are identifiers that have special meaning to
pcANYWHERE and should not be used as user-defined
variable names. pcANYWHERE reserved words include the
titles of all commands, reserved variables, and global
variables. See Appendix A, “Reserved Words and Variables,”
for a list.
return
To transfer control from a subroutine back to the main body of
the script (to the line after the GoSub command). Also, the
value sent back from a subroutine.
run-time
Refers to the events that occur while the script is actually
executing.
scope
The set of rules governing when and how a variable may be
accessed. These rules determine when the variable name is
valid; that is, when it can be used in a script. Since script files
can call other script files to be run, the variables named in the
first script may not be accessible to the called script.
script
A text file containing commands in the pcANYWHERE script
language. pcANYWHERE source scripts have an extension of
.SCR and can be created in any standard ASCII text editor.
Compiled, executable pcANYWHERE scripts have extensions
of .SCX. In pcANYWHERE for Windows, you can create scripts
using the pcANYWHERE Editor.
search
To look for the location of a file, or to search a file or data
structure for specific data. A search is carried out by a
comparison or calculation to determine whether a match to
some specified pattern exists.
search and replace
A word processing function, in which the user can specify two
strings of characters—one string for the program to find and
the other to replace the first string with.
search string
The string of characters to be matched in a search, typically a
text string.
sign
The character used to indicate a positive (+) or a negative (-)
number.
227
228
Glossary
statement
The smallest executable part of a program. Each command is a
statement.
string
Any sequence of consecutive characters, usually text.
string expression
An expression that evaluates to a value of type string. A string
expression can be a string variable or string literal.
string literal
Any series of characters surrounded by a pair of single or
double quotation mark delimiters.
string variable
An arbitrary name assigned to a string. You can then use or
modify the string by referencing the string variable name. For
example, in the statement prompt = "Please click
Yes, No or Cancel" the variable named prompt is a string
variable.
subroutine
A group of commands that starts with a label and ends with a
Return command. A subroutine is executed when a GoSub
command specifies its label. Parameters are not passed
between the subroutine and the script.
substring
A section of a string. See string.
syntax
The set of rules governing how a command can be written.
syntax error
Syntax errors are detected during compilation and occur when
you make a mistake entering a command, such as not
enclosing a string in quotation marks, or specifying the wrong
number of parameters.
text file
A file composed of text characters, without formatting
controls; often refers to a document created by a word
processing program. Useful for transferring files between word
processing systems that could not otherwise read each other’s
documents. See ASCII file.
truncate
To cut off the beginning or end of a series of characters or
numbers; in particular, to eliminate one or more of the least
significant (typically rightmost) digits. In the pcANYWHERE
script language, text that does not fit into a string variable is
truncated.
type
In programming, type specifies the nature of a variable, such
as integer or string. Type can also refer to files and other data.
See data type.
unary operator
An arithmetic operator having only one operand. The script
language’s unary operator is the minus sign (-). Compare to
binary operator.
Glossary
user-defined variable
Variables that you define for your own use during the
execution of a script. See variable.
value
In programming and applications, a quantity represented by a
variable or displayed as a literal.
variable
The name of a location in memory that stores a value. Every
variable has a name, a data type, and a value. Variables
identify data that may change during the running of a script or
each time a script is run. See global variable, reserved variable
and user-defined variable.
variable expression
Any expression containing at least one variable. An expression
that must be evaluated during script execution.
wildcard
A symbol that enables multiple matching values to be returned
based on a shared feature. The pcANYWHERE script language
has two wildcards: the question mark ( ? ) and the asterisk ( * ).
The question mark stands for any single character, and the
asterisk stands for a character string of any length. For
example, the file specification *.* would return all files,
regardless of their filenames; the file specification *.SC? would
return all filenames having a three-character extension
beginning with SC (COMPUSRV.SCR, COMPUSRV.SCX, etc.).
Windows
The Microsoft Windows graphical environment.
write
To transfer information to an output device such as a printer
or monitor, or to a storage device such as a disk. The opposite
of read.
229
THIS PAGE LEFT BLANK INTENTIONALLY
Index
Symbols
!= (not equal), 23
", 19
$, 21, 22
$BrkLen reserved variable, 77
$Error reserved variable, 26, 212
$Result reserved variable, 26, 75
$TLineEnd reserved variable, 34
*, 23, 217
+, 23
- (minus), 19, 23
/, 23
:, 25
<, 23
<=, 23
= (assignment operator), 23
== (equal), 23
>, 23
>=, 23
[ ], 18
\f (backslash, f), Regular Expression search
option, 62
\t (backslash, t), Regular Expression search
option, 62
^, 19
|, 18
A
accelerator keys, 73
addition (+), 23
And logical operator, 23
ANSI terminal, 11
Answer command, 76
what it does, 30
appending
carriage return/linefeed, 191, 199
definition of, 217
string, 186
application, running on remote PC, 146, 164
are, 20
arithmetic operators, 23
ASCII
character set, 17
control codes, 19
decimal value of characters, 150
definition of, 217
assignment operator (=), 23, 24
definition of, 217
difference from equality operator, 27
Assist dialog box, 51
asterisk (*), 217
Regular Expression search option, 61
at symbol (@) wildcard, 61
attributes
definition of, 218
file, 104, 172
screen, 167
screen palette, 177
video, 167
audible alarm, 76
automating
communications sessions
commands, 29
file transfers, 7
login to online service, 10
program execution, 7
Script using Learn Mode, 13–14
unattended session, 7
Autosave feature, customizing, 69
AW.RCD file, 182
B
backslash (\)
Regular Expression search option, 62
backup, 70
Index
232
Backus-Naur Form (BNF), 17
definition of, 218
batch file, 218
Beep command, 76
what it does, 33
binary operators, 23
definition of, 218
bits-per-second (bps) speed, 183
bitwise And, 218
bitwise Or, 23
definition of, 218
blank lines, use of in script, 16
Boolean expression, 218
bps. See bits-per-second
brackets, square ([ ]), 18
branching, 27, 110
Break command, 77
what it does, 34
break signal, 77
buffer, clearing, 117, 140, 151
buttons, values for creating in message box,
126
C
call
definition of, 218
detection of incoming, 76
host PC, 53
prevention of collision between incoming
and outgoing, 171
remote PC, 155
Call Immediately check box, 54
called script, 148
calling
nested script, 148
subroutine, 109
Cancel Host After Session check box, 53
cancel operator, 169
caret symbol (^), 19
carriage return
appending, 191, 199
value of, 150
carriage return character, 20
carrier-detect signal (CD), 194
case
converting, 124, 193
ignoring, 176
of commands, 25
case-sensitivity
definition of, 218
specifying in text searches, 63
turning on or off, 176
CD command, 77
what it does, 36
chaining scripts together, 119
changing
cursor shape, 69, 83
directory, 77
document preferences, 67
file date, 173
file size, 174
file time, 175
parity, 179
character code, 219
characters
commands to clear from screen, 78
conversion of uppercase to lowercase,
124
declaring number to insert, 115
definition of, 218
deletion of, 92
echoing of, 172
filling a string with, 188
receiving single character from file, 139
sending, 150
translation to IBM scan code, 152
wait for receipt of, 195
Clear BOL command, 78
what it does, 40
Clear BOP command, 79
what it does, 40
Clear EOL command, 79
what it does, 40
Clear EOP command
what it does, 41
Index
Clear Screen command, 80
what it does, 41
clearing
keyboard buffer, 117
receive buffer, 140
screen characters, 78
send buffer, 151
Close command, 81
what it does, 38
closing file, 81
colon (:), 25
colors
commands that affect screen attributes, 42
of menus, 177
setting, 167
comm port. See communications port
commands
Answer, 76
Beep, 76
Break, 77
capitalization of, 25
CD, 77
Clear BOL, 78
Clear BOP, 79
Clear EOL, 79
Clear Screen, 80
Close, 81
communications-related, 29, 30
configuration loading, 30
Copy, 81
Create, 82
Cursor Block, 83
cursor control, 42
Cursor Down, 84
Cursor Home, 84
Cursor Left, 85
Cursor Line, 85
Cursor Off, 86
Cursor Position, 86
Cursor Restore, 87
Cursor Right, 88
Cursor Save, 88
Cursor Up, 89
commands (continued)
Decrypt, 90
definition of, 16, 219
Del, 91
Delete Char, 92
Delete Line, 92
Description, 93
Dial Host, 93
Dial Number, 94
Dial OnlSvc, 94
Dir, 95
displaying on screen, 50
drive/directory management, 36
Emulate, 96
Encrypt, 97
End, 98
End Menu, 99
End Terminal, 100
Exit, 100
file-related, 38
Find First, 101
Find Next, 102
generating with Assist dialog box, 53
Get Environment, 103
Get File Attr, 104
Get File Date, 105
Get File Size, 106
Get File Time, 107
Get Free Disk, 108
GoSub, 109
GoTo, 110
grouping, 16
Hang, 111
If...GoTo, 111
If...Then, 111
Index, 112
Input, 113
Input Key, 114
Insert Char, 115
Insert Line, 116
insertion into script file, 50
Keyboard Flush, 117
Keyboard Hit, 117
233
234
Index
commands (continued)
keyboard-related, 33–34
Let, 118
Link, 119
Load Config, 120
Load FKeys, 121
Load HostInfo, 121
Load OnlSvcInfo, 122
Load Translation, 123
Lower, 124
MD, 124
MessageBox, 125
notation of, 18
On Cancel, 128
On Disconnect, 129
On Error, 130
On Receive, 131
On Timeout, 132
online reference, 50
Open, 133
Print File, 134
Print Line, 134
Print String, 135
Printer, 135
printing-related, 40
RD, 136
Read Line, 137
Read String, 139
Receive Char, 139
Receive Clear, 140
Receive File, 141
Receive Line, 142
Receive String, 143
Ren, 144
Reset, 145
Return, 145
Run, 146
screen display-related, 40
Screen Restore, 147
Screen Save, 147
Script, 148
script processing, 32
Seek, 149
commands (continued)
Send Char, 150
Send Clear, 151
Send File, 151
Send Line, 152
Send ScanCode, 152
Send String, 153
Session Delay, 154
Session Dial, 155
Session End, 156
Session ExitMode, 157
Session OnError, 158
Session OverWrites, 159
Session Retry, 160
Session Timeout, 161
SessOpr Host Run, 162
SessOpr Host Send, 163
SessOpr Remote Run, 164
SessOpr Remote Send, 165
Set Attribute, 167
Set Cancel, 169
Set CharDelay, 170
Set Disconnect, 170
Set DTR, 171
Set Echo, 172
Set File Attr, 172
Set File Date, 173
Set File Size, 174
Set File Time, 175
Set Flow, 175
Set IgnoreCase, 176
Set Palette, 177
Set Parity, 179
Set Port, 180
Set Protocol, 180
Set Quiet, 181
Set Record, 182
Set RTS, 183
Set Speed, 183
Set Timeout, 184
Set Translation, 185
StrCat, 186
StrCmp, 186
Index
commands (continued)
string operations, 39
StrLen, 187
StrSet, 188
SubStr, 189
summary of functions, 28
Terminal, 190
Trim, 190
Type File, 191
Type Line, 191
Type String, 192
Upper, 193
Wait Carrier, 194
Wait Receive, 195
Wait Silence, 196
Wait String, 197
Wait Time, 198
Wait Until, 199
Write Line, 199
Write String, 200
comments
definition of, 15, 219
example of creating, 200
indicating in scripts, 11
use of, 15
communications parameters
loading, 11
communications port
selecting, 180
communications session
automating, 7
commands that affect, 30
unattended, 155
commands that affect, 29
creating scripts for, 51
comparing strings, 186
compiling scripts, 8, 56
definition of, 56
CompuServe, automatic login to (sample
script), 10–12
concatenation, 186
definition of, 219
conditional expression
definition of, 219
conditional processing, 26, 111
configuration
commands for loading, 30
example of loading, 11, 76
loading before dialing, 120
of keyboard, 73
overriding, 121
connection
initiation of, 9
loss of, 129, 170
serial, 179
termination of, 111
to host PC, 93
to online service, 94
control
flow of, 27
return of, 98, 109, 145
transfer of, 25
control codes
in string literals, 20
conventions of this manual, 6
Copy (pcANYWHERE Editor Edit menu)
command, 47
Copy command, 81
what it does, 36
copying
files, 81
substring, 189
text, 47
unselected text, 70
crash-recovery ability, 181
Create command, 82
what it does, 38
creating
comments in a file, 200
directory, 124
files, 82
message box, 125
scripts, 8, 46
scripts with Learn Mode, 13–14
235
Index
236
cursor
blinking, 69
changing shape, 69, 83
commands that affect, 42, 83
definition of, 219
moving, 85
Cursor Block command, 83
what it does, 41
Cursor Down command, 84
what it does, 41
Cursor Home command, 84
what it does, 41
Cursor Left command, 85
what it does, 41
Cursor Line command, 85
what it does, 41
Cursor Off command, 86
what it does, 41
Cursor Position command, 86
what it does, 41
Cursor Restore command, 87
what it does, 41
Cursor Right command, 88
what it does, 41
Cursor Save command, 88
what it does, 42
Cursor Up command, 89
what it does, 42
customizing
keyboard, 71
Cut (pcANYWHERE Editor Edit menu)
command, 47
D
data bits, 179
data declaration, 220
data flow, 183
data type, 220
data-carrier-detect signal (DCD), 194
date
of file, 105
changing, 173
system, 199
to dial host, 54
declaration of variables, 20, 21
declaration, definition of, 220
Decrypt command, 90
what it does, 39
default, 220
Del command, 91
what it does, 36
delay, 154
between characters, 170
setting value of, 170
Delete (pcANYWHERE Editor Edit menu)
command, 47
Delete Char command, 92
what it does, 42
Delete Line command, 92
what it does, 42
deleting
characters, 92
directory, 136
files, 91
lines, 92
rows, 92
text, 47
delimiters, 19
definition of, 220
Description command, 93
what it does, 43
Dial Host command, 93
what it does, 30
Dial Number command, 94
what it does, 30
Dial OnlSvc command, 94
what it does, 30
Dir command, 95
what it does, 37
directory
commands that act upon, 36
creation of, 124
current, 219
definition of, 220
deletion of, 136
displaying list of, 95
example of how to change, 77
renaming, 144
Index
disconnect
processing, 129
setting, 170
disk, determining free space on, 108
display. See screen
displaying
characters received in terminal mode, 172
command reference on-screen, 50
directory, 95
file contents on screen, 191
incoming text, 11
line, 191
message box, 125
progress messages about command
processing, 181
string, 192
division, 23
Document Preferences... (pcANYWHERE
Editor Options menu) command, 67
dollar sign character ($), 21, 22
wildcard, 61
double quotation marks (")
as string delimiters, 19
drive, commands that affect management of,
37
DTR signal, 171
E
echoing, 11, 172
Edit menu commands, 47
editing scripts, 8, 49
Editor Preferences... (pcANYWHERE Editor
Options menu) command, 68
Editor. See pcANYWHERE Editor
empty string, 221
emulate
ANSI terminal, 11
host terminal, 190
terminal types to emulate, 96
Emulate command, 96
what it does, 30
Encrypt command, 97
what it does, 39
End command, 98
what it does, 32
End Menu command, 99
what it does, 32
End Terminal command, 100
what it does, 32
end-of-file (EOF)
definition of, 221
environment
definition of, 221
environment variable
definition of, 221
retrieve setting, 103
equal sign (=), 24, 217
equality operator (==), 23
definition of, 221
difference from assignment operator, 27
error
correcting, 57
occurrence of, 130
processing, 26, 130
SessOpr command failure, 158
run-time, 212
selection of processing options, 54
syntax, 57
table of, 212
error messages
definition of, 221
Esc key
example, 118
processing, 169
exclusive Or, 23
definition of, 221
Execute... (pcANYWHERE Script menu)
command, 58
Exit command, 100
what it does, 32
exit pcANYWHERE, 100
Editor, 49
expression, 22
assigning to variable, 118
definition of, 221
nesting, 27
testing, 27
237
Index
238
F
file attributes
definition of, 222
retrieving, 104
setting, 172
file not found errors
preventing, 133
file pointer
definition of, 222
position of, 149
file specification, 222
file transfers, 141, 151
automating, 7
example, 141
of unattended, 158
host to remote, 163
remote to host, 165
setting protocol for, 180
filename extensions
.BAK, 70
.ERR, 57
.KEY, 73
.SCR, 57
files
backup, 70
batch, 218
closing, 81
commands that affect, 175
copying, 81
creation of, 82
date of, 105, 173
deletion of, 91
displaying contents on screen, 191
executable, 221
executing, 162
execution on remote PC, 164
finding, 103
finding specific lines in, 66
keyboard configuration, 73
listing found, in pattern search, 65
listing on screen, 95
locking, 70
management of, 36
files (continued)
opening, 133
overwriting, 159
printing, 134
reading, 38
receiving, 141
renaming, 144
reopening same, 70
searching single, for text, 62
sending, 151
SHARE.EXE, 70
size of, 174
time of, 107, 175
transferring, 151
writing to, 38
files, commands that affect managment of, 38
filling a string, 188
Find Again... (pcANYWHERE Editor Search
menu) command, 63, 66
Find Files Containing... (pcANYWHERE
Editor Search menu) command, 64
Find First command, 101
what it does, 37
Find Next command, 102
what it does, 37
Find... (pcANYWHERE Editor Search menu)
command, 62
flow control
setting, 175
fonts, screen, customizing, 69
free space, 108
function keys, programming, 121
functions, assigning to keystrokes, 71–74
G
Get Environment command, 103
what it does, 37
Get File Attr command, 104
what it does, 37
Get File Date command, 105
what it does, 37
Get File Size command, 106
what it does, 37
Index
Get File Time command, 107
what it does, 37
Get Free Disk command, 108
what it does, 37
global variables, 20
definition of, 21, 222
GoSub command, 25, 109
what it does, 32
GoTo command, 25, 110
what it does, 32
greater than (>), 23
Regular Expression search option, 61
greater th0an or equal (>=), 23
H
Hang command, 111
what it does, 32
hang up, 111, 156
hardware configuration
loading, 120
hardware flow control, 175
host
dialing, 94
disable after completion of session, 53
initiating connection with, 93
launching application on, 162
override configuration information of, 122
selecting name of, 53
Host to Call drop-down list box, 53
I
IBM scan codes, 152
icons
display of in message box, 126
explained, 75
identifiers, 222
If Error Occurs list box, 54
If...GoTo command, 27, 111
what it does, 32
If...Then command, 26, 111
what it does, 32
Index command, 112
what it does, 39
Input command, 113
what it does, 33
Input Key command, 114
what it does, 33
Insert Char command, 115
what it does, 42
Insert Line command, 116
what it does, 42
integer
definition of, 223
integer literals, 19
definition of, 223
integer variables
declaring, 22
J
jump, 110
K
Key Assignments... (pcANYWHERE Editor
Options menu) command, 71
keyboard
configuring, 73
customizing, 71
keyboard buffer
clearing, 117
Keyboard Flush command, 117
what it does, 34
Keyboard Hit command, 117
what it does, 34
keypress
determine hit, 117
Esc, 169
retreiving, 114
undoing, 70
239
Index
240
L
label
definition of, 25, 27, 223
naming, 28
launching
application
on host PC, 162
on remote PC, 146, 164
script file, 58
second script, 148
Learn Mode, 13–14
length of string, 187
less than (<), 23, 61
less than or equal (<=), 23
Let command, 118
what it does, 43
linefeed character, 20
lines
deletion of, 92
displaying on screen, 191
insertion of, 116
printing, 134
reading from file, 137
receiving, 142
sending, 152
writing to file, 199
line-terminating character, 152
Link command, 119
what it does, 32
List Found Files... (pcANYWHERE Editor
Search menu) command, 66
literals, 18
definition of, 19, 223
integer, 19
string, 19
Load Config command, 120
what it does, 30
Load FKeys command, 121
Load HostInfo command, 121
what it does, 30
Load OnlSvcInfo command, 122
what it does, 30
Load Translation command, 123
what it does, 31
loading
configuration, 11, 76, 120
function key file, 121
keyboard configuration files, 73
local
user-defined variables, 21
variables, 20
definition of, 223
logical And, 223
logical expressions, 23
definition of, 223
logical operators, 23
definition of, 223
logical Or, 223
login
automating with script, 10
example of automatic, 10
log-on prompt
display of, 172
Lower command, 124
what it does, 39
lowercase, conversion to uppercase, 193
M
macros
definition of, 224
recording and playing in pcANYWHERE
Editor, 59
margin, right, 67
mask, definition of, 224
MD command, 124
what it does, 37
menu bar accelerators, 73
menus, colors of, 177
message box, display of, 125
MessageBox command, 27, 125
what it does, 34
minus operator (-), 19
Index
modems
error-correcting, protocol to use, 181
preparing prior to connection, 12
monochrome monitor, 177
moving
cursor, 84–85, 86, 88, 89
file pointer, 149
moving files between directories, 144
multiplication, 23
N
negation, 23
negative integer, 19
nested
expressions, 27
scripts, 148
subroutines, 109
nesting
definition of, 224
nonliteral searches, 61
not equal (!=), 23
not equal (<>) Regular Expression search
option, 61
notation, command, 18
numeric expression, 224
O
On Cancel command, 128
what it does, 32
On Disconnect command, 129
what it does, 32
On Error command, 130
what it does, 33
On Receive command, 131
what it does, 34
On Timeout command, 132
what it does, 34
online command reference, 50
online service
automatic login to, 10
initiate connection to, 94
override configuration information of, 122
Open command, 133
what it does, 38
opening files on remote PC, 133
operands, 22
operators, 22
Or
bitwise, 23
exclusive, 23
logical operator, 23
overwriting existing files, 55, 159
P
parameters, 18
definition of, 16, 225
what they do, 17
parentheses, 23, 27
parity, 179
setting, 179
password
example, 98
of decryption, 90
of prompting user for, 198
of sending a, 153
transmission of, 131
waiting for, 197
Paste (pcANYWHERE Editor Edit menu)
command, 47
pcANYWHERE
exiting, 100
file-transfer protocol, 180
pcANYWHERE Editor
Autosave feature, 69
creating scripts with, 46
Edit menu commands
Play Back Macro, 59
Record Macro, 59
Stop Recording Macro, 59
editing window
closing, 49
opening, 46
macro recording feature, 59
Options menu commands
Document Preferences..., 67
Editor Preferences..., 68
Key Assignments..., 71
Regular Expression option, 61
241
242
Index
pcANYWHERE Editor (continued)
saving document preferences, 68
Search menu commands
Find Again..., 63, 66
Find Files Containing..., 64
Find..., 62
GoTo Line..., 66
List Found Files..., 66
Replace..., 63
percent sign (%), Regular Expression search
option, 61
phone number, dial specified, 94
pipe (|), 18
Play Back Macro (pcANYWHERE Editor Edit
menu) command, 59
pointer. See file pointer
port, selecting, 180
position
of cursor, 86
of file pointer, 149
precedence, 225
preferences
changing, 67
preprocessing, 8
Print File command, 134
what it does, 40
Print Line command, 134
what it does, 40
Print String command, 135
what it does, 40
Printer command, 135
what it does, 40
printer, selecting, 56
printing
commands that affect, 40
file, 134
line, 134
script, 56
simultaneously to screen and printer, 135
string, 134
program execution on remote PC, 164
programmable function key, 121
progress messages, displaying, 181
prompting user to override configuration
information, 121, 122
pseudocode, 8
example of, 10
Q
question mark (?), Regular Expression search
option, 61
quotation marks
as string delimiters, 19
R
rate of data flow, 183
RD command, 136
what it does, 37
Read Line command, 137
what it does, 38
Read String command, 139
what it does, 38
reading files, 38
Receive Char command, 139
what it does, 34
Receive Clear command, 140
Receive File command, 141
what it does, 35
Receive Line command, 142
what it does, 35
Receive String command, 143
what it does, 35
Record Macro (pcANYWHERE Editor Edit
menu) command, 59
recording file
enabling, 182
redial
entering value in Assist dialog box, 54
specify number of minutes between
retries, 154
specify number of times to, 160
Reference (pcANYWHERE Tools menu), 50
Reference dialog box, 50
Regular Expression option, 61
regular expression, definition of, 226
Index
relational expression, definition of, 226
relational operators, 23
definition of, 226
removing leading/trailing spaces, 190
Ren command, 144
what it does, 37
renaming
directory, 144
file, 144
Replace... (pcANYWHERE Editor Search
menu) command, 63
Request to Send (RTS) signal, 183
reserved variables, 20, 22
definition of, 227
list of, 209
reserved words, 18
definition of, 17, 227
list of, 205
Reset command, 145
what it does, 35
restoring cursor, 87
retry
entering value in Assist dialog box, 54
number of minutes between, 154
number of times to, 160
Return command, 145
what it does, 33
right margin, setting, 67
rows
deletion of, 92
insertion of, 116
RS-232 Data Terminal Ready (DTR) signal, 171
RS-232 Request to Send (RTS) signal, 183
RTS See Request to Send
RTS/CTS flow control, 175
Run command, 146
what it does, 43
running
application
on host PC, 162
on remote PC, 146, 164
script, 9, 58
run-time errors, 212
S
Save Recorded Script dialog box, 13
Save Script File As dialog box, 14
saving
cursor attributes, 89
document preferences, 68
screen snapshot, 147
script file, 14, 49
scan codes, 152
screen
attributes, 167
clearing characters from, 78
colors, 167–169, 177
commands that affect display, 40
deletion of rows on, 92
palette, 177
restoring saved image, 147
saving image, 147
setting colors, 167
snapshot, 147
Screen Restore command, 147
what it does, 42
Screen Save command, 147
what it does, 42
script
adding a description to, 93
automatic creation of, 13–14
branching, 27, 110
chaining together, 119
commands that control processing of, 32
compiling, 8, 56
conditional processing of, 26, 111
continuing processing when error occurs,
158
creating, 8, 46
using an existing script, 49
using Learn Mode, 13–14
definition of, 7, 227
editing, 8, 49
error handling in, 26
labels in, 25
launching within a current script, 148
linking, 119
243
244
Index
script (continued)
nested, 148
printing, 56
programming function keys, 121
redirection to a label, 28
running, 9, 58
run-time errors, table of, 212
saving, 49
syntax errors in, 212
termination of processing, 98
upon disconnection, 171
testing, 16, 58
Script command, 148
what it does, 33
script language
See also commands, script
case sensitivity, 25
components of, 15
reserved words, list of, 205
summary of commands, 28
Scripts dialog box, 45
Scripts... (pcANYWHERE Utilities menu)
command, 45
scrolling, 191
searching
for files, 103
example using conditional
processing, 112
for special characters, 61
text
Regular Expression option, 61
specifying search pattern, 60
Seek command, 149
what it does, 38
semicolon character (;), 11
Send Char command, 150
what it does, 35
Send Clear command, 151
what it does, 35
Send File command, 151
what it does, 35
Send Line command, 152
what it does, 35
Send ScanCode command, 152
Send String command, 153
what it does, 35
sending
file, 151
line, 152
string, 153
separators
use of in scripts, 11
Session command
inserting into script file using Assist dialog
box, 51
Session Delay command, 154
what it does, 29
Session Dial command, 155
what it does, 29
Session End command, 156
what it does, 29
Session ExitMode command, 157
what it does, 29
Session OnError command, 158
what it does, 29
Session OverWrites command, 159
what it does, 29
Session Retry command, 160
what it does, 29
Session Timeout command, 161
what it does, 29
session. See communications session
SessOpr Host Run command, 162
what it does, 29
SessOpr Host Send command, 163
what it does, 29
SessOpr Remote Run command, 164
what it does, 29
SessOpr Remote Send command, 165
what it does, 29
Set Attribute command, 167
what it does, 42
Set Cancel command, 169
what it does, 33
Set CharDelay command, 170
what it does, 35
Index
Set Disconnect command, 170
what it does, 33
Set DTR command, 171
what it does, 31
Set Echo command, 172
what it does, 31
Set File Attr command, 172
what it does, 37
Set File Date command, 173
what it does, 37
Set File Size command, 174
what it does, 38
Set File Time command, 175
what it does, 38
Set Flow command, 175
what it does, 31
Set IgnoreCase command, 176
what it does, 39
Set Palette command, 177
what it does, 42
Set Parity command, 179
what it does, 31
Set Port command, 180
what it does, 31
Set Protocol command, 180
what it does, 31
Set Quiet command, 181
what it does, 42
Set Record command, 182
what it does, 31
Set RTS command, 183
what it does, 31
Set Speed command, 183
what it does, 31
Set Timeout command, 184
what it does, 35
Set Translation command, 185
what it does, 31
setting
bps speed, 183
cancel operator, 169
disconnect, 170
display of received characters, 172
setting (continued)
Document Preferences, 67
DTR signal, 171
file attributes, 172
file date, 173
file size, 174
file time, 175
flow control, 175
recording mode, 182
RTS signal, 183
screen attributes, 167
tabs, 67
value
of between-character send delay, 170
of timeout, 184
SHARE.EXE file, 70
silence, waiting for, 196
single quotation marks (")
as string delimiters, 19
size of file, 106, 174
snapshot, 147
software flow control, 175
spaces
in script language, 25
trimming, 190
stop bit, 179
Stop Recording Macro (pcANYWHERE
Editor Edit menu) command, 59
StrCat command, 186
what it does, 39
StrCmp command, 186
what it does, 39
string
appending a, 186
commands that perform operations on, 39
comparison, 186
examples, 187
concatenation, 186
decryption of, 90
definition of, 228
determining length of, 187
displaying on screen, 192
encryption of, 97
245
246
Index
string (continued)
expression, 228
filling with specified character, 188
reading, 139
receiving, 142
searching for, in files, 62
sending, 152, 153
substring location, 112
waiting for receipt of specific, 197
writing to file, 199
string literals, 19
capitalization of, 25
definition of, 19, 228
examples of, 20
string variables
declaring, 22
definition of, 228
StrLen command, 187
what it does, 39
StrSet command, 188
what it does, 39
subdirectory
creation example, 125
subroutine
calling, 109
definition of, 228
nesting, 109
termination of processing, 145
SubStr command, 189
what it does, 39
substring
definition of, 228
extraction of, 189
locating position of, 112
subtraction, 23
syntax
See also entries for individual commands
conventions of, 17
definition of, 16, 228
error, 57
correction of, 57
definition of, 228
table of, 212
system date/time, 199
T
tabs
setting spacing of, 67
substituting spaces for, 68
temporary files
deletion of, 91
Terminal command, 190
what it does, 33
terminal emulation
host, 190
list of terminal types, 96
remote, 96
resetting, 145
terminating
connection, 111
script processing, 98
when error occurs, 158
subroutine processing, 145
unattended session, 156
testing script file, 58
testing scripts, 16
text
See also replacing text
automatic indenting of, 68
copying
unselected, 70
copying to Clipboard, 47
deletion of, 47
display of incoming, 11
pasting, 47
replacing, 63
selection of, 47
wrapping, 47, 68
This, 106
tilde(~), Regular Expression search option, 62
time
between retries, 154
of file, 107
changing, 175
system, 199
to dial host, 54
Index
Time/Date (pcANYWHERE Editor Edit menu)
command, 47
timeout
occurrence of, 132
specifying value, 161
values
entering, 55
setting, 184
transferring
file, 151
to host, 165
to remote PC, 163
translation
of characters to IBM scan code, 152
translation table, 123
activating/deactivating, 185
loading, 123
Trim command, 190
what it does, 39
trimming leading/trailing blanks, 186, 190
upon file loading, 71
Type File command, 191
what it does, 34
Type Line command, 191
what it does, 34
Type String command, 192
what it does, 34
Typing Replaces Selection option, 70
U
unary operators, 23
definition of, 228
unattended session, 155
automating, 7
creating scripts for, 51
definition of, 51
Undo (pcANYWHERE Edit menu) command,
47
undoing keystrokes, 70
Upper command, 193
what it does, 40
uppercase, conversion to lowercase, 124
user input, 113
user-defined variables, 20
definition of, 229
global, 21
local, 21
V
validation, 220
variable
assigning value to, 24
declaring, 20, 21
definition of, 20, 229
global, 20, 21
integer, 22
local, 20
reserved, 20, 22
list of, 209
string, 22
user-defined, 20, 229
variable expression
definition of, 229
variable name, 18
identical to reserved word, 118
variables, 20
vertical bar (|), 18
video attributes, 167
W
wait
for carrier-detect signal, 194
for character to be received, 195
for inactivity to timeout, 196
for incoming call, 76
for password, 197
for specified number of seconds, 198
for specified time, 199
Wait Carrier command, 194
what it does, 35
WAIT parameter, 162
Wait Receive command, 195
what it does, 36
Wait Silence command, 196
what it does, 36
247
Index
248
Wait String command, 197
what it does, 36
Wait Time command, 198
what it does, 36
Wait Until command, 199
what it does, 36
wildcards
definition of, 229
Regular Expression search option, 61
word wrap, 47
Write Line command, 199
what it does, 38
Write String command, 200
what it does, 38
writing to files, 38
X
XON/XOFF flow control, 175
Y
YMODEM-G, compared to ZMODEM, 181
Z
ZMODEM
compared to YMODEM-G, 180
file transfer example, 152