home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / DATACOM / TERM / LW22 / WC.CMD < prev    next >
OS/2 REXX Batch file  |  1994-04-20  |  9KB  |  227 lines

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