home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / novcim.exe / SCRIPTS.LIB / CSERVE.SCR < prev    next >
Text File  |  1994-12-29  |  5KB  |  226 lines

  1. !
  2. !  Copyright (c) 1994
  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.5.2"
  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. ifndef %X121Address = "";
  28. ifndef %OKCmd = "";
  29. ifndef %StopAtHost = "";
  30. ifndef %AccountID = "";
  31. ifndef %BreakChar = "#";
  32.  
  33. Start_Connect:
  34.     if Tries = 0 goto CIS_Error;
  35.     Tries = Tries - 1;
  36.  
  37. Connect_Wait:
  38.     wait
  39.         "UIC:"        goto Send_ETX,
  40.         "Host Name:"    goto Send_Host_Name,
  41.         "User ID:"    goto Send_ID,
  42.         "Password:"    goto Send_Password,
  43.         "XPAD:"        goto Send_XPAD,
  44.         "ITI:"        goto Send_XPAD,
  45.         "? LOG"        goto Process_Log_Msg,
  46.         "??LOG"        goto Process_Log_Msg,
  47.         "% IPN"        goto Process_IPX_Msg,
  48.         "? IPX"        goto Process_IPX_Msg,
  49.         %mdm_Failure    goto CIS_No_Carrier
  50.     until 80;
  51.  
  52.     if not DirectConnect goto Send_CR;
  53.     sendm %BreakChar;
  54.     sendm %BreakChar;
  55.     sendm %BreakChar;
  56.  
  57. Send_CR:
  58.     send %CR;
  59.     goto Start_Connect;
  60.  
  61. Send_ETX:
  62.     send ETX;
  63.     goto Connect_Wait;
  64.  
  65. Send_Host_Name:
  66.     if Arg2 goto No_Wait;
  67.     wait until 10;
  68. No_Wait:
  69.     if %StopAtHost = "" goto Send_No_Stop;
  70.     if %StopAtHost = "1" goto Return_Success;
  71.     send CompuServeHost;
  72.     goto Return_Success;
  73.  
  74. Send_No_Stop:
  75.     send CompuServeHost;
  76.     goto Connect_Wait;
  77.  
  78. Send_ID:
  79.     define %ErrorCode = 0;
  80.     show "Logging onto CompuServe";
  81.     send %UserID & %LogonParams & "/INT" & %CR;
  82.     goto Connect_Wait;
  83.  
  84. Send_Password:
  85.     send %Password & %CR;
  86.     goto Logon_Wait;
  87.  
  88. Send_XPAD:
  89.     if %X121Address = "" goto Missing_XPAD;
  90.     send %X121Address & %CR;
  91.     goto Connect_Wait;
  92.  
  93. Missing_XPAD:
  94.     define %FailureMsg = "Missing X.121 address";
  95.     define %ErrorCode = 21;
  96.     exit %Fatal;
  97.     
  98. Logon_Wait:
  99.     wait
  100.         "Account ID:"    goto Send_AccountID,
  101.         "CompuServe"    goto Return_Success,
  102.         "^[[>"        goto Return_Success,
  103.         "^F"        goto Return_Success,
  104.         "? LOG"        goto Process_Log_Msg,
  105.         "??LOG"        goto Process_Log_Msg,
  106.         "% IPN"        goto Process_IPX_Msg,
  107.         "? IPX"        goto Process_IPX_Msg,
  108.         " NTW"        goto Logon_Failure,
  109.         "OK^M"        goto Send_OK_Cmd,
  110.         "^[I"        goto Send_Response,
  111.         %mdm_Failure    goto CIS_No_Carrier
  112.     until 200;
  113.  
  114.     define %ErrorCode = 22;
  115.     goto CIS_Failure;
  116.  
  117. Process_Log_Msg:
  118.     wait
  119.         "INE"    goto Bad_ID,
  120.         "ISX"    goto Bad_ID_Syntax,
  121.         "CAI"    goto Cannot_Auto_Irun,
  122.         "SIL"    goto System_Unavailable,
  123.         "SIU"    goto System_Unavailable,
  124.         "SNA"    goto System_Unavailable,
  125.         "STU"    goto Check_User_ID,
  126.         "UTL"    goto Too_Many_Users
  127.     until 50;
  128.  
  129.     goto Try_Again;
  130.  
  131. Process_IPX_Msg:
  132.     define %ErrorCode = 23;
  133.     define %FailureMsg = "InfoPlex is unavailable, try again later";
  134.     exit %Failure;
  135.  
  136. Send_AccountID:
  137.     send %AccountID & %CR;
  138.     goto Logon_Wait;
  139.  
  140. Too_Many_Users:
  141.     define %ErrorCode = 29;
  142.     define %FailureMsg = "Simultaneous users exceeded";
  143.     exit %Failure;
  144.  
  145. Cannot_Auto_Irun:
  146.     define %FailureMsg = "Cannot Auto Irun HMI server";
  147.     exit %Failure;
  148.  
  149. Bad_ID:
  150.     define %ErrorCode = 24;
  151.     FailStr = "Incorrect User ID or password";
  152.     goto Try_Again;
  153.  
  154. Bad_ID_Syntax:
  155.     define %ErrorCode = 25;
  156.     FailStr = "Incorrect User ID syntax";
  157.     goto Try_Again;
  158.  
  159. System_Unavailable:
  160.     define %ErrorCode = 23;
  161.     define %FailureMsg = "The system is unavailable, try again later";
  162.     exit %Fatal;
  163.  
  164. Check_User_ID:
  165.     define %ErrorCode = 26;
  166.     define %FailureMsg = "The system is unavailable, check User ID";
  167.     exit %Fatal;
  168.  
  169. Try_Again:
  170.     if not FirstTry goto CIS_Fatal;
  171.     send ETX;
  172.     FirstTry = %FALSE;
  173.  
  174.     wait
  175.         "User ID"    goto Send_ID,
  176.         %mdm_Failure    goto CIS_No_Carrier
  177.     until 140;
  178.  
  179.     goto CIS_Fatal;
  180.  
  181. Logon_Failure:
  182.     define %ErrorCode = 27;
  183.     define %FailureMsg = "Remote is busy or unavailable";
  184.     exit %Fatal;
  185.  
  186. Send_OK_Cmd:
  187.     if %OKCmd = "" goto Logon_Wait;
  188.     send %OKCmd & %CR;
  189.     goto Logon_Wait;
  190.  
  191. Send_Response:
  192.     sendi %ESCIResponse;
  193.     exit %Success;
  194.  
  195. CIS_Error:
  196.     define %ErrorCode = 20;
  197. CIS_Failure:
  198.     if FailStr <> "" goto Return_Fail_Msg;
  199.     define %FailureMsg = "Unable to connect to CompuServe host";
  200.     exit %Failure;
  201.  
  202. CIS_No_Carrier:
  203.     define %ErrorCode = 28;
  204.     if FailStr <> "" goto Return_Fail_Msg;
  205.     define %FailureMsg = "Modem connection lost";
  206.     exit %Failure;
  207.  
  208. CIS_Fatal:
  209.     if FailStr <> "" goto Return_Fatal_Msg;
  210.     define %FailureMsg = "Unable to connect to CompuServe host";
  211.     exit %Fatal;
  212.  
  213. Return_Fail_Msg:
  214.     define %FailureMsg = FailStr;
  215.     exit %Failure;
  216.  
  217. Return_Fatal_Msg:
  218.     define %FailureMsg = FailStr;
  219.     exit %Fatal;
  220.  
  221. Return_Success:
  222.     exit %Success;
  223.  
  224. Return_Cancel:
  225.     exit %Cancel;
  226.