home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1996 June / BUYER_696.iso / internet / wincim / scripts.lib / DISCONCT.SCR < prev    next >
Text File  |  1995-12-05  |  3KB  |  164 lines

  1. !
  2. !  Copyright (c) 1995
  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. !  DISCONCT:
  9. !    Handles all network/modem disconnections
  10. !    %LOCAL  = 1 if hanging up while network script running
  11. !        = 2 if hanging up before connection
  12. !
  13. !+V
  14. ! "3.8.1"
  15. !-V
  16.  
  17. WaitTime = 80;
  18. attempts = 0;
  19.  
  20. CompuServe = 1;
  21. SprintNet = 2;
  22. CSIRnet = 16;
  23. Datex_J = 19;
  24. Internet = 25;
  25. Direct = 40;
  26. Result = %Success;
  27. ifndef %BreakChar = "#";
  28.  
  29. DirectConnect = (%Network = Direct) or (%DialType = 2);
  30.  
  31. ifndef %LOCAL = 0;
  32. if %LOCAL = 1 goto Do_Local_Hangup;
  33. if %LOCAL = 2 goto Send_Hangup;
  34.  
  35. if %Network = Internet goto Exit_Script;
  36. if %Network = CompuServe goto Start_Wait;
  37. if %Network = Direct goto Start_Wait;
  38. if %Network = Datex_J goto Hangup_Datex_J;
  39. if %Network = SprintNet goto Hangup_SprintNet;
  40. if %Network = CSIRnet goto Hangup_CSIRnet;
  41. goto Do_Local_Hangup;
  42.  
  43. Start_Wait:
  44.     wait
  45.         "XPAD:"        goto Hangup_Complete,
  46.         "ITI:"        goto Hangup_Complete,
  47.         "Host Name:"    goto Send_Bye,
  48.         "User ID:"    goto Send_Host,
  49.         "Disconnected from host" goto PPP_Hangup,
  50.         "UIC:"        goto Send_UIC,
  51.         %mdm_Failure    goto Hangup_Complete
  52.     until WaitTime;
  53.     goto Do_Local_Hangup;
  54.  
  55. Send_Bye:
  56.     send "BYE^M";
  57.     if DirectConnect goto Hangup_Complete;
  58.     goto Wait_NO_CARRIER;
  59.  
  60. PPP_Hangup:
  61.     if DirectConnect goto Hangup_Complete;
  62.     goto Start_Wait;
  63.  
  64. Send_Host:
  65.     send "/HOST^M";
  66.     goto Start_Wait;
  67.  
  68. Send_UIC:
  69.     send "^C";
  70.     wait until 30;
  71.     goto Start_Wait;
  72.  
  73. Hangup_SprintNet:
  74.     show "Disconnecting from SprintNet";
  75.     wait
  76.         "disconnected"  goto Send_Sprint_Hangup
  77.     until 60;
  78.     goto Do_Local_Hangup;
  79.  
  80. Send_Sprint_Hangup:
  81.     wait until 3;
  82.     send "HANGUP^M";
  83.     goto Wait_NO_CARRIER;
  84.  
  85. Hangup_CSIRnet:
  86.     show "Disconnecting from CSIR-Net";
  87.     wait until 40;
  88.     send "Z";
  89.     goto Wait_NO_CARRIER;
  90.  
  91. Hangup_Datex_J:
  92.     show "Disconnecting from Datex-J";
  93.     wait 
  94.         "Host Name:"    goto Send_OFF,  
  95.         "CLR"        goto Clear_PAD
  96.     until 100;
  97.     ! fall through...
  98.  
  99. Clear_PAD:
  100.     wait until 60;
  101.     send "*9#";
  102.     goto Wait_NO_CARRIER;
  103.  
  104. Send_OFF:
  105.     send "OFF" & %CR;
  106.     goto Hangup_Datex_J;
  107.  
  108. Wait_NO_CARRIER:
  109.     if DirectConnect goto Hangup_Complete;
  110.     wait
  111.         "BYE^M"        goto Hangup_Complete,
  112.         %mdm_Failure    goto Hangup_Complete
  113.     until 30;
  114.  
  115.     sendm %mdm_EscapeCode;
  116.  
  117.     wait
  118.         %mdm_Failure    goto Hangup_Complete,
  119.         %mdm_Ack    goto Send_Hangup
  120.     until 20;
  121.     ! fall through...
  122.  
  123. Do_Local_Hangup:
  124.     if DirectConnect goto Hangup_Direct;
  125.  
  126.     wait until 20;
  127.     sendm %mdm_EscapeCode;
  128.  
  129.     wait
  130.         %mdm_Ack    goto End_Escape_Wait,
  131.         %mdm_Failure    goto Hangup_Complete
  132.     until 20;
  133.     goto Send_Hangup;
  134.  
  135. End_Escape_Wait:
  136.     wait until 10;
  137.     ! fall through...
  138.  
  139. Send_Hangup:
  140.     sendm %mdm_Prefix;
  141.     sendm %mdm_Hangup;
  142.     sendm %mdm_Suffix;
  143.     attempts = attempts + 1;
  144.  
  145.     wait
  146.         %mdm_Ack    goto Hangup_Complete,
  147.         %mdm_Failure    goto Hangup_Complete
  148.     until 15;
  149.  
  150.     if attempts = 2 goto Hangup_Complete;
  151.     goto Do_Local_Hangup;
  152.  
  153. Hangup_Direct:
  154.     sendm %BreakChar;
  155.     sendm %BreakChar;
  156.     sendm %BreakChar;
  157. Hangup_Complete:
  158.     Result = %Cancel;
  159.     if %LOCAL > 0  goto Exit_Script;
  160.     call %Dir & "last.scr" () : Result;
  161. Exit_Script:
  162.     define %LOCAL = 0;
  163.     exit Result;
  164.