home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games 1996 January / amigagames-cdrom-1996-01.iso / userbox / publicdomain / ncomm / doc / arexx.doc next >
Text File  |  1992-03-03  |  15KB  |  638 lines

  1. Documentation for the ARexx functions implemented in NComm V2.0
  2. ===============================================================
  3.  
  4. Introduction
  5. ~~~~~~~~~~~~
  6. You need the programming language ARexx to use NComm's ARexx interface.
  7. If you don't already have it, either buy it or just forget about it. You
  8. will probably manage fine with the internal script language, but ARexx
  9. adds a few things that the internal script language lacks, for example
  10. numerical variables, arithmetics, string functions etc. Please read the
  11. ARexx documentation carefully before using NComm's ARexx interface.
  12.  
  13. NOTE: ARexx is automatically supplied with AmigaDOS 2.0 so don't waste
  14.       any money by purchasing ARexx alone.
  15.  
  16. Port Name
  17. ~~~~~~~~~
  18. NComm's port name is 'ncomm' for the first copy of NComm and 'ncomm-x'
  19. for further copies of NComm (x is 1 or more). So if you wanted to
  20. send commands to NComm, you would normally start your script-file
  21. with the following two lines:
  22.  
  23. /* script name */
  24. address 'ncomm'
  25.  
  26. Result codes
  27. ~~~~~~~~~~~~
  28. All the ARexx functions in NComm either return result codes in the
  29. special variable RC (Result Code) or in the string variable 'result'
  30. ...or both. Remember to check the result codes carefully. If RC is not
  31. equal to zero, the command was somehow not successful. How serious the
  32. result code is depends on which functions that returns it.
  33.  
  34. NOTE: All commands return 20 if user selected "Quit" from NComm
  35.  
  36. How to read strings
  37. ~~~~~~~~~~~~~~~~~~~
  38. If you want to use any of the functions that return string variables,
  39. you have to add another line to your ARexx script:
  40.  
  41. options results
  42.  
  43. Note!
  44. ~~~~~
  45. Arexx commands that you send to NComm must be either upper or lower case.
  46. Please see below for a list of commands. Also take a look at the few ARexx
  47. scripts that have been included. They especially demonstrate the WAIT and
  48. INACTIVITY commands in further detail.
  49.  
  50. ==========================================================================
  51.  
  52. ASCSEND
  53. ~~~~~~~
  54. This functions sends a text file to the serial port with the menu
  55. function "ASCII Send".
  56.  
  57. Arguments: filename to send
  58.  
  59. Example: ASCSEND "s:startup-sequence"
  60.  
  61. Returns: 0 if successful
  62.          1 if file not found or could not be opened
  63.  
  64. AUTODOWN
  65. ~~~~~~~~
  66. This function will turn Zmodem auto-download on or off.
  67.  
  68. Arguments: ON | OFF
  69.  
  70. Example: AUTODOWN ON
  71.  
  72. Returns: 0 if successful
  73.          1 if missing argument
  74.  
  75. AUTOUP
  76. ~~~~~~
  77. This function will turn Zmodem auto-upload on or off.
  78.  
  79. Arguments: ON | OFF
  80.  
  81. Example: AUTOUP ON
  82.  
  83. Returns: 0 if successful
  84.          1 if missing argument
  85.  
  86. AUTOXFER
  87. ~~~~~~~~
  88. This function will turn G&R commands on or off.
  89.  
  90. Arguments: ON | OFF
  91.  
  92. Example: AUTOXFER ON
  93.  
  94. Returns: 0 if successful
  95.          1 if missing argument
  96.  
  97. BEEP
  98. ~~~~
  99. This function beeps the display / makes a beep signal / pops screen
  100. to front. This all depends on what you have selected in the menu.
  101.  
  102. Arguments: none
  103.  
  104. Example: BEEP
  105.  
  106. This functions is always successful and therefore always returns 0
  107.  
  108. BREAK
  109. ~~~~~
  110. This command sends a break to the serial port.
  111.  
  112. Arguments: none
  113.  
  114. Example: BREAK
  115.  
  116. This functions is always successful and therefore always returns 0
  117.  
  118. CAPTURE
  119. ~~~~~~~
  120. This commands selects the menu function "ASCII Capture". All data
  121. that is received through the serial port will be added to a file.
  122.  
  123. Arguments: filename to open for writing
  124.  
  125. Example: CAPTURE "t:tempcap.txt"
  126.  
  127. Returns: 0 if successful
  128.          1 if capture was already on (could not open capture file)
  129.  
  130. See also: STOPCAPTURE
  131.  
  132. CD
  133. ~~
  134. This command sets the current working directory for the CLI command.
  135.  
  136. Arguments: directory name
  137.  
  138. Example: CD "LIBS:"
  139.  
  140. Returns: 0 if successful
  141.          1 if directory not found or invalid argument
  142.  
  143. CHECKCARRIER
  144. ~~~~~~~~~~~~
  145. This commands checks for a hardware carrier signal.
  146.  
  147. Arguments: none
  148.  
  149. Example: CHECKCARRIER
  150.          IF RC = 0 THEN SAY "GOT CARRIER SIGNAL"
  151.  
  152. Returns: 0 if carrier signal detected
  153.          1 if no carrier
  154.  
  155. CHECKRING
  156. ~~~~~~~~~
  157. This command checks for a hardware ring signal.
  158.  
  159. Arguments: none
  160.  
  161. Example: CHECKRING
  162.          IF RC = 0 THEN SAY "GOT RING SIGNAL"
  163.  
  164. Returns: 0 if ring signal detected
  165.          1 if no ring signal
  166.  
  167. CLEARBUFFER
  168. ~~~~~~~~~~~
  169. This command clears the ring-buffer. The 'Wait' command uses a ring-buffer
  170. that works on a first-in -> first-out basis (FIFO) to keep up with the
  171. latest 100 lines of data. The buffer takes up a maximum of 10K when it has
  172. been totally filled up. Normally the buffer takes up an average of 4-5K.
  173. You ought to clear the ring-buffer when your ARexx script has finished
  174. since this will release the memory that has been allocated. This will also
  175. make NComm run just a little faster... It may be a good idea to also use this
  176. command before your first 'Wait' command if you want to skip unwanted data
  177. that might exist in the buffer...
  178.  
  179. Arguments: none
  180.  
  181. Example: CLEARBUFFER
  182.  
  183. This functions is always successful and therefore always returns 0
  184.  
  185. CLI
  186. ~~~
  187. This command executes a CLI command and displays the output (if any)
  188. on the NComm screen. NOTE: The ARexx "address command" function does
  189. the same thing but normally causes a lot of burns and crashes. It uses
  190. the Amiga Execute() function, which has several serious bugs. Among
  191. other things, Execute() will try to write output to the current CLI
  192. window even if the CLI window has been closed or never existed. This
  193. normally results in a GURU. NComm contains a bugfix that makes it
  194. almost safe to execute commands via Execute() so please use this
  195. command instead of "address command" if you want to avoid a GURU
  196. when executing external commands from ARexx.
  197.  
  198. Arguments: command to send
  199.  
  200. Example: CLI "DELETE WORK:JRCOMM QUIET ALL" ; ~:-)
  201.  
  202. Returns: 0 if successful
  203.          1 if command failed or invalid argument
  204.  
  205. See also: CD
  206.  
  207. CONFIG
  208. ~~~~~~
  209. This function loads in a new config file.
  210.  
  211. Arguments: config-file filename
  212.  
  213. Example: CONFIG "ncomm:ncomm.config"
  214.  
  215. Returns: 0 if successful
  216.          1 if file not found or could not be opened
  217.  
  218. DIAL
  219. ~~~~
  220. This function dials one or more entries in the phonebook.
  221.  
  222. Arguments: one or more board names seperated by commas (,)
  223.  
  224. Example: DIAL "rode,media,oslohd"
  225.  
  226. Returns: 0 if connect
  227.          1 if no connect or entry not found
  228.  
  229. DIALNUMBER
  230. ~~~~~~~~~~
  231. This function dials one or more numbers.
  232.  
  233. Arguments: one or more numbers seperated by commas (,)
  234.  
  235. Example: DIALNUMBER "493210,380949,176056"
  236.  
  237. Returns: 0 if connect
  238.          1 if no connect
  239.  
  240. DOWNLOAD
  241. ~~~~~~~~
  242. This function selects the download function from the menu.
  243.  
  244. Arguments: file to open for writing or "foobar" if protocol does
  245.            not need a filename.
  246.  
  247. Example: DOWNLOAD "ram:rtfm.lzh"
  248.  
  249. This function always returns 0 even if download failed.
  250.  
  251. See also: SETPROTO
  252.  
  253. DTENTHS
  254. ~~~~~~~
  255. This function waits for the specified number of 1/10th seconds. NOTE: This
  256. command ties up the system. The best thing is to use the ARexx timer functions
  257. for this purpose since you may then continue to use NComm while waiting. Only
  258. use this command for small delays or when this accuracy is needed. If you
  259. want a long delay, use the ARexx Time() function.
  260.  
  261. Arguments: number of 1/10th seconds to wait
  262.  
  263. Example: DTENTHS 10 /* wait for one second */
  264.  
  265. Returns: 0 if successful
  266.          1 if no argument
  267.  
  268. FILEREQ
  269. ~~~~~~~
  270. This function opens up the req.library filerequester.
  271.  
  272. Arguments: the directory that should be displayed
  273.  
  274. Example: FILEREQ "ncomm:"
  275.          IF RC = 0 THEN SAY RESULT
  276.  
  277. Returns: 0 if successful, variable 'result' contains the path/filename
  278.          1 if no argument or if filerequester was already in use
  279.  
  280. GETDATE
  281. ~~~~~~~
  282. This function fetches the NComm creation date.
  283.  
  284. Arguments: none
  285.  
  286. Example: GETDATE
  287.          SAY RESULT
  288.  
  289. This functions is always successful and therefore always returns 0
  290.  
  291. GETVERSION
  292. ~~~~~~~~~~
  293. This function fetches the NComm version number.
  294.  
  295. Arguments: none
  296.  
  297. Example: GETVERSION
  298.          SAY RESULT
  299.  
  300. This functions is always successful and therefore always returns 0
  301.  
  302. HANGUP
  303. ~~~~~~
  304. This function hangs up the phone by either lowering DTR or sending
  305. the hangup string to the modem.
  306.  
  307. Arguments: none
  308.  
  309. Example: HANGUP
  310.  
  311. This functions is always successful and therefore always returns 0
  312.  
  313. INACTIVITY
  314. ~~~~~~~~~~
  315. This command specifies the inactivity timeout for the 'Wait' command.
  316. If nothing has been received through the serial port in the specified
  317. number of seconds, the 'Wait' command will return with the last line
  318. that was received.
  319.  
  320. Arguments: number of seconds that can elapse without receiving data
  321.            through the serial port or 0 if you want to disable the
  322.            inactivity timeout
  323.  
  324. Example: INACTIVITY 2 /* Wait command will return after two seconds
  325.                          of inactivity */
  326.  
  327. This functions is always successful and therefore always returns 0
  328.  
  329. LOADKEYS
  330. ~~~~~~~~
  331. This function loads in a new set of macrokeys.
  332.  
  333. Arguments: macro-file filename
  334.  
  335. Example: LOADKEYS "ncomm:ncomm.keys"
  336.  
  337. Returns: 0 if successful
  338.          1 if file not found or could not be opened
  339.  
  340. LOADPHONE
  341. ~~~~~~~~~
  342. This function loads in a new phonebook.
  343.  
  344. Arguments: phonebook filename
  345.  
  346. Example: LOADPHONE "ncomm:ncomm.phone"
  347.  
  348. Returns: 0 if successful
  349.          1 if file not found or could not be opened
  350.  
  351. MENUSELECT
  352. ~~~~~~~~~~
  353. This function selects a function from the menu
  354.  
  355. Arguments: menuname,itemnumber[,subitemnumber]
  356.  
  357. Example: MENUSELECT "TRANSFER,6,2" /* Select Kermit CD from the menu */
  358.  
  359. Returns: 0 if successful
  360.          1 if invalid argument or too few arguments
  361.  
  362. MESSAGE
  363. ~~~~~~~
  364. This function displays a message in the NComm window. Nothing is sent
  365. through the serial port.
  366.  
  367. Arguments: text to display in the window
  368.  
  369. Example: MESSAGE "yoohoo"
  370.  
  371. Returns: 0 if successful
  372.          1 if missing argument
  373.  
  374. MSGSEND
  375. ~~~~~~~
  376. This functions sends a message to the serial port with the menu
  377. function "Message Send".
  378.  
  379. Arguments: message filename to send
  380.  
  381. Example: MSGSEND "ram:mymsg.txt"
  382.  
  383. Returns: 0 if successful
  384.          1 if file not found or could not be opened
  385.  
  386. PADLINES
  387. ~~~~~~~~
  388. This function will turn padding of blank lines on or off.
  389.  
  390. Arguments: ON | OFF
  391.  
  392. Example: PADLINES ON /* turn padding on */
  393.  
  394. Returns: 0 if successful
  395.          1 if missing argument
  396.  
  397. PALETTE
  398. ~~~~~~~
  399. This function opens up the palette requester.
  400.  
  401. Arguments: none
  402.  
  403. Example: PALETTE /* open palette */
  404.  
  405. This function is always successful and therefore always returns 0.
  406.  
  407. PRINTER
  408. ~~~~~~~
  409. This function will turn the printer function on or off.
  410.  
  411. Arguments: ON | OFF
  412.  
  413. Example: PRINTER ON /* turn on output to the printer */
  414.  
  415. Returns: 0 if successful
  416.          1 if missing argument
  417.  
  418. REDIAL
  419. ~~~~~~
  420. This function turns redial on or off.
  421.  
  422. Arguments: ON | OFF
  423.  
  424. Example: REDIAL ON /* turn redial on */
  425.  
  426. Returns: 0 if successful
  427.          1 if missing argument
  428.  
  429. REQUEST
  430. ~~~~~~~
  431. This function toggles system and NComm-requesters. You probably want
  432. to turn off requesters if the script is run without human assistance.
  433. It will then not be preferrable that "disk full" requesters etc. show up
  434. on screen and interrupts the script. NComm will automatically overwrite
  435. existing files instead of asking if requesters have been turned off.
  436.  
  437. Arguments: ON | OFF
  438.  
  439. Example: REQUEST OFF /* Turn off requesters */
  440.  
  441. Returns: 0 if successful
  442.          1 if missing argument
  443.  
  444. RESUME
  445. ~~~~~~
  446. This function will turn Zmodem resume on or off.
  447.  
  448. Arguments: ON | OFF
  449.  
  450. Example: RESUME ON
  451.  
  452. Returns: 0 if successful
  453.          1 if missing argument
  454.  
  455. SEND
  456. ~~~~
  457. This function sends the supplied text to the serial port and also
  458. translates the output in case they contain control-characters,
  459. C-notation etc. Text will also be displayed on screen if half-
  460. duplex has been selected.
  461.  
  462. Arguments: the text that should be sent to the serial port
  463.  
  464. Example: SEND "\p\n^K" /* Send password stored in phonebook
  465.                           followed by linefeed and a Control-K */
  466.  
  467. Returns: 0 if successful
  468.          1 if missing argument
  469.  
  470. SETBAUD
  471. ~~~~~~~
  472. This function changes the current baud-rate.
  473.  
  474. Arguments: new baud rate
  475.  
  476. Example: SETBAUD "2400"
  477.  
  478. Returns: 0 if successful
  479.          1 if invalid or missing argument
  480.  
  481. SETCHARSET
  482. ~~~~~~~~~~
  483. This function changes the current character set.
  484.  
  485. Arguments: new character set
  486.  
  487. Example: SETCHARSET "IBN"
  488.  
  489. Returns: 0 if successful
  490.          1 if invalid or missing argument
  491.  
  492. SETLENGTH
  493. ~~~~~~~~~
  494. This function changes the current data length.
  495.  
  496. Arguments: new data length
  497.  
  498. Example: SETLENGTH "8" /* 8 data bits */
  499.  
  500. Returns: 0 if successful
  501.          1 if invalid or missing argument
  502.  
  503. SETPARITY
  504. ~~~~~~~~~
  505. This function changes the current parity.
  506.  
  507. Arguments: new parity
  508.  
  509. Example: SETPARITY "N" /* No parity */
  510.  
  511. Returns: 0 if successful
  512.          1 if invalid or missing argument
  513.  
  514. SETPROTO
  515. ~~~~~~~~
  516. This function changes the current transfer protocol.
  517.  
  518. Arguments: new transfer protocol
  519.  
  520. Example: SETPROTO "Z" /* Select the Zmodem protocol */
  521.  
  522. Returns: 0 if successful
  523.          1 if invalid or missing argument
  524.  
  525. SETSTOPBITS
  526. ~~~~~~~~~~~
  527. This function changes the current number of stop-bits.
  528.  
  529. Arguments: new number of stop-bits
  530.  
  531. Example: SETSTOPBITS "2" /* Two stop-bits */
  532.  
  533. Returns: 0 if successful
  534.          1 if invalid or missing argument
  535.  
  536. SIMPLEREQ
  537. ~~~~~~~~~
  538. This function displays a simple text requester.
  539.  
  540. Arguments: the text to display
  541.  
  542. Example: SIMPLEREQ "Could not load phonebook"
  543.  
  544. Returns: 0 if successful
  545.          1 if missing argument
  546.  
  547. SPAWN
  548. ~~~~~
  549. This function sends an asynchronous ARexx command. This function is
  550. supposed to be used for running macros in parallel but I've never
  551. actually tried this. Use it with care.
  552.  
  553. Arguments: the command to send
  554.  
  555. Example: SPAWN "SPAWN" /* :-) */
  556.  
  557. This functions is always successful and therefore always returns 0
  558.  
  559. STOPCAPTURE
  560. ~~~~~~~~~~~
  561. This function stops ASCII Capture.
  562.  
  563. Arguments: none
  564.  
  565. Example: CAPTURE "RAM:file.txt"
  566.          WAIT "hello"
  567.          STOPCAPTURE
  568.  
  569. Returns: 0 if successful
  570.          1 if no capture to close
  571.  
  572. STRINGREQ
  573. ~~~~~~~~~
  574. This function opens up the req.library stringrequester.
  575.  
  576. Arguments: the default stringrequester title
  577.  
  578. Example: STRINGREQ "Enter your name"
  579.          IF RC = 0 THEN SIMPLEREQ "HELLO "result"!"
  580.  
  581. Returns: 0 if successful, variable 'result' contains string that was entered
  582.          1 if no argument or if stringrequester was already in use
  583.  
  584. TWOGADREQ
  585. ~~~~~~~~~
  586. This function opens up the req.library two-gadget requester.
  587.  
  588. Arguments: the default two-gadget requester question
  589.  
  590. Example: TWOGADREQ "Really quit NComm?"
  591.          IF RC = 0 THEN QUIT
  592.  
  593. Returns: 0 if user responded with 'Yes'
  594.          1 if user responded with 'No'
  595.  
  596. UPLOAD
  597. ~~~~~~
  598. This function selects the upload function from the menu.
  599.  
  600. Arguments: file to send or "foobar" if protocol does not need a filename.
  601.  
  602. Example: UPLOAD "ram:rtfm.lzh"
  603.  
  604. Returns: 0 if successful
  605.          1 if file not found or could not be opened
  606.  
  607. See also: SETPROTO
  608.  
  609. WAIT
  610. ~~~~
  611. This is the most powerful ARexx function currently implemented. It
  612. waits for text from the serial-port. If no argument is specified
  613. it will wait for "anything". You may also specify a string to wait
  614. for or '0A'X if you want to wait for the next line. This function
  615. always returns the current line.
  616.  
  617. Note: The string is not case sensitive.
  618.  
  619. Arguments: ['0A'X | string]
  620.  
  621. Example: WAIT        /* Wait for anything */
  622.          WAIT '0A'X  /* Wait for next line */
  623.          WAIT string /* Wait for string */
  624.  
  625. Function returns 0 if command ok, 1 if timed out by inactivity command
  626.  
  627. See also: INACTIVITY, CLEARBUFFER
  628.  
  629. QUIT
  630. ~~~~
  631. This function sets the exit flag, i.e quits NComm.
  632.  
  633. Arguments: none
  634.  
  635. Example: QUIT
  636.  
  637. This functions is always successful and therefore always returns 0
  638.