home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0090 - 0099 / ibm0090-0099 / ibm0099.tar / ibm0099 / WINCIMP1.ZIP / SCRIPTS.LIB / CSERVE.SCR < prev    next >
Encoding:
Text File  |  1992-11-17  |  4.0 KB  |  153 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 "###";
  43.  
  44. Send_CR:
  45.     send %CR;
  46.     goto Start_Connect;
  47.  
  48. Send_ETX:
  49.     send ETX;
  50.     goto Connect_Wait;
  51.  
  52. Send_Host_Name:
  53.     send CompuServeHost;
  54.     goto Connect_Wait;
  55.  
  56. Send_ID:
  57.     show "Logging onto CompuServe";
  58.     send %UserID & %LogonParams & "/INT\" & %Password & %CR;
  59.     goto Logon_Wait;
  60.  
  61. Send_Password:
  62.     send %Password;
  63.  
  64. Logon_Wait:
  65.     wait
  66.         "CompuServe" goto Return_Success,
  67.         "^F"         goto Return_Success,
  68.         "? LOG"      goto Process_Log_Msg,
  69.     "??LOG"         goto Process_Log_Msg,
  70.         " NTW"       goto Logon_Failure,
  71.         "^["         goto Send_Response
  72.     until 200;
  73.  
  74.     goto CIS_Failure;
  75.  
  76. Process_Log_Msg:
  77.     wait
  78.         "INE"    goto Bad_ID,
  79.     "ISX"    goto Bad_ID_Syntax,
  80.         "CAI"   goto Cannot_Auto_Irun,
  81.     "SIL"    goto System_Unavailable,
  82.     "SIU"    goto System_Unavailable,
  83.     "SNA"    goto System_Unavailable,
  84.     "STU"    goto System_Unavailable,
  85.         "UTL"   goto Too_Many_Users
  86.     until 50;
  87.  
  88.     goto Try_Again;
  89.  
  90. Too_Many_Users:
  91.     define %FailureMsg = "Simultaneous users exceeded";
  92.     exit %Failure;
  93.  
  94. Cannot_Auto_Irun:
  95.     define %FailureMsg = "Cannot Auto Irun HMI server";
  96.     exit %Failure;
  97.  
  98. Bad_ID:
  99.     FailStr = "Incorrect user ID or password";
  100.     goto Try_Again;
  101.  
  102. Bad_ID_Syntax:
  103.     FailStr = "Incorrect user ID syntax";
  104.     goto Try_Again;
  105.  
  106. System_Unavailable:
  107.     define %FailureMsg = "The system is unavailable, try again later";
  108.     exit %Fatal;
  109.  
  110. Try_Again:
  111.     if not FirstTry goto CIS_Fatal;
  112.  
  113.     send ETX;
  114.     FirstTry = %FALSE;
  115.  
  116.     wait
  117.         "User ID"    goto Send_ID
  118.     until 140;
  119.  
  120.     goto CIS_Fatal;
  121.  
  122. Logon_Failure:
  123.     define %FailureMsg = "Remote is busy or unavailable";
  124.     exit %Fatal;
  125.  
  126. Send_Response:
  127.     sendi %ESCIResponse;
  128.     exit %Success;
  129.  
  130. CIS_Failure:
  131.     if FailStr <> "" goto Return_Fail_Msg;
  132.     define %FailureMsg = "Unable to connect to CompuServe host";
  133.     exit %Failure;
  134.  
  135. CIS_Fatal:
  136.     if FailStr <> "" goto Return_Fatal_Msg;
  137.     define %FailureMsg = "Unable to connect to CompuServe host";
  138.     exit %Fatal;
  139.  
  140. Return_Fail_Msg:
  141.     define %FailureMsg = FailStr;
  142.     exit %Failure;
  143.     
  144. Return_Fatal_Msg:
  145.     define %FailureMsg = FailStr;
  146.     exit %Fatal;
  147.     
  148. Return_Success:
  149.     exit %Success;
  150.  
  151. Return_Cancel:
  152.     exit %Cancel;
  153.