home *** CD-ROM | disk | FTP | other *** search
/ AMIGA PD 1 / AMIGA-PD-1.iso / Programme_zum_Heft / Anwendungen / Kurztests / NComm / Doc / ARexx.doc next >
Text File  |  1993-09-30  |  18KB  |  727 lines

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