home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / n / newscr.zip / NEWSCR.EXE / DISCONCT.SCR < prev    next >
Text File  |  1993-01-11  |  2KB  |  112 lines

  1. !------------------------------------------------------------!
  2. !     Disconnect Script:                                     !
  3. !                                                            !
  4. !     Handles all network/modem disconnections               !
  5. !     %LOCAL = 1 if hanging up while network script running  !
  6. !            = 2 if hanging up before connection             !
  7. !                                                            !
  8. !     $Revision::   1.15     $                               !
  9. !                                                            !
  10. !------------------------------------------------------------!
  11.  
  12. WaitTime = 10;
  13. attempts = 0;
  14.  
  15. ifndef %LOCAL = 0;
  16. if %LOCAL = 1 goto Do_Local_Hangup;
  17. if %LOCAL = 2 goto Send_Hangup;
  18.  
  19. CompuServe = 1;
  20. SprintNet = 2;
  21. CSIRnet = 16;
  22. Direct = 19;
  23.  
  24. if %Network = CompuServe goto Hangup_CIS;
  25. if %Network = Direct goto Hangup_Complete;
  26. if %Network = SprintNet goto Hangup_SprintNet;
  27. if %Network = CSIRnet goto Hangup_CSIRnet;
  28. goto Do_Local_Hangup;
  29.  
  30. Hangup_CIS:
  31.     Wait_Host = 80;
  32.  
  33. Start_Wait:
  34.     wait
  35.       "Host Name:" goto Send_Bye,
  36.       %mdm_Failure goto Hangup_Complete
  37.     until Wait_Host;
  38.     goto Do_Local_Hangup;
  39.  
  40. Send_Bye:
  41.     send "BYE^M";
  42.     goto Wait_NO_CARRIER;
  43.  
  44. Hangup_SprintNet:
  45.     show "Disconnecting from SprintNet";
  46.     wait
  47.       "disconnected" goto Send_Sprint_Hangup
  48.     until 60;
  49.     goto Do_Local_Hangup;
  50.  
  51. Send_Sprint_Hangup:
  52.     wait until 3;
  53.     send "HANGUP^M";
  54.     goto Wait_NO_CARRIER;
  55.  
  56. Hangup_CSIRnet:
  57.     show "Disconnecting from CSIR-Net";
  58.     wait until 40;
  59.     send "Z";
  60.  
  61. Wait_NO_CARRIER:
  62.     wait
  63.       %mdm_Failure goto Hangup_Complete
  64.     until 80;
  65.  
  66. Do_Local_Hangup:
  67.     wait until 2 * WaitTime;
  68.     sendm %mdm_EscapeCode;
  69.     wait until 2 * WaitTime;
  70.  
  71.     wait
  72.         %mdm_Ack goto End_Escape_Wait,
  73.         %mdm_Failure goto Hangup_Complete
  74.     until 10;
  75.  
  76. End_Escape_Wait:
  77.     wait until WaitTime;
  78.  
  79. Send_Hangup:
  80.     sendm %mdm_Prefix;
  81.     sendm %mdm_Hangup;
  82.     sendm %mdm_Suffix;
  83.     attempts = attempts + 1;
  84.  
  85.     wait
  86.         %mdm_Ack goto Small_Pause,
  87.         %mdm_Failure goto Small_Pause
  88.     until 15;
  89.  
  90.     if attempts = 2 goto Small_Pause;
  91.     goto Do_Local_Hangup;
  92.  
  93. Small_Pause:
  94.     wait until WaitTime;
  95.  
  96. Hangup_Complete:
  97.     Result = %Cancel;
  98.     if %LOCAL > 0  goto Exit_Script;
  99.     call %Dir & "last.scr" () : Result;
  100.  
  101. Exit_Script:
  102.     exit Result;
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.