home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
200-299
/
ff246.lzh
/
NComm
/
Script.doc
< prev
next >
Wrap
Text File
|
1989-09-14
|
12KB
|
427 lines
The NComm V1.8 scriptlanguage
=============================
A scriptfile is an ASCII textfile that consists of different commands,
separated by one or more linefeeds. Edit the scriptfiles with your
favourite editor. Only one command is allowed per line, but blank
lines are also OK. A line can consist of blanks before the command and
between parameters. Comments can be added by entering a semicolon. A
label is marked with a colon as its last character, e.g. "quit:". The
script commands are case independent, but strings within quotes are
not.
Scripts are mainly used to automate logons, or to companion you while
you are online. Scripts can also perform more advanced functions,
like grabbing mail and perhaps posting it on another board (or even
printing it!). You set the limits...
Two example scripts have been included with the NComm package. Take a
look at them if you don't understand how to use the commands.
Important: The filenames specified in a scriptfile are relative to
the current directory, NOT the default upload and download
directories!
Summary of Script commands
--------------------------
ASCSEND
Starts ASCII text send of the filename given. Example:
ASCSEND "df1:text/msg"
----------------------------------------------------------------------
BEEP
Will cause an audible 'beep' of the terminal and / or will flash the
screen and / or will bring the screen to front, depending on what you
have configured in the SCREEN menu. Nothing is sent through the serial
port.
----------------------------------------------------------------------
BREAK
Sends a break to the host machine. Equivalent to SEND "\l".
----------------------------------------------------------------------
CAPTURE
Toggles ASCII capture on/off. Examples:
CAPTURE "filename"
Will open the capture file and turn on capture. It will be opened in
'append mode' if the file exists...
CAPTURE SUS
Will suspend capture. Capture can be turned on again with the command
CAPTURE ON
CAPTURE OFF
Will turn capture off and close the file. The file cannot be opened
again with the CAPTURE ON command.
----------------------------------------------------------------------
CD
Problems occur when the "CD" command is used with the CLI function.
The "CD" command has therefore been made a special function. It
simply changes the directory that is to be used for commands started
with the "CLI" function.
Example:
CD "RAM:" ;Will change the current working directory to 'RAM:'
----------------------------------------------------------------------
CHAIN
Will start a new script. The control will never return to the calling
script. This is useful when you need extremely long scripts that
won't fit in memory.
Example:
CHAIN "NComm:ReadNews.script"
----------------------------------------------------------------------
CLI
Will execute a program or a command. The output from these programs
and commands will occur in the NComm window. This command will be
relative to the directory you were standing in when you started NComm.
Please note; Current Directory can not be set with the CLI command,
probably due to problems with the Amiga operating system. The "CD"
function must therefore be used for this purpose.
Examples:
CLI "dir dh0:comms"
CLI "type ram:foo.bar"
CLI "pkax ram:grabfile.arc"
----------------------------------------------------------------------
CONFIG
Will read a new configuration file. Example:
CONFIG "NComm:MBBS.config"
----------------------------------------------------------------------
CONVERSE
Will wait for a prompt from the host machine and answer it.
Examples:
CONVERSE "Enter your name:" "Name\n" ;Waits for 'Enter your name:'
CONVERSE "enter your password:" "\p\n" ;Sends phonebook password + CR
CONVERSE "Command:" "G\n" ;Sends 'G' and newline
----------------------------------------------------------------------
DELAY
The script program will take a break. The program will function as
normal.
Examples:
DELAY 5 ;Wait 5 seconds
DELAY UNTIL 12:00 ;Wait until 12 o'clock.
----------------------------------------------------------------------
DIAL
Will dial one or more phonenumbers. Can also dial entries in the
phonebook. If you choose to dial phonenumbers, use the command
'DIAL#'. The numbers must be placed within quotation marks. If you
choose to dial more than one number, the numbers can be separated by a
comma.
Examples:
DIAL# "454143"
DIAL# "380949", "493210", "454143"
Named entries in the phonebook can be dialled by specifying the
boardname within quotation marks. You only have to specify the number
of letters required to separate the board from the others. The
name is not case sensitive.
Examples:
DIAL "AmigaBBS"
DIAL "rode", "Mike's", "media"
DIAL "Rodeløkka (M)BBS"
----------------------------------------------------------------------
DOWNLOAD
Will download a file from the host machine. The protocol specified in
the TRANSFER menu will be used as long as nothing else is specified.
If you want to specify another protocol, enter a comma and a letter.
X == Xmodem, Y == Ymodem.
Examples:
DOWNLOAD "df1:junk" ;Will use the default protocol
DOWNLOAD "df0:trash",X ;Will always use Xmodem
----------------------------------------------------------------------
DTENTHS
This is a much more precise delay command, but only use this command
when this accuracy is needed, since it will lock up the system. The
DTENTHS parameter is the number of tenth seconds to wait.
Examples:
DTENTHS 2 ;Wait 0.2 seconds
DTENTHS 16 ;Wait 1.6 seconds
----------------------------------------------------------------------
DWHENS
Will disable all previously used WHEN commands. See: WHEN.
----------------------------------------------------------------------
END
Will stop the execution of the script. This command is especially
useful in front of subroutines.
Example:
WHEN "Read>" GOSUB next
WAIT "No more unread."
END
Next: SEND "\n"
MESSAGE "(Skipping to next unread)\n"
RETURN
----------------------------------------------------------------------
GOSUB
Will call a named subroutine. Useful when you want to use the same
command many times within a script, or in connection with WHEN or
TIMEOUT. The subroutine is ended with 'RETURN', and the control is
passed to the line following the GOSUB afterwards.
Example:
GOSUB myRoutine
END
MyRoutine: MESSAGE "Fooo\n"
BEEP
RETURN
----------------------------------------------------------------------
GOTO
Ever heard of this? Will jump to a named place in the script.
Example:
GOTO quit
...
quit: CAPTURE OFF
HANGUP
END
----------------------------------------------------------------------
HANGUP
Will send the hangup string to the modem.
----------------------------------------------------------------------
LOADKEYS
Will read a new macrokeys file.
Example:
LOADKEYS "NComm:dec.Keys"
----------------------------------------------------------------------
LOADPHONE
Will read a new phonebook file.
Example:
LOADPHONE "NComm:dialdir.phone"
----------------------------------------------------------------------
MESSAGE
Will write a message on the screen. Nothing is sent through the serial
port.
Example:
MESSAGE "\fReading mail...\n"
MESSAGE "Storing mail in file \"DF1:Mail.txt\"\n"
----------------------------------------------------------------------
MSGSEND
Same as the "message send" function in the TRANSFER menu, will upload
a message.
Example:
MSGSEND "DF1:tekst/msg"
----------------------------------------------------------------------
PRINTER
Turns the printer ON or OFF.
Example:
PRINTER ON ;Will turn on the printer
PRINTER OFF ;Will turn off the printer
----------------------------------------------------------------------
QUIT
Exits NComm.
----------------------------------------------------------------------
REQUEST
This function is used when the scriptfile is run without human
presence. It will then be unpreferable that AmigaDOS puts up a
requester if problems occur (disk full, read / write error etc.) By
turning request OFF, this is disabled.
Example:
REQUEST OFF ;Turns requesters off
REQUEST ON ;Will turn the requesters back on again
----------------------------------------------------------------------
RETURN
Returns from a subroutine. See GOSUB.
----------------------------------------------------------------------
SEND
Sends a string to the host machine.
Examples:
SEND "\n" ;Linefeed
SEND "Read\n" ;'Read' plus a CR
SEND "\m1^z" ;Macro #1 plus a 'Control-Z'
SEND "\p\n" ;The password stored in the phonebook plus a CR
----------------------------------------------------------------------
TIMEOUT
This command lets you configure how long NComm should wait in a WAIT
or CONVERSE command. Default timeout is 'forever', but this is not
preferable if the script is running without human assistance. If the
host machine does not answer, it is reasonable to believe that it has
hung, and a scriptfile should then automatically disconnect from the
system. The TIMEOUT command can be used in many ways.
Examples:
TIMEOUT 10
Means that NComm shall wait a maximum of 10 seconds. If no text has
been received within the timelimit, NComm will go on with the next
command.
TIMEOUT 10 SEND "\n"
Specifies that NComm is to wait a maximum of 10 seconds for each WAIT
or CONVERSE command. If the specified text has not been received
within 10 seconds, NComm will send a linefeed to the host machine and
will continue waiting for the text. NComm will continue sending
linefeeds every 10th second until the host machine has answered.
TIMEOUT 0
NComm is to go back to the default mode, i.e. wait forever.
Example of typical usage:
TIMEOUT 30 GOTO quit
CONVERSE "Enter your name:" "Daniel Bloch\n"
CONVERSE "Enter your password:" "gruff\n"
CONVERSE "Command:" "GRAB\n"
...
...
END
quit: MESSAGE "\n\nThe board has hung, call the SysOp!!!\n"
BEEP
HANGUP ;Hang up so that we won't get a shock when
END ;the next phonebill arrives!
----------------------------------------------------------------------
UPLOAD
Uploads a file to the host machine. See the 'DOWNLOAD' function for
the correct syntax.
----------------------------------------------------------------------
WAIT
Waits for a special text to be received. Will wait forever if the
TIMEOUT command has not been used.
Examples:
WAIT "Command:" ;Wait for 'Command:'
WAIT "\n" ;Wait for a linefeed
WAIT "" ;Wait for 'anything'
----------------------------------------------------------------------
WHEN
Defines what to do when a special text is received.
Typical example:
WHEN "--more--" SEND " "
This command will make NComm send a 'blank' line every time it
receives the 'more' prompt from the host machine. This is independent
of where in the script you reside. It is possible to specify up to
ten such textstrings.
Example:
WHEN "--more--" SEND " "
WHEN "NO CARRIER" END
WHEN "Sysop is coming online!" GOSUB ShutUp
WHEN "No more unread" GOTO quit
loop: CONVERSE "Command:" "\n"
GOTO loop
quit: SEND "G;Y\n"
END
ShutUp: SEND "I'm not at home! You are chatting with a scriptfile!\n"
SEND "Send BIBI at the speed of light!!!\n\n"
RETURN
Input from the keyboard is echoed back from the modem when off-line,
which makes it possible to request input from the user before dialling:
MESSAGE "Execute MBBS.script (y/n) ?"
WHEN "Y" goto yes
WAIT "N"
END
yes: DWHENS
...