home *** CD-ROM | disk | FTP | other *** search
- June 21st 1991
-
-
-
-
-
-
-
-
-
- Term II
-
- version 1.1
-
- (c) 1990,1991 - Eric GONTIER
-
- SCRIPTS.doc
-
-
-
-
-
-
-
-
-
-
-
- INTRODUCTION :
-
- All the commands described in COMMANDS.doc can be used from
- ARexx to build scripts. You need to set the current port to
- address from ARexx with address TERM, and then you can send
- your commands from your ARexx program. Example :
-
- /* Example, automatic uploading of a file */
- /* using Xmodem 1K CRC */
-
- address TERM
-
- xpr_open '"xprxmodem.library"'
- xpr_init '"A0,C1,K1"'
- xpr_send '"dh0:my_dir/my_file"'
-
- Some commands have been added especially for ARexx :
- rexx_memory_on, rexx_memory_off, rexx_delay rexx_wait and
- rexx
-
- rexx_wait timeout1 timeout2
-
- This command will ask Term to wait for characters. A timeout1
- in seconds is allowed before aborting the read if nothing is
- received. Otherwise, Term will read the characters as they
- came, until a timeout2 (in seconds) delay occured without
- receiving any other characters.
-
- ** NOTE : I know this is not very handy. A better solution would be a
- command like the one for XCMD, which allows to wait for a fixed number of
- chars, or to abort for a given time out. However, I did not have enough
- time to write such a commands for this version, but it should came in
- future release. So... **
-
- Example :
-
-
- serial_send '"ATDT3600\n"' /* connect to transpac */
-
- /* Allow a 30s delay without receiving */
- /* anything. Otherwise, stop read as soon */
- /* as 2s occured since last char received */
- rexx_wait 30 2
-
- This allows to wait for receiving, and to react quickly when
- all the characters have been read.
-
- The ARexx script need a way to get all the characters read by
- Term. The idea is to put Term in a "memory mode". In this mode,
- Term will memorize the last 80 characters it had received, and
- so an ARexx script can get them in the ARexx variable MEMORY.
- The command rexx_memory_on will turn on the memory mode (as a
- side effect, it also clears the memory buffer), and variable
- MEMORY will be updated when the command rexx_delay or rexx_wait
- retirned from Term
-
- The rexx command can be used to start an ARexx program from
- Term II (but the Rexx server must already be running. This is
- often made by the startup-sequence, at boot time). For example:
-
- rexx "quit.rexx"
-
- will run the script quit.rexx which is in the current
- directory.
-
- ARexx has some powerful commands for parsing, which can be used
- to test values found in the MEMORY variable.
-
- Example :
-
- rexx_memory_on
- serial_send '"ATDT3600\n"'
- rexx_wait 30 2
-
- /* Here, MEMORY has the last 80 */
- /* characters received */
-
- Parsing MEMORY to find one the following messages :
-
- if CONNECT1200
- connection succeeded, the script can go on
-
- if BUSY
- It's busy ! We can wait 10s, and start again
-
- if NO CARRIER
- It was a wrong number, or the BBS is down
-
-
-
-
-
- EXAMPLES :
-
- Included with Term II are very simple ARexx scripts, which can
- be started from the CLI with the rx command, like :
-
- rx test_delay
-
- They can also be started from Term II, see the next paragraph.
-
-
- The examples :
-
- test_delay.rexx
- test the rexx_delay command
-
- test_wait.rexx
- test the rexx_wait command
-
- download.rexx
- Auto-downloading from Calvacom
-
- I am sure some complex scripts could be written, even if the
- way to get the characters received by Term II in an ARexx are
- not very powerful. However, I will work to improve this.
-
-
-
-
-
-
-
-
- STARTING AN AREXX SCRIPT FROM TERM II
-
- You can start an ARexx program from Term II. For this, you have
- to use the rexx command, which needs the name of a rexx program
- as argument. For example :
-
- - From Term II, select the "Command..." option in the
- Project menu, or hit <Amiga-Left><M>. This will request you
- for a command to type.
-
- - In the string gadget of the requester, you can type the
- command :
-
- rexx "download.rexx amiga/amiga/fontes/genfont.lzh ram:test"
-
- or :
-
- rexx "test_delay.rexx"
-
- to start one of the ARexx examples (the rexx scripts must
- be in the same directory than Term)
-
-