home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / lw31.zip / JDEBP.CMD < prev    next >
OS/2 REXX Batch file  |  1995-11-06  |  8KB  |  193 lines

  1. /* SysteM-C-V mail run (by JdeBP) */
  2. /*  ******************************************************************  *\
  3.  *    SysteMCV.CMD --- Yes folks !  This is REXX !                      *
  4.  *                                                                      *
  5.  *    JdeBP's LiveWire script file for connecting to SysteM-C-V and     *
  6.  *    performing a fully automated mail run.  This could probably       *
  7.  *    be adapted to work with any PC Board 15 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. /* Here's the main bit folks !                                          */
  30.  
  31.     SendUserName() ;          /* All that logging on stuff is handled   */
  32.     SendLW("Mail^M") ;        /* Enter the mail door from the main menu */
  33.     CamMail() ;               /* My mail door is Cam-Mail               */
  34.     HangUpLW() ;              /* We've said (G)oodbye, so ...           */
  35.  
  36.     exit
  37.  
  38. /*  Wasn't that simple !  That's the power of REXX you know.  (-:       */
  39.  
  40. /*                                                                      */
  41. /*  SendUserName -  This function handles all of the initial logging    */
  42. /*  on nastiness.  The idea of it being a loop is that on noisy lines   */
  43. /*  it should keep reentering your name until either it works, or the   */
  44. /*  BBS hangs up on you in disgust.                                     */
  45. /*                                                                      */
  46.  
  47. SendUserName:
  48.  
  49.     /*  Customise the following for your PC Board setup.                */
  50.  
  51.     /*  The backspaces before my name are to clear up a load of ANSI    */
  52.     /*  junk that somehow gets entered into the username field.         */
  53.  
  54.     /*  Note how we pick the password up from the dialling list entry.  */
  55.  
  56.     Username = "^H^H^H^H^H^H^HJonathan de Boyne Pollard^M"
  57.     Password = GetLW("DialerPassword")||"^M"
  58.     Language = "2"
  59.  
  60.     do forever
  61.  
  62.     /* **************************************************************** *\
  63.      * The following are the modifications needed to login to Channel 1 *
  64.      * in the United State, and are good examples of the modifications  *
  65.      * that may be required in some cases.                              *
  66.      *                                                                  *
  67.      * login=FindLW("anguage # to use",                                 *
  68.      *             ,"graphics (Enter)=no? ",                            *
  69.      *             ,"you want Color? ",                                 *
  70.      *             ,"our first name?",                                  *
  71.      *             ,"Is this correct? ",                                *
  72.      *             ,"rd (Dots will echo)? ",                            *
  73.      *             ,"ead your personal mail",                           *
  74.      *             ," Main Board Command? ");                           *
  75.      *                                                                  *
  76.      * select                                                           *
  77.      * when login="anguage # to use"      then SendLW(Language||"^M") ; *
  78.      * when login="you want Color? "      then SendLW("^M") ;           *
  79.      * when login="graphics (Enter)=no? " then SendLW("^M") ;           *
  80.     \* **************************************************************** */
  81.  
  82.        login=FindLW("used (Enter)=Normal? ",
  83.                    ,"graphics (Enter)=no? ",
  84.                    ,"our first name?",
  85.                    ,"Is this correct? ",
  86.                    ,"rd (Dots will echo)? ",
  87.                    ,"ead your personal mail",
  88.                    ," Main Board Command? ");
  89.  
  90.        select
  91.        when login="used (Enter)=Normal? "  then SendLW(Language||"^M") ;
  92.        when login="graphics (Enter)=no? "  then SendLW("^M") ;
  93.        when login="our first name?"        then SendLW(Username) ;
  94.        when login="Is this correct? "      then SendLW("Y^M") ;
  95.        when login="rd (Dots will echo)? "  then SendLW(Password) ;
  96.        when login="ead your personal mail" then SendLW("N^M") ;
  97.        when login=" Main Board Command? "  then Leave ;
  98.        otherwise do
  99.  
  100.           /*  The only thing that usually will bring you here is   */
  101.           /*  a timeout.  What you do here is up to you.  I just   */
  102.           /*  panic myself.                                        */
  103.  
  104.                  Say "SCRIPT FAILED !!!! The prompt was " login
  105.                  HangUpLW() ;
  106.                  Exit ;
  107.        end
  108.        end
  109.  
  110.     end
  111.  
  112.     /*  We are now at the main board command prompt.                    */
  113.  
  114.     return "" ;
  115.  
  116. /*                                                                      */
  117. /*  CamMail -- A simplistic handler for the Cam-Mail mail door.  This   */
  118. /*  will upload a REP if it exists, then download a QWK and hangup.     */
  119. /*                                                                      */
  120.  
  121. CamMail:
  122.     UploadDir = GetLW("ULDir") ;
  123.     if UploadDir \= "" then UploadDir = UploadDir||"\" ;
  124.     RepFile = UploadDir||"SysteMCV.rep" ;
  125.     Protocol = GetLW("DialerProtocol") ;
  126.  
  127.     /*  These variables track what is going on */
  128.     Uploaded = ( stream(RepFile, 'C', 'Query Exists')="" )
  129.     Downloaded = 0 ;
  130.     Done = 0 ;
  131.  
  132.  
  133.     do until (Done)
  134.  
  135.        cammail=FindLW(" Cam-Mail Command? ",
  136.                      ,"you want to receive these messages",
  137.                      ,"Prepare To Download",
  138.                      ,"(H)angup");
  139.  
  140.        select
  141.        when cammail=" Cam-Mail Command? " then do
  142.  
  143.             select
  144.  
  145.             when \ Uploaded then do
  146.                  SendLW("u^M") ;
  147.                  DelayLW(300) ;
  148.                  SendFilesLW(Protocol, RepFile) ;
  149.                  Uploaded = 1
  150.             end
  151.             when \ Downloaded then do
  152.                  DelayLW(700) ;
  153.                  SendLW("d^M") ;
  154.             end
  155.             otherwise  do
  156.                  SendLW("G^M") ;
  157.                  Done = 1 ;
  158.             end
  159.  
  160.             end
  161.  
  162.        end
  163.        when cammail="you want to receive these messages" then do
  164.             SendLW("Y^M") ;
  165.        end
  166.        when cammail="Prepare To Download" then do
  167.             ReceiveFilesLW(Protocol, "SysteMCV.qwk") ;
  168.             Downloaded = 1 ;
  169.        end
  170.        when cammail="(H)angup" then do
  171.             DelayLW(100) ;
  172.             SendLW("h") ;
  173.             Done = 1 ;
  174.        end
  175.        otherwise nop ;
  176.        end
  177.  
  178.     end
  179.  
  180.     /* This is the fun bit which you can adapt to your own ends.  You   */
  181.     /* now potentially have a QWK in your download directory.  What I   */
  182.     /* do is to start a batch file in the background that copies it to  */
  183.     /* an archive directory, and moves the original into the mail       */
  184.     /* reader's inbound directory.  Of course, TRANSFER.BTM handles all */
  185.     /* of my QWKs, so it takes the BBSID as a parameter.                */
  186.  
  187.     Start "/bg /c Transfer SysteMCV"
  188.  
  189.     /* The transfer now is running in the background.  Good, innit ?    */
  190.  
  191.     return "" ;
  192.  
  193.