home *** CD-ROM | disk | FTP | other *** search
- The NComm V1.92 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...
-
- One example script and one Host-Mode script 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"
-
- The TIMEOUT command also concerns ASCSEND. If ASCSEND is halted by a
- ^S and no ^Q has been received within the timelimit specified by
- TIMEOUT, the script will go on with the next command. XON will be
- turned on before ASCSEND.
-
- ----------------------------------------------------------------------
-
- 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"
-
- ----------------------------------------------------------------------
-
- CLRSTACK
- This command clears the RETURN stack, i.e. it forgets active
- subroutine calls (gosubs). The command is handy at error situations,
- when you wish to "jump out" of the program and start over again, for
- example in conjunction with TIMEOUT or WHEN commands.
-
- ----------------------------------------------------------------------
-
- 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"
-
- ----------------------------------------------------------------------
-
- DLWHEN
- Deletes the last defined WHEN command. Repeated usage will succesive
- delete the "previous" WHEN command. See: WHEN.
-
- ----------------------------------------------------------------------
-
- 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.
- The filename is "dummy" when using Zmodem.
-
- X == Xmodem, Y == Ymodem, B == Ymodem-B, G == Ymodem-G, Z == Zmodem,
- K == Kermit, E == External XPR (as defines in config file)
-
- 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
-
- ----------------------------------------------------------------------
-
- DUMP
- Command for debugging a script. It dumps a list of all variables and
- what they contain, on screen.
-
- ----------------------------------------------------------------------
-
- DWHENS
- Will disable all previously used WHEN commands. See: WHEN.
-
- ----------------------------------------------------------------------
-
- ECHO
- This command defines if characters read by the INPUT command shall be
- echoed. ECHO ON should be used when input is read from a user in the
- other end. ECHO OFF should be used when input is read from a Bulletin
- Board System, or when the user is not supposed to see what he writes.
-
- ECHO should be turned ON if the functions ASCSEND and MSGSEND are
- supposed to echo text locally. The output from the CLI command will
- be sent to the serial port if ECHO has been turned on.
-
- ----------------------------------------------------------------------
-
- 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.
-
- ----------------------------------------------------------------------
-
- IF <expression> THEN <operation>
-
- It should be obvious what this command does. A valid expression can
- be either a comparison of two strings or a check for a file. The
- exclamation mark ('!') works as a boolean 'NOT' operator.
-
- String comparisons are performed with the "==" operator, which tests for
- case independent equality, i.e. "foo" == "FOO" is TRUE;
- !"bar" == "yum" is TRUE (because of the '!' (NOT) operator)
-
- EXISTS checks if a file exists. The following are examples on valid
- IF commands:
-
- IF $password == "abcdef" THEN MESSAGE "Access granted\n"
- IF !$password == "xyz" THEN GOTO KillUser
- IF EXISTS "NComm:host.config" THEN CONFIG "NComm:host.config"
- IF !EXISTS $file THEN SEND "File not found!\n"
-
- The whole command must be placed on a single line, including the 'THEN'
- part...
-
- ----------------------------------------------------------------------
-
- INPUT
- This command reads input from the serial port and places it in a
- variable until a specific string has been received. ^H (backspace)
- deletes the last character, ^U deletes the whole string. The
- searchstring will not be added to the variable. Control characters
- will not be added. Example:
-
- SEND "Enter your first name: "
- INPUT $name "\r" ;Input will be placed in the variable 'name'
- ;until carriage return is received.
-
- The TIMEOUT command also concerns the INPUT command. The timeout
- defines how long INPUT shall wait for the terminating string ("\r" in
- the mentioned example). Example:
-
- TIMEOUT 180 Goto BiBi
- SEND "Enter a command: "
- INPUT $cmd "\r"
- ...
-
- BiBi: SEND "\n\nLooks like you fell asleep!! Bye-bye!\n"
- HANGUP
- END
-
- It is also possible to read a single character without having to
- wait for ENTER or other strings:
-
- INPUT $char ""
-
- INPUT can both be used for reading input from a user in connection
- with "Host Mode", or grabbing pieces of text from a Bulletin Board
- System;
-
- WAIT "Bulletins have been updated: "
- INPUT $bull " "
-
- ----------------------------------------------------------------------
-
- 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.
-
- ----------------------------------------------------------------------
- REPEAT<->UNTIL <expression> ...
- This command performs what is situated between REPEAT and UNTIL. If
- the expression is FALSE/TRUE, the procedure will be repeated. See
- "IF...THEN" for a discussion of valid expressions. The command has the
- same restrictions as WHILE/ENDWHILE.
-
- Example:
-
- REPEAT
- SEND "Enter command: "
- INPUT $cmd "\r"
- GOSUB DoCommand
- UNTIL $cmd == "quit"
-
-
- ----------------------------------------------------------------------
-
- 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
-
- ----------------------------------------------------------------------
-
- SET
- This command is used for assigning values to variables. Variables
- have name in the form $name where 'name' starts with a letter. The
- value must be of type string, either a literal (with quotation marks)
- or another variable.
-
- Examples:
-
- SET $name = "Daniel"
- SEND $name
-
- SET $filename = "RAM:foo"
- CAPTURE $filename
-
- SET $UserName = $name
-
- Variables can be used everywhere where strings are expected. A
- pre-defined variable $date contains the current date and time. The
- variable $ncomm contains the current version number. The variable
- $baud contains the current baud rate. It is also possible to concatenate
- several variables and/or literals;
-
- SEND $name"\n"
- SET $directory = "NComm:files/"
- INPUT $filename "\r"
- UPLOAD $directory$filename
-
- It is not valid referring to variables having no value assigned.
-
- ----------------------------------------------------------------------
-
- TIMEOUT
- This command lets you configure how long NComm should wait in a WAIT,
- CONVERSE or INPUT 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 "" ;Wait for 'anything'
- WAIT "\n" ;Wait for a linefeed
- WAIT "Command:" ;Wait for 'Command:'
-
- ----------------------------------------------------------------------
-
- WHILE <expression> DO ... ENDWHILE
- This function performs what is situated within DO and ENDWHILE until
- the expression is TRUE/FALSE.
-
- Example:
-
- SET $cmd = ""
- WHILE !$cmd == "quit" DO
- SEND "Enter command: "
- INPUT $cmd "\r"
- GOSUB DoCommand
- ENDWHILE
-
- It is not valid jumping out of a WHILE/ENDWHILE loop using GOTO or
- RETURN. It is still possible to exit the loop using GOTO and the
- command CLRSTACK.
-
- ----------------------------------------------------------------------
-
- 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
-
- ----------------------------------------------------------------------
-
- WRITE
- This command writes a textstring to a file. If the file exists, the
- string will be appended to the file. Example:
-
- WRITE "NComm:host/log" "Logged in: "$username"\n"
- | |
- Name of file String
-
- ----------------------------------------------------------------------
-