General :  K-Meleon Web Browser Forum
General discussion about K-Meleon. Questions about how to setup it, macro coding, all related to its usage and the project itself, including this website. 
km image converter
Posted by: disrupted
Date: September 02, 2009 08:41PM

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

converts an image directly to different formats from the context menu, supports gif, jpg, png, tif and bmp.. the converted image is opened in kmeleon. to view a converted tiff in km you will need a plugin like alternatiff available in kmext plugins page







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

# ----------km image converter----------

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

imageconvert{
id(ID_COPY_IMAGE_CONTENT);
exec($_tool_path."\\kmimgverter " .$ImageURL);
}

imgvert_BuildMenu{
setmenu(ImageSave,macro,"Image Convert",imageconvert);
}

$OnInit=$OnInit."imgvert_BuildMenu;";
# ----------------------------------------------------
$macroModules=$macroModules."image_converTOR;";



; AutoIt Version: 3.3.0
; Language: English
; Platform: Win9x/NT
; Author: yanni

#Include <ScreenCapture.au3>
#include <ClipBoard.au3>
#include <GUIConstants E x.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <ProgressConstants.au3>
#Include <String.au3>
#Include <File.au3>
#notrayicon

$hBmp = _ClipBoard_GetData($CF_BITMAP )


if $cmdline[0]=0 then
msgbox(64, "Error", "please run me from k-meleon's macro. ")
exit
else
goon()
endif


$getkmbinary1=stringtrimright(@scriptdir, 5)
$getkmbinary=($getkmbinary1 & "k-meleon.exe")

func goon()
If FileExists(@ScriptDir & "\kmimgverter.ini") Then
$path=IniRead(@ScriptDir & "\kmimgverter.ini", "vertpath", "1", "default")
else
$path=IniWrite(@ScriptDir & "\kmimgverter.ini", "vertpath", 1, @MyDocumentsDir)
endif
endfunc

$fucker=($cmdline[1])
$shitter=StringInStr($fucker, "/",0,-1)
$holycrap=StringTrimLeft ($fucker, $shitter)
$filenamepend1=StringTrimRight($holycrap, 4)
$filenamepend2=StringReplace($filenamepend1, " ", "-")
$filenamepend3=StringReplace($filenamepend1, "%20", "-")
$filename=StringReplace($filenamepend3, ".", "")


$imgvertmain = GUICreate("K-Meleon Image Converter", 369, 132, -1, -1, BitOR($WS_SYSMENU, $WS_EX_TOPMOST))
$pendlabel=("Select folder path for converted image: " & $holycrap)
$Label1 = GUICtrlCreateLabel($pendlabel, 10, 5, 362, 20)
$Label2 = GUICtrlCreateLabel("Select new image format", 10, 45, 192, 20)
$Radio_1 = GUICtrlCreateRadio("bmp", 10, 61, 40, 20)
$Radio_2 = GUICtrlCreateRadio("jpg", 60, 61, 40, 20)
$Radio_3 = GUICtrlCreateRadio("png", 110, 61, 42, 20)
$Radio_4 = GUICtrlCreateRadio("gif", 160, 61, 42, 20)
$Radio_5 = GUICtrlCreateRadio("tif", 210, 61, 42, 20)
$convertpath = GUICtrlCreateInput("", 10, 20, 255, 20)
$path=IniRead(@ScriptDir & "\kmimgverter.ini", "vertpath", "1", "default")
GUICtrlSetData($convertpath, $path)
$Button_b = GUICtrlCreateButton("Browse", 268, 20, 86, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$Button_3 = GUICtrlCreateButton("Convert && Save", 268, 44, 86, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))
$Button_c = GUICtrlCreateButton("Cancel", 268, 76,86, 20, BitOR($BS_FLAT, $WS_BORDER, $WS_EX_STATICEDGE))

GUICtrlSetState($Radio_1, $GUI_CHECKED)
GUISetState()
WinSetOnTop("K-Meleon Image Converter", "", 1)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Button_3
Select
Case GUICtrlRead($Radio_1) = $GUI_CHECKED
$path=IniRead(@ScriptDir & "\kmimgverter.ini", "vertpath", "1", "default")
;$hbmp = _ClipBoard_GetData($CF_BITMAP )
_ScreenCapture_SaveImage ($path & "\" & $filename & ".bmp", $hBmp)
$finalpath=($getkmbinary & " " & $path & "\" & $filename & ".bmp")
sleep(22)
run($finalpath)
ExitLoop
Case GUICtrlRead($Radio_2) = $GUI_CHECKED
$path=IniRead(@ScriptDir & "\kmimgverter.ini", "vertpath", "1", "default")
;$hbmp = _ClipBoard_GetData($CF_BITMAP )
_ScreenCapture_SaveImage ($path & "\" & $filename & ".jpg", $hBmp)
$finalpath=($getkmbinary & " " & $path & "\" & $filename & ".jpg")
sleep(22)
run($finalpath)
ExitLoop
Case GUICtrlRead($Radio_3) = $GUI_CHECKED
$path=IniRead(@ScriptDir & "\kmimgverter.ini", "vertpath", "1", "default")
;$hbmp = _ClipBoard_GetData($CF_BITMAP )
_ScreenCapture_SaveImage ($path & "\" & $filename & ".png", $hBmp)
$finalpath=($getkmbinary & " " & $path & "\" & $filename & ".png")
sleep(22)
run($finalpath)
ExitLoop
Case GUICtrlRead($Radio_4) = $GUI_CHECKED
$path=IniRead(@ScriptDir & "\kmimgverter.ini", "vertpath", "1", "default")
;$hbmp = _ClipBoard_GetData($CF_BITMAP )
_ScreenCapture_SaveImage ($path & "\" & $filename & ".gif", $hBmp)
$finalpath=($getkmbinary & " " & $path & "\" & $filename & ".gif")
sleep(22)
run($finalpath)
ExitLoop
Case GUICtrlRead($Radio_5) = $GUI_CHECKED
$path=IniRead(@ScriptDir & "\kmimgverter.ini", "vertpath", "1", "default")
;$hbmp = _ClipBoard_GetData($CF_BITMAP )
_ScreenCapture_SaveImage ($path & "\" & $filename & ".tif", $hBmp)
$finalpath=($getkmbinary & " " & $path & "\" & $filename & ".tif")
sleep(22)
run($finalpath)
ExitLoop
Endselect
Case $msg = $Button_b
$path = FileSelectFolder("Select folder for converted images:", "")
if @error then
;
else
GUICtrlSetData($convertpath, $path)
iniWrite(@ScriptDir & "\kmimgverter.ini", "vertpath", 1, $path)
endif
Case $msg = $Button_c
exit


Case $msg = $GUI_EVENT_CLOSE
exit
Endselect
WEnd





Options: ReplyQuote


K-Meleon forum is powered by Phorum.