k-meleon extension installer helper (KEIH)
Posted by: disrupted
Date: July 08, 2009 11:01PM

basically it extracts the 7z extension for you in k-meleon's root folder so you don't have to extract it yourself. also it makes it easier if you don't have 7z intalled or don't want to download it, keih includes basic 7z for the extraction routine at a much smaller size. keih can be launched directly and will prompt for extension, or from commandline-you can associate it with 7z and launch from context menu- and it can install the extension by simple drag and drop..but wait, there's more.. keih will also delete xpti.dat and compreg.dat in case of an extension that uses component files and need to be registered.

http://kmext.sourceforge.net/keih/KEIH.zip


extract keih.zip anywhere you like, to install an extension; simply double click on keih.exe (keih.exe is inside the keih folder you;ve just extracted)


the first time you run keih.exe, it will prompt for kmeleon's install path..just select the folder where kmeleon is installed..that path will be written in an ini file so you won't be asked for it everytime..however you can still change the path if you want frm keih's main interface.











associating 7z to keih:
open folder options>file types


register 7z or add a new command if 7z is already registered.
under 'new action" application to perform action: point to where keih.exe is installed






installing extension through drag and drop:





please note: the 7z folder included with keih is important for the extraction, do not delete it.


source:
; AutoIt Version: 3.3.0
; Language: blahblah
; Platform: Win9x/NT
; Author: yanni
; Script Function: kmeleon extension installer helper

#NoTrayIcon
#include <GUIConstantS E X.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <ProgressConstants.au3>
#Include <String.au3>
#Include <File.au3>
#Include <Array.au3>
$keih=("lazy bastards")

If FileExists(@ScriptDir & "\exthelper.ini") Then
$kmpath = IniRead(@ScriptDir & "\exthelper.ini", "kmeleon", "1", "default")
Else
$kmpath = FileSelectFolder("Select K-Meleon's Folder", "")
IniWrite(@ScriptDir & "\exthelper.ini", "kmeleon", 1, $kmpath)
EndIf

$deletable1 = ($kmpath & "\components\compreg.dat")
$deletable2 = ($kmpath & "\components\xpti.dat")
$kmbinary=($kmpath & "\k-meleon.exe")

if $CmdLine[0] = 0 Then
$extpath = FileOpenDialog("Select Extension", @WorkingDir & "", "K-Meleon Compressed Extensions (*.7z)", 1)
checker()
ElseIf $CmdLine[0] = 1 Then
$extpath = _PathFull($CmdLine[1])
checker()
EndIf

Func checker()
$checkfucker=StringRegExp($extpath, "(?i)7z")
if $checkfucker=0 Then
exit
Else
preinstall()
Endif
Endfunc


Func preinstall()
$shitter = GUICreate("K-Meleon Extension Installer Helper", 368, 158, -1, -1, BitOR($WS_SYSMENU, $WS_EX_TOPMOST))
$Label1 = GUICtrlCreateLabel("K-Meleon Install folder:", 10, 5, 182, 20)
$Label2 = GUICtrlCreateLabel("KEIH will install this extension:", 10, 50, 182, 20)
$Label3 = GUICtrlCreateLabel($extpath, 10, 65, 360, 20)
$Button_a= GUICtrlCreateButton("Install", 182, 100, 80, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$Button_b = GUICtrlCreateButton("Browse", 268, 20, 80, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$Button_x= GUICtrlCreateButton("Cancel", 268, 100,80, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$kmeleonpath = GUICtrlCreateInput("", 10, 20, 255, 20)
$kmpath = IniRead(@ScriptDir & "\exthelper.ini", "kmeleon", "1", "default")
GUICtrlSetData($kmeleonpath, $kmpath)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Button_a
sleep(44)
GUIDelete($shitter)
installshit()
Case $msg = $Button_b
$kmpath = FileSelectFolder("Select folder for captured pages:", "")
IniWrite(@ScriptDir & "\exthelper.ini", "kmeleon", 1, $kmpath)
GUICtrlSetData($kmeleonpath, $kmpath)
Case $msg = $Button_x
GUIDelete($shitter)
Return
exit
Case $msg = $GUI_EVENT_CLOSE
GUIDelete($shitter)
Return
exit
Endselect
WEnd
EndFunc

func installshit()
ProgressOn("KEIH: installing extension, please wait..", "initalising..", "0 percent", -1, -1, 16)
$kmbinary=($kmpath & "\k-meleon.exe")
ProgressSet(5, "6 percent", "extracting files")
$7zpath =(@ScriptDir & "\7z\7z.exe")
$pend = FileGetShortName($kmpath)
ProgressSet(15, "15 percent", "extracting..")
$pendparm1 = _StringInsert($pend, "-o", 0)
$pendparm2 = ($pendparm1 & " -y")
$pendparm3 = _StringInsert($pendparm2, " ", 0)
$pendparm7z=("""" & $extpath & """")
$extparm = ("x " & $pendparm7z)
ProgressSet(25, "25 percent", "extraction completed")
$overparm = ($extparm & $pendparm3)
$finalparam =($7zpath & " " & $overparm)
;shellexecute($7zpath, $overparm)
run($finalparam, "", @SW_HIDE)
ProgressSet(65, "65 percent", "extraction completed")
;MsgBox(4096, "Test", $finalparam)
ProgressSet(85, "85 percent", "registering components")
setkm()
ProgressSet(94, "94 percent", "finalising..")
firekm()
ProgressOff()
Winwaitactive("[CLASS:KMeleon Browser Window]", "")
sleep(888)
MsgBox(64, "K-Meleon Extension Installer Helper", "Extension was installed successfully. ")
exit
endfunc

Func setkm()
FileDelete($deletable1)
sleep(40)
FileDelete($deletable2)
endFunc

Func firekm()
While ProcesS E Xists("k-meleon.exe")
WinClose("[CLASS:KMeleon Browser Window]", "");
sleep(400);
If WinActive("K-Meleon") Then
Send("{Enter}")
EndIf
Wend
sleep(1400)
Run($kmbinary)
endFunc



Re: k-meleon extension installer helper (KEIH)
Posted by: ndebord
Date: July 08, 2009 11:31PM

Disrupted,

Sweet. Now I no longer have to run Power Archiver (My zip utility of choice) to load up K-Meleon extensions. Keith (as I have named it <gggg>) works like a charm. Used it for the first time to run the new and improved agent switcher, which also works like a charm.

Much thanks!

N



Edited 1 time(s). Last edit at 07/08/2009 11:31PM by ndebord.

Re: k-meleon extension installer helper (KEIH)
Posted by: desga2
Date: July 09, 2009 06:20AM

Great work disrupted!

K-Meleon in Spanish

Re: k-meleon extension installer helper (KEIH)
Posted by: disrupted
Date: July 09, 2009 06:08PM

thanks, glad it's working smiling smiley but i completely forgot about loader users.. made few updates so keith (turbo helper) now works if loader.exe is running..aslo few minor improvements to ensure it will only install in k-meleon's folder(looks for k-meleon.exe)

download from same link http://kmext.sourceforge.net/keih/KEIH.zip

new src
; AutoIt Version: 3.3.0
; Language: blahblah
; Platform: Win9x/NT
; Author: yanni
; Script Function: kmeleon extension installer helper

#NoTrayIcon
#include <GUIConstantS E X.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <ProgressConstants.au3>
#Include <String.au3>
#Include <File.au3>
#Include <Array.au3>

If FileExists(@ScriptDir & "\exthelper.ini") Then
$kmpath = IniRead(@ScriptDir & "\exthelper.ini", "kmeleon", "1", "default")
Else
$kmpath = FileSelectFolder("Select K-Meleon's Folder: (the path where K-Meleon is installed)", "")
IniWrite(@ScriptDir & "\exthelper.ini", "kmeleon", 1, $kmpath)
EndIf

$deletable1 = ($kmpath & "\components\compreg.dat")
$deletable2 = ($kmpath & "\components\xpti.dat")
$kmbinary=($kmpath & "\k-meleon.exe")

if $CmdLine[0] = 0 Then
$extpath = FileOpenDialog("Select Extension", @WorkingDir & "", "K-Meleon Compressed Extensions (*.7z)", 1)
checker()
ElseIf $CmdLine[0] = 1 Then
$extpath = _PathFull($CmdLine[1])
checker()
EndIf

Func checker()
$checkfucker=StringRegExp($extpath, "(?i)7z")
if $checkfucker=0 Then
exit
Else
preinstall()
Endif
Endfunc


Func preinstall()
$shitter = GUICreate("K-Meleon Extension Installer Helper", 368, 158, -1, -1, BitOR($WS_SYSMENU, $WS_EX_TOPMOST))
$Label1 = GUICtrlCreateLabel("K-Meleon Install folder:", 10, 5, 182, 20)
$Label2 = GUICtrlCreateLabel("KEIH will install this extension:", 10, 50, 182, 20)
$Label3 = GUICtrlCreateLabel($extpath, 10, 65, 360, 20)
$Label4= GUICtrlCreateLabel("( please note, K-Meleon will be restarted. )", 10, 80, 300, 20)
$Button_a= GUICtrlCreateButton("Install", 182, 100, 80, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$Button_b = GUICtrlCreateButton("Browse", 268, 20, 80, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$Button_x= GUICtrlCreateButton("Cancel", 268, 100,80, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$kmeleonpath = GUICtrlCreateInput("", 10, 20, 255, 20)
$kmpath = IniRead(@ScriptDir & "\exthelper.ini", "kmeleon", "1", "default")
GUICtrlSetData($kmeleonpath, $kmpath)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Button_a
sleep(44)
GUIDelete($shitter)
installshit()
Case $msg = $Button_b
$kmpath = FileSelectFolder("Select K-Meleon's Folder: (the path where K-Meleon is installed)", "")
$kmbinary2=($kmpath & "\k-meleon.exe")
If FileExists($kmbinary2) Then
IniWrite(@ScriptDir & "\exthelper.ini", "kmeleon", 1, $kmpath)
$kmeleonpath = GUICtrlCreateInput("", 10, 20, 255, 20)
GUICtrlSetData($kmeleonpath, $kmpath)
Else
MsgBox(48, "Error", "Invalid directory. Make sure to select K-Meleon's Install folder ")
Endif
Case $msg = $Button_x
GUIDelete($shitter)
Return
exit
Case $msg = $GUI_EVENT_CLOSE
GUIDelete($shitter)
Return
exit
Endselect
WEnd
EndFunc

func installshit()
$kmpath = IniRead(@ScriptDir & "\exthelper.ini", "kmeleon", "1", "default")
$kmbinary=($kmpath & "\k-meleon.exe")
If FileExists($kmbinary) Then
ProgressOn("KEIH: installing extension, please wait..", "initalising..", "0 percent", -1, -1, 16)
$kmbinary=($kmpath & "\k-meleon.exe")
ProgressSet(5, "6 percent", "extracting files")
$7zpath =(@ScriptDir & "\7z\7z.exe")
$pend = FileGetShortName($kmpath)
ProgressSet(15, "15 percent", "extracting..")
$pendparm1 = _StringInsert($pend, "-o", 0)
$pendparm2 = ($pendparm1 & " -y")
$pendparm3 = _StringInsert($pendparm2, " ", 0)
$pendparm7z=("""" & $extpath & """")
$extparm = ("x " & $pendparm7z)
ProgressSet(25, "25 percent", "extraction completed")
$overparm = ($extparm & $pendparm3)
$finalparam =($7zpath & " " & $overparm)
;shellexecute($7zpath, $overparm)
run($finalparam, "", @SW_HIDE)
ProgressSet(65, "65 percent", "extraction completed")
;MsgBox(4096, "Test", $finalparam)
ProgressSet(85, "85 percent", "registering components")
setkm()
ProgressSet(94, "94 percent", "finalising..")
checkloader()
ProgressOff()
Winwaitactive("[CLASS:KMeleon Browser Window]", "", 5)
sleep(888)
MsgBox(64, "K-Meleon Extension Installer Helper", "Extension was installed successfully. ")
exit
Else
MsgBox(48, "Error", "Invalid directory. Make sure to select K-Meleon's Install folder ")
Endif
endfunc

Func setkm()
FileDelete($deletable1)
sleep(40)
FileDelete($deletable2)
endFunc

Func checkloader()
if procesS E Xists("loader.exe") Then
fireloader()
else
firekm()
endIf
EndFunc

func fireloader()
$kmLoader=($kmpath & "\loader.exe")
ProcessClose("loader.exe")
sleep(20)
ProcessClose("k-meleon.exe")
sleep(88)
Run($kmbinary)
sleep(4888)
Run($kmLoader)
EndFunc

Func firekm()
While ProcesS E Xists("k-meleon.exe")
WinClose("[CLASS:KMeleon Browser Window]", "");
sleep(400);
If WinActive("K-Meleon") Then
Send("{Enter}")
EndIf
Wend
sleep(1400)
Run($kmbinary)
endFunc



Re: k-meleon extension installer helper (KEIH)
Posted by: disrupted
Date: July 09, 2009 08:55PM
Re: k-meleon extension installer turbo helper (KEITH)
Posted by: disrupted
Date: July 09, 2009 09:39PM

update: keith (turbo helper)
functions the same as keih(installing locally downloaded extensions) with addition of installing extensions online by automating download and extraction without interference from the user.

keith works from km macro.. just right click on a 7z extension link on approved kmeleon websites and select km extension

keih is still available for users who prefer regular keih(offline installer)
http://kmext.sourceforge.net/keih/KEIH.zip

users who prefer keith (turbo), there are 2 versions:

nt version(nt, 2000, xp, vista etc) http://kmext.sourceforge.net/keih/keithnt.7z
9x version(95, 98, me) http://kmext.sourceforge.net/keih/keith9x.7z









# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ----------keith: k-meleon extension installer turbo helper


$_keith_path=getfolder(RootFolder)."\\Tools\\keith";

keith{
menugrayed=(hostname($URL)=="");
exec($_keith_path."\\keith.exe " . $LinkURL);
}

keith_BuildMenu{
setmenu(LinkSave,inline,keith_pagina);
setmenu(keith_pagina,macro,"KM Extension",keith,1);
}

$OnInit=$OnInit."keith_BuildMenu;";
$macroModules=$macroModules."keith;";



; AutoIt Version: 3.3.0
; Language: blahblah
; Platform: Win9x/NT
; Author: yanni
; Script Function: kmeleon extension installer turbo helper (online/offline installer)

#NoTrayIcon
#include <GUIConstantS E X.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <ProgressConstants.au3>
#Include <String.au3>
#Include <File.au3>
#Include <Array.au3>

If FileExists(@ScriptDir & "\exthelper.ini") Then
$kmpath = IniRead(@ScriptDir & "\exthelper.ini", "kmeleon", "1", "default")
Else
$kmpath = FileSelectFolder("Select K-Meleon's Folder: (the path where K-Meleon is installed)", "")
IniWrite(@ScriptDir & "\exthelper.ini", "kmeleon", 1, $kmpath)
EndIf

$deletable1 = ($kmpath & "\components\compreg.dat")
$deletable2 = ($kmpath & "\components\xpti.dat")
$kmbinary=($kmpath & "\k-meleon.exe")

if $CmdLine[0] = 0 Then
$extpath = FileOpenDialog("Select Extension", @WorkingDir & "", "K-Meleon Compressed Extensions (*.7z)", 1)
checker()
ElseIf $CmdLine[0] = 1 Then
$extpath =$CmdLine[1]
extsite()
EndIf

Func extsite()
$onlinecheck=StringRegExp($extpath, "(?i)http://")
if $onlinecheck=1 Then
isvalid()
Else
checker()
Endif
Endfunc

Func isvalid()
$valid=StringRegExp($extpath, "(?i)http://kme")
if $valid=1 Then
onlinechecker()
Else
MsgBox(48, "KEITH Error", "Invalid website. K-Meleon extensions can only be downloaded from K-Meleon's extensions websites")
Endif
Endfunc

Func checker()
$checkfucker=StringRegExp($extpath, "(?i)7z")
if $checkfucker=0 Then
exit
Else
preinstall()
Endif
Endfunc

Func onlinechecker()
$checkfucker=StringRegExp($extpath, "(?i)7z")
if $checkfucker=0 Then
MsgBox(48, "KEITH Error", "Unrecognised extension format. aborting.")
Else
onlineinstaller()
Endif
Endfunc

Func preinstall()
$shitter = GUICreate("K-Meleon Extension Installer Helper", 368, 158, -1, -1, BitOR($WS_SYSMENU, $WS_EX_TOPMOST))
$Label1 = GUICtrlCreateLabel("K-Meleon Install folder:", 10, 5, 182, 20)
$Label2 = GUICtrlCreateLabel("KEIH will install this extension:", 10, 50, 182, 20)
$Label3 = GUICtrlCreateLabel($extpath, 10, 65, 360, 20)
$Label4= GUICtrlCreateLabel("( please note, K-Meleon will be restarted. )", 10, 80, 300, 20)
$Button_a= GUICtrlCreateButton("Install", 182, 100, 80, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$Button_b = GUICtrlCreateButton("Browse", 268, 20, 80, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$Button_x= GUICtrlCreateButton("Cancel", 268, 100,80, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$kmeleonpath = GUICtrlCreateInput("", 10, 20, 255, 20)
$kmpath = IniRead(@ScriptDir & "\exthelper.ini", "kmeleon", "1", "default")
GUICtrlSetData($kmeleonpath, $kmpath)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Button_a
sleep(44)
GUIDelete($shitter)
installshit()
Case $msg = $Button_b
$kmpath = FileSelectFolder("Select K-Meleon's Folder: (the path where K-Meleon is installed)", "")
$kmbinary2=($kmpath & "\k-meleon.exe")
If FileExists($kmbinary2) Then
IniWrite(@ScriptDir & "\exthelper.ini", "kmeleon", 1, $kmpath)
$kmeleonpath = GUICtrlCreateInput("", 10, 20, 255, 20)
GUICtrlSetData($kmeleonpath, $kmpath)
Else
MsgBox(48, "Error", "Invalid directory. Make sure to select K-Meleon's Install folder ")
Endif
Case $msg = $Button_x
GUIDelete($shitter)
Return
exit
Case $msg = $GUI_EVENT_CLOSE
GUIDelete($shitter)
Return
exit
Endselect
WEnd
EndFunc

func installshit()
$kmpath = IniRead(@ScriptDir & "\exthelper.ini", "kmeleon", "1", "default")
$kmbinary=($kmpath & "\k-meleon.exe")
If FileExists($kmbinary) Then
ProgressOn("KEIH: installing extension, please wait..", "initalising..", "0 percent", -1, -1, 16)
$kmbinary=($kmpath & "\k-meleon.exe")
ProgressSet(5, "6 percent", "extracting files")
$7zpath =(@ScriptDir & "\7z\7z.exe")
$pend = FileGetShortName($kmpath)
ProgressSet(15, "15 percent", "extracting..")
$pendparm1 = _StringInsert($pend, "-o", 0)
$pendparm2 = ($pendparm1 & " -y")
$pendparm3 = _StringInsert($pendparm2, " ", 0)
$pendparm7z=("""" & $extpath & """")
$extparm = ("x " & $pendparm7z)
ProgressSet(25, "25 percent", "extraction completed")
$overparm = ($extparm & $pendparm3)
$finalparam =($7zpath & " " & $overparm)
;shellexecute($7zpath, $overparm)
run($finalparam, "", @SW_HIDE)
ProgressSet(65, "65 percent", "extraction completed")
;MsgBox(4096, "Test", $finalparam)
ProgressSet(85, "85 percent", "registering components")
setkm()
ProgressSet(94, "94 percent", "finalising..")
checkloader()
ProgressOff()
Winwaitactive("[CLASS:KMeleon Browser Window]", "", 5)
sleep(888)
MsgBox(64, "K-Meleon Extension Installer Helper", "Extension was installed successfully. ")
exit
Else
MsgBox(48, "Error", "Invalid directory. Make sure to select K-Meleon's Install folder ")
Endif
endfunc

Func setkm()
FileDelete($deletable1)
sleep(40)
FileDelete($deletable2)
endFunc

Func checkloader()
if procesS E Xists("loader.exe") Then
fireloader()
else
firekm()
endIf
EndFunc

func fireloader()
$kmLoader=($kmpath & "\loader.exe")
ProcessClose("loader.exe")
sleep(20)
ProcessClose("k-meleon.exe")
sleep(88)
Run($kmbinary)
sleep(4888)
Run($kmLoader)
EndFunc

Func firekm()
While ProcesS E Xists("k-meleon.exe")
WinClose("[CLASS:KMeleon Browser Window]", "");
sleep(400);
If WinActive("K-Meleon") Then
Send("{Enter}")
EndIf
Wend
sleep(1400)
Run($kmbinary)
endFunc

Func onlineinstaller()
$penddownload=(@tempdir & "\kmextpend.7z")
$extdown = GUICreate("Ext download", 220, 32, -1, -1, BitOR($WS_DLGFRAME, $WS_POPUP, $WS_EX_TOPMOST))
$Label1 = GUICtrlCreateLabel("downloading extension. please wait...", 8, 8, 200, 15)
GUISetState(@SW_SHOW)
WinSetOnTop("Ext download", "", 1)
InetGet($CmdLine[1], $penddownload, 1, 0)
GUIdelete($extdown)
sleep(800)
$kmpath = IniRead(@ScriptDir & "\exthelper.ini", "kmeleon", "1", "default")
$kmbinary=($kmpath & "\k-meleon.exe")
If FileExists($kmbinary) Then
ProgressOn("KEIH: installing extension, please wait..", "initalising..", "0 percent", -1, -1, 16)
$kmbinary=($kmpath & "\k-meleon.exe")
ProgressSet(5, "6 percent", "extracting files")
$7zpath =(@ScriptDir & "\7z\7z.exe")
$pend = FileGetShortName($kmpath)
ProgressSet(15, "15 percent", "extracting..")
$pendparm1 = _StringInsert($pend, "-o", 0)
$pendparm2 = ($pendparm1 & " -y")
$pendparm3 = _StringInsert($pendparm2, " ", 0)
$pendparm7z=("""" & $penddownload & """")
$extparm = ("x " & $pendparm7z)
ProgressSet(25, "25 percent", "extraction..")
$overparm = ($extparm & $pendparm3)
$finalparam =($7zpath & " " & $overparm)
;shellexecute($7zpath, $overparm)
run($finalparam, "", @SW_HIDE)
ProgressSet(65, "65 percent", "extraction completed")
;MsgBox(4096, "Test", $finalparam)
ProgressSet(85, "85 percent", "registering components")
setkm()
ProgressSet(94, "94 percent", "finalising..")
checkloader()
ProgressOff()
Winwaitactive("[CLASS:KMeleon Browser Window]", "", 5)
sleep(888)
MsgBox(64, "K-Meleon Extension Installer Helper", "Extension was installed successfully. ")
exit
Else
MsgBox(48, "KEITH Error", "Invalid directory. Make sure to select K-Meleon's Install folder ")
Endif
EndFunc


K-Meleon forum is powered by Phorum.