home *** CD-ROM | disk | FTP | other *** search
/ Corel Draw! Unleashed / Corel Draw! Unleashed.iso / wincim / scripts.lib / CSERVE.SCR < prev    next >
Encoding:
Text File  |  1993-05-14  |  3.0 KB  |  154 lines

  1. !
  2. !  Copyright (c) 1993
  3. !  by CompuServe Incorporated, Columbus, Ohio
  4. !
  5. !  The information in this software is subject to change without
  6. !  notice and should not be construed as a commitment by CompuServe.
  7. !
  8. !  CSERVE:
  9. !    Connect to CIS.
  10. !    First argument is %TRUE if direct connect and %FALSE otherwise
  11. !    Success:  returns %Success
  12. !    Failure:  saves error msg in %FailureMsg and returns %Failure
  13. !        or %Fatal (depending on severity).
  14. !
  15. !+V
  16. ! "3.0"
  17. !-V
  18.  
  19. DirectConnect = Arg1;
  20. show "Connecting to CompuServe Network";
  21. Tries = 7;
  22. on cancel goto Return_Cancel;
  23. FirstTry = %TRUE;
  24. FailStr = "";
  25. ETX = "^C";
  26. CompuServeHost = "CPS^M";
  27.  
  28. Start_Connect:
  29.     if Tries = 0 goto CIS_Failure;
  30.     Tries = Tries - 1;
  31.  
  32. Connect_Wait:
  33.     wait
  34.         "UIC:"        goto Send_ETX,
  35.         "Host Name:"    goto Send_Host_Name,
  36.         "User ID:"    goto Send_ID,
  37.         "Password:"    goto Send_Password
  38.     until 80;
  39.  
  40.     if not DirectConnect goto Send_CR;
  41.     sendm "###";
  42.  
  43. Send_CR:
  44.     send %CR;
  45.     goto Start_Connect;
  46.  
  47. Send_ETX:
  48.     send ETX;
  49.     goto Connect_Wait;
  50.  
  51. Send_Host_Name:
  52.     if Arg2 goto No_Wait;
  53.     wait until 10;
  54. No_Wait:
  55.     send CompuServeHost;
  56.     goto Connect_Wait;
  57.  
  58. Send_ID:
  59.     show "Logging onto CompuServe";
  60.     send %UserID & %LogonParams & "/INT\" & %Password & %CR;
  61.     goto Logon_Wait;
  62.  
  63. Send_Password:
  64.     send %Password;
  65.  
  66. Logon_Wait:
  67.     wait
  68.         "CompuServe"    goto Return_Success,
  69.         "^F"        goto Return_Success,
  70.         "? LOG"        goto Process_Log_Msg,
  71.         "??LOG"        goto Process_Log_Msg,
  72.         " NTW"        goto Logon_Failure,
  73.         "^[I"        goto Send_Response
  74.     until 200;
  75.  
  76.     goto CIS_Failure;
  77.  
  78. Process_Log_Msg:
  79.     wait
  80.         "INE"    goto Bad_ID,
  81.         "ISX"    goto Bad_ID_Syntax,
  82.         "CAI"    goto Cannot_Auto_Irun,
  83.         "SIL"    goto System_Unavailable,
  84.         "SIU"    goto System_Unavailable,
  85.         "SNA"    goto System_Unavailable,
  86.         "STU"    goto System_Unavailable,
  87.         "UTL"    goto Too_Many_Users
  88.     until 50;
  89.  
  90.     goto Try_Again;
  91.  
  92. Too_Many_Users:
  93.     define %FailureMsg = "Simultaneous users exceeded";
  94.     exit %Failure;
  95.  
  96. Cannot_Auto_Irun:
  97.     define %FailureMsg = "Cannot Auto Irun HMI server";
  98.     exit %Failure;
  99.  
  100. Bad_ID:
  101.     FailStr = "Incorrect User ID or password";
  102.     goto Try_Again;
  103.  
  104. Bad_ID_Syntax:
  105.     FailStr = "Incorrect User ID syntax";
  106.     goto Try_Again;
  107.  
  108. System_Unavailable:
  109.     define %FailureMsg = "The system is unavailable, try again later";
  110.     exit %Fatal;
  111.  
  112. Try_Again:
  113.     if not FirstTry goto CIS_Fatal;
  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.