home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / zoc201.zip / INSTALL.FIL / SCRIPT / RXSAMPLE / MISC / 7_CALBBS < prev    next >
Text File  |  1994-01-12  |  5KB  |  198 lines

  1.     #  This is a non-functional skeleton for creating an autologin 
  2.     #  script. However you might not need it, since simple autologins 
  3.     #  can be achieved without script programming using the autologin 
  4.     #  feature of the phone book.
  5.  
  6.     #  Scenario:
  7.     #    Let's assume Zaphod Beeblebrox uses the Megadodo bbs on Ursa 
  8.     #    Minor Beta to download new messages and upload the replys that 
  9.     #      he wrote offline. 
  10.     #    This script calls the bbs and eventually tries again until it
  11.     #    gets a CONNECT. Then it goes to the main menu where it downloads
  12.     #    a new mail packet and, if available, uploads Zaphod's replys.
  13.  
  14.  
  15.  
  16.     #  Prevent users from accidently dialling long distance to Ursa Minor Beta
  17.     request "Are you sure you want to make a call across the universe?" "No" "No"
  18.     goto finish
  19.  
  20.  
  21.     #  To test your own script, change the next line to 'debug 1'
  22.     debug 0
  23.  
  24.  
  25.     #  Set a few values (999 is the prefix for inter galactical calls :-)
  26.     setn  waittime 10            ;# time between dials
  27.     setn  maxtry   42            ;# max number of trys
  28.     seta  phone    "999-9283748742893478" ;# phone number to call
  29.     seta  bbs      "Megadodo BBS"         ;# bbs name to log in calling.log
  30.  
  31.  
  32.     #  Init the modem (and fail if no OK received within 5 seconds)
  33.     timeout 5
  34.     send "ATZ"
  35.     wait "OK"
  36.     ifbrk goto fail    
  37.  
  38.     #   Reset counter, clear screen
  39.     setn counter 1
  40.     cls
  41.  
  42.  
  43.     #   MAIN LOOP
  44.     #
  45.  
  46. :loop0
  47.     #  Dial and see what happens
  48.     #  (if the number contains a ^I (TAB) the following text is used
  49.     #  in the CALLING.LOG instead of logging just the phone number)
  50.     dial "%phone%^I%bbs%"
  51.  
  52.     #  Set timeout to 90sec. and wait for a line of text to come
  53.     timeout 90
  54. :loop1
  55.     waitline
  56.  
  57.     #  if something arrived save incoming line to variable 
  58.     #  (lastline might change duringprocessing)
  59.     ifnbrk seta last "%lastline%"
  60.  
  61.     #  else
  62.     #  if WAITLINE timed out, set our variable to TIMEOUT
  63.     ifbrk  seta last "TIMEOUT"
  64.  
  65.     #  Set text compare to non exact matching (that is CONNECT=CONNECT 1200)
  66.     exact    0
  67.  
  68.     #  compare to for CONNECT or CARRIER and if equal, log in
  69.     compa    "%last%" WITH CONNECT
  70.     ifequ    goto login    
  71.  
  72.     compa    "%last%" WITH CARRIER
  73.     ifequ    goto login    
  74.  
  75.  
  76.     #  Try again for BUSY, NO CARRIER
  77.     compa    "%last%" WITH BUSY
  78.     ifequ    goto SomeMore    
  79.  
  80.     compa    "%last%" WITH "NO CARRIER"
  81.     ifequ    goto SomeMore    
  82.  
  83.  
  84.     #  for TIMEOUT hang up
  85.     compa    "%last%" WITH "NO CARRIER"
  86.     ifequ    hangup
  87.  
  88.  
  89.     #   Ignore anything else (Zyxels say 'RINGING' or V42 say 'PROCOL xxx')
  90.     #  and wait for something we know
  91.     goto loop1
  92.  
  93.     #  Increment counter and eventually try again
  94.     #
  95. :SomeMore
  96.     #  ... wait and see if we ...
  97.     delay    %waittime%
  98.  
  99.     #  ... want to try again?
  100.     inc     counter
  101.     compn    %counter% with %maxtry%
  102.     iflow    goto loop0
  103.     ifequ    goto loop0
  104.  
  105.     #   No success after %maxtry% tries
  106.     goto    fail
  107.  
  108.  
  109.  
  110.     ##################
  111.     #  LOGIN        #
  112.     ##################
  113.  
  114. :login
  115.     #  Make a bit noise
  116.     beep 3
  117.     writeln "^M^J^J^MConnection established!!"
  118.     timeout 30
  119.  
  120.     #  log in
  121.     wait  "Name"
  122.     send  "Zaphod Beeblebroox^m"
  123.     wait  "Password"
  124.     send  "heart of gold^m"
  125.  
  126.  
  127.     #  care for the stuff they use to make script programming 
  128.     #  a bit harder (respond will be active whenever
  129.     #  the script processes a DELAY, WAIT or WAITLINE)
  130.     respond "your birth date" "11/11/11^m"
  131.     respond "press <enter> to continue" "^m"
  132.  
  133.     #  Wait for the main menu, go to the mail area and
  134.     #  request to download a mail packet
  135.     timeout 60
  136.     wait "your choice"
  137.     send "m^M"
  138.  
  139.     wait "your choice"
  140.     send "d^M"
  141.  
  142.     wait "file transfer protocol"
  143.     send "z^M"
  144.  
  145.     wait "are you sure"
  146.     send "y^M"
  147.  
  148.  
  149.     #  We could use the download command, but it's easier just to 
  150.     #  let autodownload jump in during a WAIT. So wait for the
  151.     #  'download finished' message and let autodownload care for
  152.     #  the rest 
  153.     
  154.     timeout 600          ;#   download could take a long time
  155.     wait "finished"
  156.  
  157.     wait "your choice"
  158.  
  159.  
  160.     #  Do the same for upload. To find out if an reply file exists
  161.     #  try to open it for reading.
  162.     openfile "hitchh.rep" "r"
  163.     compa "%lastline%" with "##OK##"
  164.     ifnequ goto logout
  165.     closefile 
  166.  
  167.     send "u^M"
  168.  
  169.     wait "file transfer protocol"
  170.     send "z^M"
  171.  
  172.     wait "are you sure"
  173.     send "y^M"
  174.  
  175.     timeout 600          ;#   upload could take a long time
  176.     wait "finished"
  177.  
  178.     #  after up/download go to the main menu and log out
  179. :logout
  180.        #  main menu (send ESC)
  181.     send "^["
  182.  
  183.        #  log out 
  184.     wait "your choice"
  185.     send "L"
  186.  
  187.  
  188.     ##################
  189.     #  THE END       #
  190.     ##################
  191. :finish
  192.     exit
  193.  
  194. :fail
  195.     writeln "ERROR"
  196.     exit
  197.  
  198.