home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 8 / 08.iso / d / d380_144 / 10.ddi / SCRIPTS.LIB / CSERVE.SCR < prev    next >
Encoding:
Text File  |  1993-03-19  |  4.0 KB  |  154 lines

  1. !---------------------------------------------------------------------!
  2. !                                                                     !
  3. !  Copyright (c) 1991                                                 !  
  4. !  by CompuServe Incorporated, Columbus, Ohio                         !
  5. !                                                                     !
  6. !  The information in this software is subject to change without      !
  7. !  notice and should not be construed as a commitment by CompuServe.  !
  8. !                                                                     !
  9. !  CSERVE Script:                                                     !
  10. !     Connect to CIS.                                             !
  11. !     First argument is %TRUE if direct connect and %FALSE otherwise  !
  12. !     Success:  returns %Success                                      !
  13. !     Failure:  saves error msg in %FailureMsg and returns %Failure   !
  14. !        or %Fatal (depending on severity).              !
  15. !                                      !
  16. !     $Revision::   1.5      $                                        !    
  17. !                                      !
  18. !---------------------------------------------------------------------!
  19.  
  20.     DirectConnect = Arg1;
  21.     show "Connecting to CompuServe Network";
  22.     Tries = 7;
  23.     on cancel goto Return_Cancel;
  24.     FirstTry = %TRUE;
  25.     FailStr = "";
  26.     ETX = "^C";
  27.     CompuServeHost = "CPS^M";
  28.  
  29. Start_Connect:
  30.     if Tries = 0 goto CIS_Failure;
  31.     Tries = Tries - 1;
  32.  
  33. Connect_Wait:
  34.     wait
  35.         "UIC:"       goto Send_ETX,
  36.         "Host Name:" goto Send_Host_Name,
  37.         "User ID:"   goto Send_ID,
  38.         "Password:"  goto Send_Password
  39.     until 80;
  40.  
  41.     if not DirectConnect goto Send_CR;
  42.     sendm "###";        ! (old way) send 3 breaks
  43. !   sendm "^\^\^\";        ! (new way) send 3 breaks
  44.  
  45. Send_CR:
  46.     send %CR;
  47.     goto Start_Connect;
  48.  
  49. Send_ETX:
  50.     send ETX;
  51.     goto Connect_Wait;
  52.  
  53. Send_Host_Name:
  54.     send CompuServeHost;
  55.     goto Connect_Wait;
  56.  
  57. Send_ID:
  58.     show "Logging onto CompuServe";
  59.     send %UserID & %LogonParams & "/INT\" & %Password & %CR;
  60.     goto Logon_Wait;
  61.  
  62. Send_Password:
  63.     send %Password;
  64.  
  65. Logon_Wait:
  66.     wait
  67.         "CompuServe" goto Return_Success,
  68.         "^F"         goto Return_Success,
  69.         "? LOG"      goto Process_Log_Msg,
  70.     "??LOG"         goto Process_Log_Msg,
  71.         " NTW"       goto Logon_Failure,
  72.         "^["         goto Send_Response
  73.     until 200;
  74.  
  75.     goto CIS_Failure;
  76.  
  77. Process_Log_Msg:
  78.     wait
  79.         "INE"    goto Bad_ID,
  80.     "ISX"    goto Bad_ID_Syntax,
  81.         "CAI"   goto Cannot_Auto_Irun,
  82.     "SIL"    goto System_Unavailable,
  83.     "SIU"    goto System_Unavailable,
  84.     "SNA"    goto System_Unavailable,
  85.     "STU"    goto System_Unavailable,
  86.         "UTL"   goto Too_Many_Users
  87.     until 50;
  88.  
  89.     goto Try_Again;
  90.  
  91. Too_Many_Users:
  92.     define %FailureMsg = "Simultaneous users exceeded";
  93.     exit %Failure;
  94.  
  95. Cannot_Auto_Irun:
  96.     define %FailureMsg = "Cannot Auto Irun HMI server";
  97.     exit %Failure;
  98.  
  99. Bad_ID:
  100.     FailStr = "Incorrect user ID or password";
  101.     goto Try_Again;
  102.  
  103. Bad_ID_Syntax:
  104.     FailStr = "Incorrect user ID syntax";
  105.     goto Try_Again;
  106.  
  107. System_Unavailable:
  108.     define %FailureMsg = "The system is unavailable, try again later";
  109.     exit %Fatal;
  110.  
  111. Try_Again:
  112.     if not FirstTry goto CIS_Fatal;
  113.  
  114.     send ETX;
  115.     FirstTry = %FALSE;
  116.  
  117.     wait
  118.         "User ID"    goto Send_ID
  119.     until 140;
  120.  
  121.     goto CIS_Fatal;
  122.  
  123. Logon_Failure:
  124.     define %FailureMsg = "Remote is busy or unavailable";
  125.     exit %Fatal;
  126.  
  127. Send_Response:
  128.     sendi %ESCIResponse;
  129.     exit %Success;
  130.  
  131. CIS_Failure:
  132.     if FailStr <> "" goto Return_Fail_Msg;
  133.     define %FailureMsg = "Unable to connect to CompuServe host";
  134.     exit %Failure;
  135.  
  136. CIS_Fatal:
  137.     if FailStr <> "" goto Return_Fatal_Msg;
  138.     define %FailureMsg = "Unable to connect to CompuServe host";
  139.     exit %Fatal;
  140.  
  141. Return_Fail_Msg:
  142.     define %FailureMsg = FailStr;
  143.     exit %Failure;
  144.     
  145. Return_Fatal_Msg:
  146.     define %FailureMsg = FailStr;
  147.     exit %Fatal;
  148.     
  149. Return_Success:
  150.     exit %Success;
  151.  
  152. Return_Cancel:
  153.     exit %Cancel;
  154.