Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: DUNDisconnect DUNConnect PlayWaveForm
[AutoDisconnect] NumApps=6 MaxWait=120 Sound=C:\WAVS\MEEPMEEP.WAV [Apps] 1=netscape.exe 2=exceed.exe 3=netdate.exe 4=ttermpro.exe 5=Agent.exe 6=ftpx.exe
; AutoDisconnect - keeps a list of WinSock apps, and closes DUN connection ; when none are loaded. Best called from DUNCE on connect. ; Released to the public domain by Rik Blok, 1997. WinTitle("","AutoDisconnect") ini = StrCat(DirGet(),"AutoDisconnect.ini") AddExtender("WWWSK34I.DLL") ; Internet extender App = "Dummy Value" While App != "" GoSub SearchForApp WinTitle("","AutoDisconnect") If App != "" WinHide("") AppWaitClose(App) WinShow("") EndIf EndWhile If DUNDisconnect(0) PlayWaveForm(IniReadPvt("AutoDisconnect","Sound","",ini), 0 | 2) Else Message("AutoDisconnect","Error: could not disconnect.") EndIf Exit :SearchForApp ; get # of registered apps (do it every time so can be updated while online) NumApps = IniReadPvt("AutoDisconnect","NumApps",0,ini) MaxWait = IniReadPvt("AutoDisconnect","MaxWait",60,ini) If MaxWait < 5*NumApps Then MaxWait = 5*NumApps ; allow 5 secs per app. ; quit if no entries Terminate(NumApps == 0, "AutoDisconnect","No applications registered.") ; cycle through them until found App = "" startTime= TimeYmdHms() i = 1 waited = 0 While (App == "") && (waited < MaxWait) WinTitle("",StrCat(MaxWait-waited,"s"," to Disconnect")) lookFor = IniReadPvt("Apps",i,"",ini) If AppExist(lookFor) Then App = lookFor i = i mod NumApps + 1 ; increment waited = TimeDiffSecs(TimeYmdHms(),startTime) ; disconnect immediately if activated If WinGetActive() == WinName() Then waited = MaxWait EndWhile Return
; SetupAutoDisconnect.wbt - registers applications with AutoDisconnect. title = "Setup AutoDisconnect" WinTitle(WinName(),title) dir = DirGet() exe = AskFileName(title,"C:\Program Files\","Executables|*.exe","",1) ; drop path exe = StrCat(FileRoot(exe),".",FileExtension(exe)) ; compare to list of applications (doesn't work yet) ini = StrCat(dir,"AutoDisconnect.ini") NumApps = IniReadPvt("AutoDisconnect","NumApps",0,ini) ; add to list NumApps = NumApps + 1 IniWritePvt("AutoDisconnect","NumApps",NumApps,ini) IniWritePvt("Apps",NumApps,exe,ini) Exit
Article ID: W12672
Filename: Automatically Disconnect from Internet.txt
File Created: 2001:03:01:15:05:34
Last Updated: 2001:03:01:15:05:34