home *** CD-ROM | disk | FTP | other *** search
- REFLECTION
- SAMPLE COMMAND FILES
-
-
- This file provides some sample command files to demonstrate how to perform
- some common functions.
-
- *******************************************************************************
- ; This command file saves a disk directory listing to disk
- OPEN AFILE
- CLOSE PRINTER
- LOG
- DIR *.*
- LOG OFF
- CLOSE DISK
- *******************************************************************************
- ; This command file prompts the user for a file name and sends it to the host
- QUIET STATUS ON
- :label
- display "^[[H^[[J^J^J^JWHAT FILENAME DO YOU WISH TO SEND?: "
- ACCEPT V1 LIMIT 30
- IF length(pack(V1)) = 0 OR UPPER(V1) = "E"
- DISPLAY "^J^MI will quit^J^M"
- STOP
- ENDIF
- display "^[[H^[[J^J^J^JSending $1^J^M"
- CONTINUE
- SEND V1
- IF ERROR
- DISPLAY "^[[H^[[JSo Sorry^M^J"
- ELSE
- DISPLAY "^[[H^[[JI'm done^J^M^G^G"
- ENDIF
- TRANSMIT "^M"
- QUIET STATUS OFF
-
- ************************************************************************
-
- ; This file uses a HAYES Smartmodem to log on
- ; You must replace <username> and <password> with your own.
- ; Get response from modem
- TRANSMIT "AT^M"
- WAIT 0:0:4 FOR "OK"
- IF NOT FOUND
- DISPLAY "No response from modem"
- STOP
- ENDIF
- ; Transmit ATDT, the phone number, and a carriage return
- TRANSMIT "ATDT5551212^M"
- WAIT 0:1 FOR "CONNECT"
- IF NOT FOUND
- DISPLAY "Call not completed"
- STOP
- ENDIF
- ;
- :username
- TRANSMIT "^M"
- WAIT 0:0:10 FOR "Username"
- IF FOUND
- TRANSMIT "<username>^M"
- GOTO pswd
- ELSE
- IF V0=5
- DISPLAY "Timed out waiting for 'username' prompt"
- STOP
- ELSE
- LET V0=V0+1
- GOTO username
- ENDIF
- :pswd
- WAIT 0:0:20 FOR "Password"
- IF FOUND
- TRANSMIT "<password>^M"
- GOTO alldone
- ELSE
- DISPLAY "Timed out waiting for 'password' prompt"
- STOP
- ENDIF
- :alldone
-
- ************************************************************************
-
- ; Use of a macro variable
- QUIET COMMAND ON
- :try_again
- DISPLAY "^[[H^[[JEnter branch to take (A,B or C): "
- ACCEPT V1 LIMIT 1
- IF NOT (V1 = "A" OR V1 = "B" OR V1 = "C")
- DISPLAY "^[[H^[[JInvalid Response"
- WAIT 0:0:1
- GOTO try_again
- ENDIF
- GOTO $1
- :A
- DISPLAY "^[[H^[[JI'm at 'A'"
- goto finish
- :B
- DISPLAY "^[[H^[[JI'm at 'B'"
- GOTO FINISH
- :C
- DISPLAY "^[[H^[[JI'm at 'C'"
- :FINISH
- DISPLAY "^J^M"
- QUIET COMMAND OFF
-
- ************************************************************************
-
- ; Math capabilities
- LET V1 = "^[[H^[[JMath Demo^J^M"
- DISPLAY V1
- LET V1 = 5
- LET V2 = (7-V1)*(V1+3)+V1
- DISPLAY "$2=(7-$1)*($1+3)+$1^J^M"
- LET V1 = (7-V1)*(V1+3)+V1
- LET V1 = "LET V1 = 10"
- DISPLAY "$1^J^M"
- $1
- IF V1 > 9
- DISPLAY "V1 > 9^J^M"
- ENDIF
- IF V1 < "9"
- DISPLAY "BUT V1 < ""9""^J^M"
- ENDIF
-
- ************************************************************************
-
- ; This command file demonstrates the use of the CONTINUE & DIR commands to
- ; verify the existence of a disk file.
- QUIET DISPLAY OFF
- :label
- display "^[[H^[[J^J^J^JWHAT FILENAME DO YOU WISH ME TO CHECK?: "
- ACCEPT V1 LIMIT 8
- DISPLAY "^J^M"
- QUIET DISPLAY ON
- CONTINUE
- DIR $1
- IF ERROR
- QUIET DISPLAY OFF
- DISPLAY "That file does not exist"
- ELSE
- QUIET DISPLAY OFF
- DISPLAY "That file is a good one"
- ENDIF
- WAIT 0:0:1
- GOTO LABEL
-
- ************************************************************************
-
- ; This command file sets up softkeys with command options:
- quiet command on
- display "^[&f1a1k8d8L DIR ^[&oCDIR^M"
- display "^[[H^[[J^[[10;15HGo into softkeys and press F1^M^J^J"
- ************************************************************************
-
- ; This command file saves the entire screen to a file of your choice
- ; (This function may also be accomplished with the MSAVE command)
- ; To use this command file, type the file name you want the display to drop to
- ; after you type the command file name.
- Q COMMAND ON
- IF LENGTH(V1) = 0 OR LENGTH(V2) <> 0
- DISPLAY "^[[HIncorrect number of parameters^M^J^G"
- GOTO finish
- ENDIF
- Q DISPLAY ON
- CONTINUE
- DIR $1
- IF NOT ERROR
- Q DISPLAY OFF
- DISPLAY "^[[HFile already exists^M^J^G"
- GOTO finish
- ENDIF
- Q DISPLAY OFF
- CLOSE PRINTER
- CONTINUE
- OPEN $1
- IF ERROR
- DISPLAY "^[[HCould not open disk file^M^J^G"
- GOTO finish
- ENDIF
- DISPLAY "^[[i"
- CLOSE DISK
- OPEN PRINTER
- :finish
- Q COMMAND OFF
- Q STATUS OFF
-
- ************************************************************************
-
- ; This command file logs on to a VAX computer
- ;
- LET V0=1
- :uname
- TRANSMIT "^M"
- WAIT 0:0:05 FOR "Username"
- IF FOUND
- TRANSMIT "<user name>^M"
- GOTO password
- ELSE
- IF V0=5
- DISPLAY "Timed out waiting for 'Username' prompt"
- STOP
- ELSE
- LET V0=V0+1
- GOTO uname
- ENDIF
- ENDIF
- :password
- WAIT 0:0:30 FOR "Password"
- IF FOUND
- TRANSMIT "<password>^M"
- GOTO alldone
- ENDIF
- :alldone
- STOP
-
- ******************************************************************************
- ;This command file dials a remote VAX through a public data network and a
- ;switch. Note that parity is initially set to "zeros" for the network but is
- ;set to "none" for communicating with the VAX.
- set data-bits-parity 7/SPACE
- set baud 1200
- TRANSMIT "AT^M"
- WAIT 0:0:4 FOR "OK"
- IF NOT FOUND
- DISPLAY "No response from modem"
- STOP
- ENDIF
- ;Transmit modem commands to dial phone
- TRANSMIT "ATDT1234567^M"
- ;Wait at most 1 minute for connection
- ;If no connection, end
- WAIT 0:1 FOR "CONNECT"
- IF NOT FOUND
- DISPLAY "CALL NOT COMPLETED"
- STOP
- ENDIF
- LET V0=1
- :login
- WAIT 0:0:02
- TRANSMIT "a^M"
- WAIT 0:0:05 FOR "log in"
- IF FOUND
- LET V0=1
- TRANSMIT "<login>^M"
- GOTO password
- ELSE
- IF V0=5
- DISPLAY "Timed out waiting for network 'login' prompt"
- STOP
- ELSE
- LET V0=V0+1
- GOTO login
- ENDIF
- ENDIF
- :password
- WAIT 0:0:20 FOR "password"
- IF FOUND
- TRANSMIT "<password>^M"
- GOTO class
- ELSE
- DISPLAY "Timed out waiting for network 'Password' prompt"
- STOP
- ENDIF
- :class
- WAIT 0:0:30 FOR "CLASS"
- IF FOUND
- TRANSMIT "<class>^M"
- GOTO handlego
- ELSE
- DISPLAY "Timed out waiting for 'class' prompt"
- STOP
- ENDIF
- :handlego
- WAIT 0:0:20 FOR "GO"
- IF FOUND
- WAIT 0:0:2
- TRANSMIT "^M"
- GOTO username
- ELSE
- DISPLAY "Timed out waiting for 'go'"
- STOP
- ENDIF
- :username
- TRANSMIT "^M"
- WAIT 0:0:05 FOR "Username"
- IF FOUND
- TRANSMIT "<username>^M"
- GOTO pswd
- ELSE
- IF V0=5
- DISPLAY "Timed out waiting for 'username' prompt"
- STOP
- ELSE
- LET V0=V0+1
- GOTO username
- ENDIF
- :pswd
- WAIT 0:0:20 FOR "Password"
- IF FOUND
- TRANSMIT "<Password>^M"
- GOTO alldone
- ELSE
- DISPLAY "Timed out waiting for 'password' prompt"
- STOP
- ENDIF
- :alldone
- set data-bits-parity 8/NONE
- STOP
-