home *** CD-ROM | disk | FTP | other *** search
/ PC Direkt 1995 #3 / PCD_395.iso / kommunik / wincim_d / disk1 / scripts.lib / DISCONCT.SCR < prev    next >
Encoding:
Text File  |  1994-04-14  |  2.9 KB  |  151 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. !  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.4.1"
  15. !-V
  16.  
  17. WaitTime = 10;
  18. attempts = 0;
  19.  
  20. CompuServe = 1;
  21. SprintNet = 2;
  22. CSIRnet = 16;
  23. Datex_J = 19;
  24. Direkt = 40;
  25.  
  26. DirectConnect = (%Network = Direkt) or (%DialType = 2);
  27.  
  28. ifndef %LOCAL = 0;
  29. if %LOCAL = 1 goto Do_Local_Hangup;
  30. if %LOCAL = 2 goto Send_Hangup;
  31.  
  32. if %Network = CompuServe goto Start_Wait;
  33. if %Network = Direkt goto Start_Wait;
  34. if %Network = Datex_J goto Hangup_Datex_J;
  35. if %Network = SprintNet goto Hangup_SprintNet;
  36. if %Network = CSIRnet goto Hangup_CSIRnet;
  37. goto Do_Local_Hangup;
  38.  
  39. Start_Wait:
  40.     wait
  41.         "Host Name:"    goto Send_Bye,
  42.         "User ID:"    goto Send_Host,
  43.         "UIC:"        goto Send_UIC,
  44.         %mdm_Failure    goto Hangup_Complete
  45.     until 80;
  46.     goto Do_Local_Hangup;
  47.  
  48. Send_Bye:
  49.     send "BYE^M";
  50.     if DirectConnect goto Hangup_Complete;
  51.     goto Wait_NO_CARRIER;
  52.  
  53. Send_Host:
  54.     send "/HOST^M";
  55.     goto Start_Wait;
  56.  
  57. Send_UIC:
  58.     send "^C";
  59.     wait until 30;
  60.     goto Start_Wait;
  61.  
  62. Hangup_SprintNet:
  63.     show "Verbindung mit SprintNet wird getrennt";
  64.     wait
  65.         "disconnected"  goto Send_Sprint_Hangup
  66.     until 60;
  67.     goto Do_Local_Hangup;
  68.  
  69. Send_Sprint_Hangup:
  70.     wait until 3;
  71.     send "HANGUP^M";
  72.     goto Wait_NO_CARRIER;
  73.  
  74. Hangup_CSIRnet:
  75.     show "Verbindung mit CSIR-Net wird getrennt";
  76.     wait until 40;
  77.     send "Z";
  78.     goto Wait_NO_CARRIER;
  79.  
  80. Hangup_Datex_J:
  81.     show "Verbindung mit Datex-J wird getrennt";
  82.     wait 
  83.         "Host Name:"    goto Send_OFF,  
  84.         "CLR"        goto Clear_PAD
  85.     until 100;
  86.     ! fall through...
  87.  
  88. Clear_PAD:
  89.     wait until 60;
  90.     send "*9#";
  91.     goto Wait_NO_CARRIER;
  92.  
  93. Send_OFF:
  94.     send "OFF" & %CR;
  95.     goto Hangup_Datex_J;
  96.  
  97. Wait_NO_CARRIER:
  98.     if DirectConnect goto Hangup_Complete;
  99.     wait
  100.         "BYE^M"        goto Hangup_Complete,
  101.         %mdm_Failure    goto Hangup_Complete
  102.     until 30;
  103.  
  104.     sendm %mdm_EscapeCode;
  105.  
  106.     wait
  107.         %mdm_Failure    goto Hangup_Complete,
  108.         %mdm_Ack    goto Send_Hangup
  109.     until 20;
  110.     ! fall through...
  111.  
  112. Do_Local_Hangup:
  113.     if DirectConnect goto Hangup_Direct;
  114.  
  115.     wait until 2 * WaitTime;
  116.     sendm %mdm_EscapeCode;
  117.  
  118.     wait
  119.         %mdm_Ack    goto End_Escape_Wait,
  120.         %mdm_Failure    goto Hangup_Complete
  121.     until 20;
  122.     goto Send_Hangup;
  123.  
  124. End_Escape_Wait:
  125.     wait until WaitTime;
  126.     ! fall through...
  127.  
  128. Send_Hangup:
  129.     sendm %mdm_Prefix;
  130.     sendm %mdm_Hangup;
  131.     sendm %mdm_Suffix;
  132.     attempts = attempts + 1;
  133.  
  134.     wait
  135.         %mdm_Ack    goto Hangup_Complete,
  136.         %mdm_Failure    goto Hangup_Complete
  137.     until 15;
  138.  
  139.     if attempts = 2 goto Hangup_Complete;
  140.     goto Do_Local_Hangup;
  141.  
  142. Hangup_Direct:
  143.     sendm "###";
  144. Hangup_Complete:
  145.     Result = %Cancel;
  146.     if %LOCAL > 0  goto Exit_Script;
  147.     call %Dir & "last.scr" () : Result;
  148. Exit_Script:
  149.     define %LOCAL = 0;
  150.     exit Result;
  151.