home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / lw30.zip / WC.CMD < prev    next >
OS/2 REXX Batch file  |  1995-09-18  |  9KB  |  228 lines

  1. /* Wildcat BBS Logon (JdeBP) */
  2. /*  ******************************************************************  *\
  3.  *    Wildcat.CMD --- Yes folks !  This is REXX !                       *
  4.  *                                                                      *
  5.  *    JdeBP's LiveWire script file for connecting to The Mish and       *
  6.  *    performing a fully automated mail run.  This could probably       *
  7.  *    be adapted to work with any Wildcat/Tomcat BBS.                   *
  8.  *                                                                      *
  9.  *    (c) Copyright 1994 Jonathan de Boyne Pollard                      *
  10.  *        Jonathan.de.Boyne.Pollard@p3.f4.n440.z2.fidonet.org           *
  11.  *        JdeBP@donor2.ukmail.net                                       *
  12.  *                                                                      *
  13.  *    Permission is hereby granted to post, steal and abuse this        *
  14.  *    script for your own purposes to your heart's content, as long     *
  15.  *    as you realise that I take no responsibility whatsoever for       *
  16.  *    what it does to your machine, data, cat, or marital status.       *
  17. \*  ******************************************************************  */
  18.  
  19. /* All of these adapted from the learned script */
  20. Trace(Off);
  21. SetLW(TimeOut,60);
  22. SetLW(Pacing,40);
  23. SetLW(Emulation, ANSI);
  24. SetLW(Echo,0);
  25. SetLW(Linefeeds,0);
  26. SetLW(XonXoff,0);
  27. SetLW(BSIsDel,0);
  28.  
  29.  
  30. /*      Customise the following for your Wildcat setup.                 */
  31.  
  32.     Firstname = "Jonathan"
  33.     Lastname  = "de Boyne Pollard"
  34.     MyTown    = "Kenilworth"
  35.     Password  = "password"              /* Yeah, right.  As if I would! */
  36.     Telephone = "0000000000"            /* Ditto.                       */
  37.     BirthDate = "000000"                /* Ditto.                       */
  38.  
  39.     UploadDir = GetLW("ULDir") ;
  40.     if UploadDir \= "" then UploadDir = UploadDir||"\" ;
  41.     RepFile = UploadDir||"Mission.rep" ;
  42.     DownloadDir = GetLW("DLDir") ;
  43.     if DownloadDir \= "" then DownloadDir = DownloadDir||"\" ;
  44.     QWKFile = DownloadDir||"Mission.QWK" ;
  45.  
  46. /*    Protocol = GetLW("DialerProtocol") ;*/
  47.  
  48. /* Here's the main bit folks !                                          */
  49.  
  50.     SendUserName() ;              /* Enter the username and password    */
  51.     VerifyUser() ;                /* Cope with any validation prompts   */
  52.  
  53.     /*  If you have !logon access to your local Wildcat! BBS, then      */
  54.     /*  appropriate changes to SendUserName() can allow you to omit     */
  55.     /*  the following two stages, and go directly to Tomcat.            */
  56.  
  57.     SkipBulletinsMailAndNews() ;  /* Erm ... guess !                    */
  58.     SendLW("2") ;                 /* BBS specific hotkey to enter Tomcat*/
  59.  
  60.     Tomcat() ;                    /* Handle Tomcat                      */
  61.  
  62.     exit
  63.  
  64. /*  That wasn't as simple as the PCBoard one, mainly because the sysop  */
  65. /*  is an obstinate sod, who doesn't give his users !logons.  (-:       */
  66.  
  67. /*                                                                      */
  68. /*  SendUserName -  This function handles all of the initial logging    */
  69. /*  on nastiness.  As with PCBoard, this is easiest as a loop.          */
  70. /*                                                                      */
  71.  
  72. SendUserName:
  73.  
  74.     do until login=MyTown||"? [Y]"
  75.  
  76.        login = FindLW("-Pause-",              /* Esp. for Keith Barnes. */
  77.                      ," is your first name?",
  78.                      ," is your  last name?",
  79.                      ," correctly? [N]",
  80.                      ,MyTown||"? [Y]") ;
  81.  
  82.        select
  83.        when login="-Pause-" then              SendLW("C") ;
  84.        when login=" is your first name?" then SendLW(firstname||"^M") ;
  85.        when login=" is your  last name?" then SendLW(lastname||"^M") ;
  86.        when login=" correctly? [N]" then      SendLW("N^M") ;
  87.        when login=MyTown||"? [Y]" then        SendLW("Y") ;
  88.        end
  89.  
  90.     end
  91.  
  92.     return "" ;
  93.  
  94. /*                                                                      */
  95. /*  VerifyUser -  This function handles post-login verification.  This  */
  96. /*  could be combined with the SendUserName() function, but it is       */
  97. /*  really a distinct stage for Wildcat, in that if you fail to verify  */
  98. /*  you aren't prompted for a new user name.                            */
  99. /*                                                                      */
  100.  
  101. VerifyUser:
  102.  
  103.     do forever
  104.  
  105.        /* Possibly you could add logic here to automatically handle     */
  106.        /* entering the message editor when your verification fails.     */
  107.        /* However, verification *shouldn't* fail if you have set the    */
  108.        /* variables up correctly.                                       */
  109.  
  110.        verify=FindLW("[              ]",
  111.                     ,"[   -   -    ]",
  112.                     ,"[  /  /  ]",
  113.                     ,Firstname) ;
  114.  
  115.        select
  116.        when verify="[              ]" then SendLW(password||"^M") ;
  117.        when verify="[   -   -    ]" then   SendLW(Telephone||"^M") ;
  118.        when verify="[  /  /  ]" then       SendLW(BirthDate||"^M") ;
  119.        when verify=Firstname then          Leave ;
  120.        otherwise                           Nop ;
  121.        end
  122.  
  123.     end
  124.  
  125.     return "" ;
  126.  
  127. /*                                                                      */
  128. /*  I don't know about you, but *my* Wildcat sysop enjoys his logon     */
  129. /*  screens far too much.  However, this little function should skip    */
  130. /*  most of them with little fuss.                                      */
  131. /*                                                                      */
  132.  
  133. SkipBulletinsMailAndNews:
  134.  
  135.     do forever
  136.  
  137.        /*  Note that I have chosen to [L]ist new personal mail.  For    */
  138.        /*  TRULY unattended runs you may choose to [C]ontinue instead.  */
  139.  
  140.        nonstop=FindLW("-Pause-",
  141.                      ,"new personal mail,",
  142.                      ,"view the bulletin menu",
  143.                      ,"you like to view",
  144.                      ,"] to continue?") ;
  145.  
  146.        select
  147.        when nonstop="-Pause-" then                 SendLW("C") ;
  148.        when nonstop="new personal mail," then      SendLW("L") ;
  149.        when nonstop="view the bulletin menu" then  SendLW("N") ;
  150.        when nonstop="you like to view" then        SendLW("N") ;
  151.        when nonstop="] to continue?" then          Leave ;
  152.        otherwise                                   Nop ;
  153.        end
  154.  
  155.     end
  156.  
  157.     /*  We are at the final "Press [ENTER]" prompt before the main      */
  158.     /*  menu, so guess when we do now !                                 */
  159.  
  160.     SendLW("^M") ;
  161.  
  162.     return "" ;
  163.  
  164. /*                                                                      */
  165. /*  Tomcat -- A function to handle the TomCat mail door.  This will     */
  166. /*  upload a REP if it exists, download any prescanned REPs if it can,  */
  167. /*  or download a REP scanned online.  It should be pretty easy to      */
  168. /*  modify this to ONLY download prescanned REPs, as that was my        */
  169. /*  original intention.                                                 */
  170. /*                                                                      */
  171.  
  172. Tomcat:
  173.     Uploaded = ( stream(RepFile, 'C', 'Query Exists')="" ) ;
  174.     Downloaded = 0 ;
  175.     PrescanPresent = 0 ;
  176.     Done = 0 ;
  177.  
  178.     do until (Done)
  179.  
  180.        tomcat=FindLW("prescanned packet",
  181.                      ,"TOMCAT MENU",
  182.                      ,"Transfer successful") ;
  183.  
  184.        select
  185.        when tomcat="prescanned packet" then
  186.             PrescanPresent = 1 ;
  187.        when tomcat="TOMCAT MENU" then do
  188.  
  189.             select
  190.             when \ Uploaded then do
  191.                  SendLW("U") ;
  192.                  DelayLW(300) ;
  193.                  SendFilesLW("Z", RepFile) ;                /* ZMODEM!  */
  194.                  Uploaded = 1 ;
  195.             end
  196.             when PrescanPresent then do
  197.                  SendLW("DG") ;
  198.             end
  199.             when \ Downloaded then do
  200.                  SendLW("DG") ;
  201.             end
  202.             end
  203.  
  204.        end
  205.        when tomcat="Transfer successful" then do
  206.  
  207.             /* This prompt is triggered at the end of BOTH uploads and  */
  208.             /* downloads, so we only exit if a QWK packet now exists.   */
  209.  
  210.             /* Maybe in the future I will sort out the correct prompts  */
  211.             /* to distinguish uploads and downloads, and even handle    */
  212.             /* UNsuccessful tranfers ...                                */
  213.  
  214.             Done = \ ( stream(QwkFile, 'C', 'Query Exists')="" )
  215.        end
  216.        otherwise nop ;
  217.        end
  218.  
  219.     end
  220.  
  221.     /* Again, the TRANSFER.BTM file takes the QWK from the download     */
  222.     /* directory and copies and moves it in the background.             */
  223.  
  224.     Start "/bg /c Transfer Mission"
  225.  
  226.     return "" ;
  227.  
  228.