home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / os2swofl.cmd < prev    next >
OS/2 REXX Batch file  |  1994-03-20  |  6KB  |  167 lines

  1. /* LiveWire Offline OS2Shareware BBS REXX Script File   OS2SWOFL.CMD */
  2.  
  3. /* This script log's on to Pete's board, Captures New Messages and Files
  4.    Downloads your Qwk Messages and the latest OS2NEW.ZIP files and exits.
  5.    After this I use a second script that just gets me to the main menu
  6.    (actually just the first section of this script) I then manually
  7.    upload my qwk replies and download any files of interest. You might
  8.    like to automate this second Pass, but I'm new to Qwk and havent thought 
  9.    out the "sync" problems with a script that uploads prior replies before
  10.    downloading current messages. ( I use and like, MR2 to read offline QWKs)
  11.    Anyway feel free to use the script or any portion of it. I borrowed the 
  12.    initial Do Loop from someone elses example (Sorry I've forgotten your 
  13.    full name Jonathan D P??) Hope this is a usefull example of Rexx and LW
  14.    
  15.                                     Kenn Lynch Sat 03-19-1994   
  16.                                     
  17.    You should edit the paths e:\download and d:\lwos2 
  18.    to match your own paths. Enter your own name and password, in the variables
  19.    The script also assumes you have unzip and its in your current path.
  20.    Enter the scripts name in the LW dialing directory entry for OS2 SW BBS.
  21.    You can rename this script, but extension must be .CMD to work in LW */             
  22.  
  23.  
  24. /* Set timeout */
  25. SetLW(TimeOut,60);
  26.  
  27. /* Set inter-character pacing to 40ms */
  28. SetLW(Pacing,40);
  29.  
  30. /* Set emulation and toggles */
  31. SetLW(Emulation,1);
  32. SetLW(Echo,0);
  33. SetLW(Linefeeds,0);
  34. SetLW(XonXoff,0);
  35. SetLW(BSIsDel,1);
  36.  
  37. /* I pre-load my strings with backspaces to avoid line noise. 
  38.    I have never had this problem with Pete's board, 
  39.    but its needed on some others I've used 
  40.    What LiveWire needs is a way to store ENCRYPTED passwords and pass them
  41.    to the script(or encrypt the script) I prefer to keep my password in the
  42.    script file rather than in the dialing directory, neither is secure! */
  43.     
  44.  Username = "^H^H^H^H^H^H^HFIRST LASTNAME" /* your first and last name */
  45.  Password = "^H^H^H^HPASSWORD"             /* Your password here */
  46.  
  47.    SendLW("^M");
  48.  
  49.    Do forever
  50.  
  51.       ret=FindLW("wait 20 seconds",
  52.                    ,"your name:",
  53.                    ,"[Y,n]?",
  54.                    ,"Password:",
  55.                    ,"ss ENTER to continue");
  56.  
  57.       select
  58.        when ret="wait 20 seconds"       then SendLW("^[") ;
  59.        when ret="your name:"            then SendLW(Username||"^M") ;
  60.        when ret="[Y,n]? "               then SendLW("Y^M") ;
  61.        when ret="Password:"             then SendLW(Password||"^M") ;
  62.        when ret="ss ENTER to continue " then Leave ;
  63.                                        
  64.        otherwise
  65.           /*  The only thing that usually will bring you here is   */
  66.           /*  a timeout.  What you do here is up to you.  I just   */
  67.           /*  panic myself. (this DO was borrowed from JDBP)       */
  68.           Say "SCRIPT FAILED (prompts changed?)!!!! prompt was " ret;
  69.                
  70.        end
  71.    end
  72.  
  73.     SendLW("^M");
  74.  
  75. /* We're in now, time for a little local house keeping,    You can modify this 
  76.    part to suit your needs. what I do is a keep the last 2 session logs.
  77.    Livewire 2.1 now correctly appends to previous log, but I dont like to
  78.    page foreward through the old stuff. Since I've been using QWK packets
  79.    The log doesnt contain any messages, only thing of interest is the new
  80.    files. I've started using LWs scroll back to view them so this capture file
  81.    is less usefull. By the way the capture file and os2new.txt are left in the
  82.    LiveWire directory you might like to path them to your download dir instead.
  83. */   
  84.  
  85. /* save old capture file to os2sw-1.cap delete the original, Capture on */ 
  86.  
  87.    'copy os2sw.cap os2sw-1.cap';
  88.    'del os2sw.cap';
  89.     SetLW(Capture, ON,"os2sw.CAP");
  90.  
  91. /* Capture mail to log file, may not be needed if they are received in Qwk */
  92.  
  93.     ret=FindLW("r mail? [Y,n]");
  94.     DelayLW(100);
  95.     SendLW("Y^M");
  96.  
  97. /*  Get whats newer than os2new.zip (todays uploads) */
  98.  
  99.     ret=FindLW(" files? [Y,n]");
  100.     DelayLW(100);
  101.     SendLW("Y^M");
  102.  
  103.     ret=FindLW("ss ENTER to continue ");
  104.     DelayLW(100);
  105.     SendLW("^M");
  106.  
  107. /* go from the main menu to the offline menu, dl QWKs from the forums you 
  108.    preselected in the offline area 
  109.    Note I just experienced a problem that occurs when you have more than 
  110.    10 previous Qwk message files, the Zmodem rename fails It appears you
  111.    can loose the packet this way ! Best do regular houskeeping in your KWQ 
  112.    reader or add some lines here to rename older message packets 
  113.     */
  114.    
  115.     ret=FindLW("Select:");
  116.     DelayLW(100);
  117.     SendLW("od^M");
  118.                   
  119.  
  120. /* this logic assumes that once you enter the Offline are if there are no
  121.    messages, you are sent back to Main Menu, If there are messages you are
  122.    prompted to enter a return or wait for dl to start, and finally, an Xon 
  123.    (^Q) is sent after download is completed, an "M" returns you to Main Menu */
  124.  
  125.  
  126.    Do Forever
  127.      ret=FindLW("abort","","Select:");
  128.      select
  129.        when ret="abort"                   then SendLW("^M") ;
  130.        when ret=""                       then SendLW("M");
  131.        when ret="Select:"                 then Leave;
  132.        otherwise    
  133.        Say "SCRIPT FAILED (prompts changed?)!!!! prompt was " ret;
  134.      end;
  135.    end;     
  136.  
  137.  
  138. /*     Go to the files section, delete prior os2new.zip, dl latest os2new.zip 
  139.     There seems to still be a minor bug in LW2.1s Capture off, If you watch
  140.     your screen you'll note Capture is turned ON instead of OFF?
  141.     Les Novell said he'll fix this one in LW 2.2) */ 
  142.  
  143.     'del e:\download\os2new.zip'; 
  144.     SetLW(Capture,OFF);          /* This used to work. bug in LW2.1? */ 
  145.     SendLW("FDOS2NEW^M");                   
  146.  
  147.     ret=FindLW("s) to download ");
  148.     DelayLW(100);
  149.     SendLW("^M^M");
  150.     
  151. /* I had problems using the /g (goodbye after dl) method. Could not find a
  152.    sucessful string to catch in the countdown. I think there are ANSI cursor 
  153.    positioning characters in the countdown numbers. I hope the abrupt hangup
  154.    doesnt cause any odd status on Petes Board? 
  155.    After download, hangup, del prior os2new.txt, unzip latest os2new.txt */ 
  156.  
  157.     ret=FindLW("");
  158.     DelayLW(100);
  159.     HangUpLW();
  160.  
  161.    'del d:\lwos2\os2new.txt';
  162.    'unzip e:\download\os2new.zip';
  163.     
  164.     Exit
  165.  
  166.  
  167.