home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPMINFO / CPM-CC21.ART < prev    next >
Text File  |  2000-06-30  |  11KB  |  225 lines

  1.  
  2. ==============================================================================
  3. [ THE KAY*FOG RBBS | Filename=CPM-CC21.ART | posted 07/05/86 | 223 lines 11k ]
  4.  
  5.           The CP/M Connection                   Originally published in    
  6.                   by                               Computer Currents       
  7.              Ted Silveira                         5720 Hollis Street     
  8.   (copyright and all rights reserved)            Emeryville, CA  94608     
  9.  
  10.                               February 25, 1986
  11.                               MORE ON MODEMMAIL
  12.  
  13.      Last issue, I gave you an overview of ModemMail, a versatile new 
  14. communications program.  This time I want to take a look at the heart of 
  15. ModemMail, its programming language, to give you an idea of what it can 
  16. do.  If you think that only MS-DOS programs like Microsoft Access can 
  17. handle fancy "script" files, you're wrong.
  18.  
  19. [ModemMail Takes Command]
  20.  
  21.      The ModemMail language is very flexible for a piece of software 
  22. that's not sold strictly as a programming language.  You can do almost 
  23. anything you can do in a language like BASIC:  you can read and write to 
  24. the screen, modem, or printer; you can assign strings or numeric values 
  25. to variables; you can read variables from disk files; you can use an IF-
  26. ELSE type of branching logic to control program flow; you can set up 
  27. program loops with counters you can increment or decrement; you can peek 
  28. and poke directly into the computer's memory.  And of course you can do 
  29. a whole range of things you'd expect from a communications program:  set 
  30. the modem speed, dial and redial a phone number, drop in and out of 
  31. terminal mode, save a terminal session into a disk file, transmit files 
  32. with the XMODEM protocol, and so forth.
  33.  
  34.      This programming language can be used in two ways--you can enter 
  35. commands directly at the ModemMail command prompt, or you can put the 
  36. commands in a command file (a mini-program, rather like a dBase II CMD 
  37. file or a SUBMIT file).  If you have a command file on your ModemMail 
  38. disk, you can execute it simply by typing its name at the ModemMail 
  39. command prompt, just as if it were a built-in command.  Essentially, 
  40. this feature means that ModemMail has an _extensible_ programming 
  41. language--you can add new commands to it at any time.  You can also 
  42. "nest" command files by calling one from inside another.  
  43.  
  44. [A Sample Command File]
  45.  
  46.      ModemMail comes with a number of ready-made command files.  Most of 
  47. these are part of a sample working bulletin board system, but you also 
  48. get some nice examples of automatic log-on files for MCI Mail and Dow 
  49. Jones News Service.  So suppose you want to call MCI Mail--what do you 
  50. do?
  51.  
  52.      The first step is to enter the command [CALL MCI] at the ModemMail 
  53. command prompt.  The command [CALL] is itself a command file.  This 
  54. command file will search the default phone directory (named PHONE.LST) 
  55. for an entry beginning with the letters MCI. When it finds it, it will 
  56. read the entire entry, which in this case is [MCI : 1-800-323-0905 
  57. MCI.LGI].  The CALL command file will locate the phone number, dial it, 
  58. and (if it gets a carrier tone and makes connection) trigger a new 
  59. command file named MCI.LGI, which will take over the job of logging in 
  60. to MCI.
  61.  
  62.      In Figure 1, you'll find a listing of the command file MCI.LGI.  
  63. You'll notice that the commands are not too far from English; if you 
  64. know BASIC, you can probably puzzle it out on your own.  Here's how it 
  65. works:
  66.  
  67.      Lines 1 and 2, which begin with semicolons (;), are comment lines, 
  68. meant solely as explanatory notes to any human reading the file.  
  69. ModemMail ignores lines beginning with semicolons.
  70.  
  71.      Line 3 sends the message (or string, as it's usually called) 
  72. enclosed in quotes to the console, better known as the screen.  The 
  73. string consists of a carriage return/linefeed combination (represented 
  74. by \N), the words "Logging in to MCI Mail . . .", and another carriage 
  75. return/linefeed.
  76.  
  77.      Line 4 assigns the variable Y a value of 3.  This variable is going 
  78. to be used in just a second to count the number of trips through a loop.  
  79. ModemMail lets you use up to 26 variables (A-Z) at once.
  80.  
  81.      Line 5 begins with a colon (:), which identifies the word that 
  82. follows (LOOP) as a label.  Once you have established a label, you can 
  83. jump directly to it from any other spot in the command file just by 
  84. using its name.
  85.  
  86.      Lines 6, 7, and 8 are taken as a single line and a single command 
  87. by ModemMail, because they are welded together with the [&-] characters.  
  88. The first part of this command--[MODEM "\R"]--sends a carriage return 
  89. (\R) out through the modem to the computer on the other end of the phone 
  90. line.  The next part--[IF MODEM "your user name:" LOGIN]--tells 
  91. ModemMail to wait for the string "your user name:" (which is a prompt 
  92. from MCI Mail) to come in through the modem from the MCI Mail computer.  
  93. If the string does come in, ModemMail jumps directly to the label LOGIN.  
  94. But if ModemMail doesn't get the proper string within five seconds--
  95. [TIMEOUT 5S]--it moves on to the line directly following.
  96.  
  97.      Line 9--[DECREMENT Y]--is executed only if ModemMail didn't receive 
  98. the proper string within five seconds.  This command simply subtracts 1 
  99. from the value of the variable Y (which started out as 3, you'll 
  100. remember).  
  101.  
  102.      Line 10 tests to see if the variable Y is still greater than zero.  
  103. If it is, the command file jumps back to the label LOOP, sends out 
  104. another carriage return, and looks for the MCI Mail prompt again.  The 
  105. original value of Y gives ModemMail three tries to get the proper 
  106. response.  If it fails, and Y becomes equal to zero, then the command 
  107. file moves on to the next line.
  108.  
  109.      Line 11--[GOTO BYEBYE]--is executed only if ModemMail has tried 
  110. three times and failed to get a valid prompt from MCI Mail.  If that 
  111. happens, ModemMail jumps to the label BYEBYE and executes the commands 
  112. it finds there.
  113.  
  114.      Line 12 is another label, [LOGIN].  ModemMail jumps here if it gets 
  115. a successful response in line 7.
  116.  
  117.      Lines 13, 14, and 15 are read as one line and one command by 
  118. ModemMail, because they are linked together with the [&-] characters.  
  119. The first part--[MODEM "TSILVEIRA\R"]--sends the string "TSILVEIRA" (my 
  120. user name on MCI Mail) out through the modem followed by a carriage 
  121. return.  This string is an answer to MCI Mail's prompt "your user name:" 
  122. received earlier.  Once you've logged on with your user name, MCI Mail 
  123. asks for your password, so the second part of this command--[IF MODEM 
  124. "Password:"]--tells ModemMail to wait for the string "Password:" to come 
  125. in through the modem (from the MCI Mail computer).  The third part of 
  126. the command--[TIMEOUT 10S BYEBYE]--tells ModemMail to wait 10 seconds 
  127. for this string to arrive.  If the string isn't received within 10 
  128. seconds, ModemMail will jump to the label BYEBYE.  If the string _is_ 
  129. received, ModemMail moves on to line 16.
  130.  
  131.      Notice that this command is almost the same as the command at lines 
  132. 6, 7, and 8, with one exception.  The command at lines 6, 7, and 8 is 
  133. set up so that if successful, ModemMail jumps to the label LOGIN, and if 
  134. unsuccessful, it executes the following line.  But this command at lines 
  135. 13, 14, and 15 is set up to do the opposite--if unsuccessful, it jumps 
  136. to the label BYEBYE, and if successful, it moves on to the next line.
  137.  
  138.      Line 16 sends the string "MYPASSWD" out through the modem in 
  139. response to MCI Mail's "Password:" prompt.  (You didn't think I was 
  140. going to put my real password in there, did you?)  The log-on to MCI 
  141. Mail should now be complete.
  142.  
  143.      Line 17--[LET Y = ""]--just cleans up by clearing out the variable 
  144. Y (in case it gets used later).
  145.  
  146.      Line 18 ends the command file, setting a success flag and returning 
  147. either to the ModemMail command prompt or to the command file that 
  148. called it.  The success flag can be read by other commands and command 
  149. files so that they can adjust their actions to the results of the log-on 
  150. attempt.
  151.  
  152.      Line 19 is the label BYEBYE, where ModemMail goes if it fails to 
  153. make a proper connection with MCI Mail.
  154.  
  155.      Line 20 rings the bell and prints the string "Log-in failed." on 
  156. the screen, followed by a carriage return/linefeed.
  157.  
  158.      Line 21 sends the string "+++" to the modem.  This string, for 
  159. Hayes-compatible modems, gets the modem's attention and prepares it to 
  160. receive a command.
  161.  
  162.      Line 22 tells ModemMail to wait three seconds without doing 
  163. anything (so the modem can get ready for its command).
  164.  
  165.      Line 23 sends the string "ATH" to the modem, followed by a carriage 
  166. return.  This string will cause a Hayes-compatible modem to hang up the 
  167. phone.
  168.  
  169.      Line 24 ends the command file and returns to the command prompt or 
  170. calling command file with the failure flag set.   
  171.  
  172.      This particular command file is only a simple example of 
  173. ModemMail's programming language, but I hope it has given you an idea of 
  174. how flexible ModemMail is.  I don't know of any CP/M communications 
  175. program that can match this kind of command file operation.
  176.  
  177.      If you want to see a ModemMail bulletin board in action, call 
  178. 408/336-8080.  The computer is not turned on until the modem makes a 
  179. connection, so it takes about 30 seconds after you connect before the 
  180. bulletin board appears.  The log-on has several long pauses, so don't 
  181. panic--just wait.
  182.  
  183.      For more information on ModemMail, contact:
  184.  
  185. AutoSoft Incorporated
  186. 166 Santa Clara Avenue
  187. Oakland, CA  94610
  188. 415/658-2881
  189.  
  190. [Figure 1 -- ModemMail Command File]
  191.  
  192. ; This is the beginning of the MCI.LGI log-in
  193. ; command file.  
  194. CONSOLE "\NLogging in to MCI Mail ...\N"
  195. LET Y=3
  196. :LOOP
  197. MODEM "\R" &-
  198. IF MODEM "your user name:" LOGIN &-
  199. TIMEOUT 5S
  200. DECREMENT Y
  201. IF VAR Y>0 LOOP
  202. GOTO BYEBYE
  203. :LOGIN
  204. MODEM "TSILVEIRA\R" &-
  205. IF MODEM "Password:" &-
  206. TIMEOUT 10S BYEBYE
  207. MODEM "MYPASSWD\R"
  208. LET Y = ""
  209. END SUCCESS
  210. :BYEBYE
  211. BELL "Log-in failed.\n"
  212. MODEM "\+\+\+"
  213. WAIT 3S
  214. MODEM "ATH\R"
  215. END FAILURE
  216.  
  217. ------------------------------------------------------------------------------
  218.       Ted Silveira is a freelance writer and contributing editor to several
  219.    computer-oriented publications.  He appreciates suggestions or feedback
  220.    and can be reached through the KAY*FOG RBBS (415)285-2687 and CompuServe
  221.    (72135,1447) or by mail to 2756 Mattison Lane, Santa Cruz, CA 95065.
  222.  
  223. -------------------------  End of CPM-CC21.ART Text  -------------------------
  224.  
  225.