disconnect on exit (for dialup users)
Posted by: disrupted
Date: September 02, 2009 07:33PM

http://kmext.sourceforge.net/files/disconexit.7z

adds 2 menu entries: tools>disconnect and disconnect on exit
disconnect hangs up and sets k-meleon to offline mode to prevent it from initialising a connection when reading sites offline. disconnect on exit, runs a prompt when kmeleon is closed to hangup in 10 seconds the user can cancel the disconnection by clicking the abort button. disconnect on exit does not conflict with km download dialog/crash reporter or restart and restart super extensions(will not attempt to disconnect if you are restarting k-meleon)

the extension utilises a tiny cmdline tool which is iincluded





# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ----------disconnect on exit(dialup)------------------

$_tool_path=getfolder(RootFolder)."\\Tools";

checkdisconnector{
menuchecked=getpref(BOOL,"kmeleon.exitdisconnect.active");
togglepref(BOOL,"kmeleon.exitdisconnect.active");
$toggdisconnect=getpref(BOOL,"kmeleon.exitdisconnect.active");
$noactive=("false");
$toggdisconnect==$noactive?&statusfalse:&statustrue;
}

disconexit{
$dialdisconnector=getpref(BOOL,"kmeleon.exitdisconnect.active");
$isactive=("true");
$dialdisconnector==$isactive?&kmdisconnector:0;
}

statusfalse{
statusbar("disconnect on exit inactive");
}

statustrue{
statusbar("disconnect on exit active");
}


disconnectnow{
exec($_tool_path."\\dialdis\\dialdis.exe ");
id(ID_OFFLINE);
}

kmdisconnector{
$hangup=("disconnect");
exec($_tool_path."\\dialdis\\dialdis.exe " .$hangup);
}

_dialdisc_BuildMenu{
setmenu("&Tools",inline,dialdis,-1);
setmenu(dialdis,macro,"Disconnect ...",disconnectnow);
setmenu(dialdis,macro,"Disconnect On Exit",checkdisconnector);
}


$OnQuit=$OnQuit."disconexit;";
$OnInit=$OnInit."_dialdisc_BuildMenu;";
# --------------------------------------------------------------------
$macroModules=$macroModules."dialupdisconnector;";


; AutoIt Version: 3.3.0
; Language: English
; Platform: Win9x/NT
; Author: kargas
#include <GUIConstants E x.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#notrayicon

$disconnector=(@scriptdir & "\HANGUP.EXE")

If $cmdline[0]=0 then
run($disconnector, "", @SW_HIDE)
exit
else
isrestart()
endif

func isrestart()
if process e xists("restartkm.exe") then
exit
elseif process e xists("kmsuperexit.exe") then
exit
else
initdisconnect()
endif
endfunc


func initdisconnect()
Opt("GUIOnEventMode", 1)
$main = GUICreate("K-Meleon Disconnector", 268, 58, -1, -1, BitOR($WS_DLGFRAME, $WS_POPUP, $WS_EX_TOPMOST))
$Label1 = GUICtrlCreateLabel("K-Meleon will disconnect your modem in :", 12, 10, 240, 15)
$Label2 = GUICtrlCreateLabel("10", 12,30, 20, 15)
$Label3 = GUICtrlCreateLabel("seconds", 28,30, 40, 15)
$cancel= GUICtrlCreateButton("Abort", 180, 30, 80, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
GUICtrlSetOnEvent($cancel, "abort")
GUISetState(@SW_SHOW)
WinSetOnTop("K-Meleon Disconnector", "", 1)
While 1
Sleep(999)
GUICtrlSetData($Label2, "9")
Sleep(999)
GUICtrlSetData($Label2, "8")
Sleep(999)
GUICtrlSetData($Label2, "7")
Sleep(999)
GUICtrlSetData($Label2, "6")
Sleep(999)
GUICtrlSetData($Label2, "5")
Sleep(999)
GUICtrlSetData($Label2, "4")
Sleep(999)
GUICtrlSetData($Label2, "3")
Sleep(999)
GUICtrlSetData($Label2, "2")
Sleep(999)
GUICtrlSetData($Label2, "1")
sleep(88)
run($disconnector, "", @SW_HIDE)
exit
WEnd
endfunc

Func abort()
Exit
EndFunc



Re: disconnect on exit (for dialup users)
Posted by: panzer
Date: October 27, 2010 09:06AM

Can it be changed so it closes in 3 (or 5) seconds and not exactly 10?



Edited 1 time(s). Last edit at 10/27/2010 09:06AM by panzer.

K-Meleon forum is powered by Phorum.