General :  K-Meleon Forum
General discussion about K-Meleon. 
Pages: 12Next
Current Page: 1 of 2
kma service (experimental)
Posted by: disrupted
Date: May 12, 2009 12:06PM

kma= kmeleon web archive or kmeleon mafuka
http://kmeleon.swiftfree.net/files/kmaservice.7z

save in kma is similar in concept to mht.. but unlike using ie calls to save in mht, kma is pure kmeleon and the file is saved just as the website is viewed in kmeleon, also kma saves all files on the archived page regardless of the hrefs..so when you open a kma file, kmeleon will not attempt to fetch any missing files from the web, links of the webpage are preserved and you can still click on them.

i've tested with about 10 websites(including wildersecurity) and it worked fine..however more testing is required for different sites and different user input file names.

please note, to ensure the page is saved fully even on the slowest connection; there's a slight delay until the page and its files are finally compressed to kma.. just give it a few seconds.

package contains 3 files:
1-kmasave.exe : saves into kma and can only run from kmeleon macro
2-kmaread.exe : can run from kmeleon macro or from parameter passing kma file or directly without no parameters and will prompt the user for kma file.
3-kmaregister.exe(optional): registers kma extension to open with kmaread

access menu from k-meleon: file>kma web archive>save as kma|open kma|register kma files.

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

# ----------kma service(save/read kma k-meleon mafuka archives)

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

kmasave{
setpref(INT,"kmeleon.general.saveType",2);
$getdldir=getpref(STRING,"kmeleon.download.saveDir");
exec($_tool_path."\\kmaservice\\kmasave.exe \"".$getdldir."\"");
}

kmaread{
exec($_tool_path."\\kmaservice\\kmaread.exe "");
}

kmareg{
exec($_tool_path."\\kmaservice\\kmaregister.exe "");
}

kmaservice_BuildMenu{
setmenu("&File",inline,kmasrv_page,4);
setmenu(kmasrv_page,popup,"KMA Web Archive");
setmenu("KMA Web Archive",macro,"Save as KMA..",kmasave);
setmenu("KMA Web Archive",macro,"Open KMA File",kmaread);
setmenu("KMA Web Archive",separator,-1);
setmenu("KMA Web Archive",macro,"Register KMA files",kmareg);
}

$OnInit=$OnInit."kmaservice_BuildMenu;";
# --------------------------------------------------------------------
$macroModules=$macroModules."kmaservice;";



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

#NoTrayIcon
#Include <String.au3>
#Include <File.au3>

If $CmdLine[0]=0 Then
MsgBox(32, "User Error", "Save as kma(k-meleon WebArchive) can only run with its macro")
Else
pendkma()
EndIf

Func pendkma()
;$kompressor=(@ScriptDir & "\7z.exe")
$kmaname1=FileSaveDialog("Select KMA Path/name", @ScriptDir & "\webarchives", "K-meleon Web Archive (*.kma)", 2)
$kmaname2=($kmaname1 & "-" & @HOUR & "-" & @MIN & ".kma")
$7zKompdest=("""" & $kmaname2 & """")
$7zpath=(@ScriptDir & "\7zkma\7z.exe")
$pendname=("kmapend")
WinActivate("[CLASS:KMeleon Browser Window]")
Send("^s")
Sleep(40)
Send($pendname)
Sleep(80)
Send("{ENTER}")
sleep(28000)

;"I:\program files\autoIT\scriptsplus\pendKM-kma\7zxpi\7z.exe" a -tzip H:\applications2\7-Zip\pend.kma "E:\BRIEFC~2\HE-PEN~1\kmapender\*" -r (parameter reference)
$initialsave=$CmdLine[1]
DirCreate($CmdLine[1] &"\kmapender")
sleep(2000)
$pendkma1=($CmdLine[1] &"\kmapender")
$pendkmaindex=($pendkma1 & "\index.htm")
$kmaindex=($CmdLine[1] &"\kmapend.htm")
$kmadir=($CmdLine[1] &"\kmapend_files")
FileMove($kmaindex, $pendkmaindex, 8)
DirMove($kmadir, $pendkma1,1)
sleep(80)

sleep(3888)
$7zparm1=(" " & """" & $pendkma1 & "\*" & """" & " " & "-r")
$7zparm2=(" a -tzip ")
$7zallparms=($7zparm2 & $7zKompdest & $7zparm1)
$pendkomprun=($7zpath & $7zallparms)
run($pendkomprun, "", @SW_HIDE)
;MsgBox(4096, "Test", $pendkomprun)

ProcessWait("7z.exe")
sleep(1488)
DirRemove($pendkma1,1)
exit
EndFunc



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

#NoTrayIcon
#Include <String.au3>
#Include <File.au3>

If $CmdLine[0]=0 Then
$kmapath=FileOpenDialog("Select KMA file", @ScriptDir & "\webarchives", "K-meleon Web Archive (*.kma)", 1)
checker()
Else
$kmapath=$CmdLine[1]
readkma()
EndIf

Func Checker()
$check=StringRegExp($kmapath, "(?i).kma")
if $check=0 Then
exit
Else
readkma()
EndIf
EndFunc

Func readkma()
$pend = (@TempDir & "\unkma")
DirRemove($pend,1)
sleep(400)
$7zpath=(@ScriptDir & "\7zkma\7z.exe")
$7pam1=("""" & $kmapath & """")
$7pam2=FileGetShortName($pend)
$7pam3=(" x " & $7pam1 & " -o" & $7pam2)
$7pam4=($7zpath & $7pam3)
;"I:\program files\autoIT\scriptsplus\pendKM-kma\7zkma\7z.exe" x I:\PROGRA~1\autoIT\SCRIPT~1\PENDKM~1\7zkma\shit.kma -oC:\Users\LEEDS\LOCALS~1\Temp\unkma (reference)
;MsgBox(4096, "Test", $7pam4)
run($7pam4, "", @SW_HIDE)
processwait("7z.exe")

$infind1 = ($pend & "\index.htm")
;MsgBox(4096, "Test", $inpath1, 10)
$getkm1=StringTrimRight(@scriptdir,16)
$getkm2=($getkm1 & "k-meleon.exe")
$checkkm=FileExists($getkm2)
If $checkkm=1 Then
$shortkma=FileGetShortName($infind1)
$view=($getkm2 & " " & $shortkma)
run($view)
Else
MsgBox(4096, "user fucking error", "cannot find k-meleon, make sure the kmaservice folder is saved in k-meleon\tools folder.", 10)
EndIf
;MsgBox(4096, "Test", $getkm2, 10)
;shellexecute($shortkma, "", "", default)
EndFunc



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

#NoTrayIcon
#Include <String.au3>
#Include <File.au3>

$getkm1=StringTrimRight(@scriptdir,16)
$getkm2=($getkm1 & "k-meleon.exe")
$checkkm=FileExists($getkm2)
If $checkkm=1 Then
registerkma()
Else
MsgBox(4096, "user fucking error", "cannot find k-meleon, make sure the kmaservice folder is saved in k-meleon\tools folder.", 10)
EndIf
exit

Func registerkma()
;MsgBox(4096, "thankyou", "good user.you have saved kmaservice in its proper folder", 10)
$kmaviewer=(@scriptdir & "\kmaread.exe")
$longpath=("""" & $kmaviewer & """")
$parm=($longpath & " " & """" & "%1" & """")
$icon=($longpath & ",0")
RegWrite("HKEY_CLASSES_ROOT\.kma", "", "REG_SZ", "kmafile")
RegWrite("HKEY_CLASSES_ROOT\.kma", "Content Type", "REG_SZ", "archive/x-compressed")
RegWrite("HKEY_CLASSES_ROOT\kmafile", "", "REG_SZ", "K-Meleon Compressed Archive")
RegWrite("HKEY_CLASSES_ROOT\kmafile\DefaultIcon", "", "REG_SZ", $icon)
RegWrite("HKEY_CLASSES_ROOT\kmafile\shell\open\command", "", "REG_SZ", $parm)
sleep(444)
MsgBox(64, "Registeration Complete", "KMA extension was registered successfully.")
EndFunc


Options: ReplyQuote
Re: kma service (experimental)
Posted by: foobarly
Date: May 12, 2009 05:30PM

I really appreciate your many contributions, honestly, but I think a little crtiticism is in order here. surprised smiley

I'm a heavy user of MS .mht files, since they translate into .eml just by renaming, which makes them almost universally viewable in all windows systems, where you'll generally have either MSIE or Outlook available (unfortunately, not so good for 'nixes).

What I'm getting at here is why should one commit to yet another fileformat, especially if it is application dependent? I'm talking about your new 'mafuka' format (great monniker, as always...).

There's already MimeHTML by MS, there's Mozilla Archive File Format (MAFF) with the corresponding MAF extension (see here for addon), and I know there are other more standard compliant options...

I mean, when I archive something from the web one of my main concerns is long term readability -- that's why I'm archiving it, in the first place. Why should one commit to a niche format? It's a clear case where broader currency is more important.

While I'm on this, let me plug the tiny CHReader (160KB upxed) for the same effect:

Quote

CHReader compresses a group of related web files (along with images, resources, etc...) to a single compressed archive (whose length can be up to 4GB) and let you browse it using your preferred web browser without decompressing it by acting as a dedicated web server on port 8078 of your machine. This way you can retrieve very large sites with web spiders and keep them in a compact form that can be readily viewed.
http://www.portablefreeware.com/?id=844

Just my 2 ¢...

EDIT: I was unaware that a debate on this was already ongoing on this thread...



Edited 3 time(s). Last edit at 05/12/2009 05:41PM by foobarly.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: soccerfan
Date: May 12, 2009 08:02PM

@disrupted:
Just a couple of quick questions before I try it:
I notice 3 shortcuts (to 7z.exe etc) and a folder 7zkma under tools/kmaservice.
Is this folder required?
Also, should I keep the same folder structure (my guess: yes).

As for foobarly, he's welcome to use the mht format using ie/opera.
I will not use ie, so I need a km alternative. Perhaps others do too!

EDIT: [Open KMA File] gives this error: Unmached left parenthesis '('.

soccerfan



Edited 1 time(s). Last edit at 05/12/2009 08:14PM by soccerfan.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted
Date: May 12, 2009 10:01PM

foo i like mht as well..but the reasons behind kma mafuka grinning smiley is because mht doesn't prove very reliable even when you try saving from ie..it doesn't really package everything and the other reason is because it uses trident..sometimes the pages can be saved in bad layouts.. i tried maf but i couldn't make it work on ff.. kma is similar to maf..they both use zip compression..the main difference is the extension and in theory kma can be opened on any browser..i don't want to give it a maf extension because i 'm not entirely sure if it's 100% compatible..if i give it a regular extension, users would expect it to open normally in any supporting browser..this isn't guaranteed(atleast for now).

soccer, that's very strange cause all my parenthesis are matched..i looked everywhere in the script..are you getting the same error with kmaregister? cause if you are that will help understand where the bug is.

all files and their directory structure are required except for these:
1- src folder
2- couple of shortcuts to 7z i was testing parameters with..those can be removed but don't delete 7z.exe itself.

try this kmaread..i removed some lines that might be the cause for that error:
http://kmeleon.holaservers.com/disrupted/kmaread-test.zip

extract kma read in the kmaservice folder and overwrite previous kmaread.exealso make sure the folder is in it's proper path k-meleon\tools\kmaservice

Options: ReplyQuote
Re: kma service (experimental)
Posted by: foobarly
Date: May 12, 2009 11:36PM

Quote
disrupted
foo i like mht as well... but the reasons behind kma mafuka grinning smiley is because mht doesn't prove very reliable even when you try saving from ie..it doesn't really package everything and the other reason is because it uses trident..sometimes the pages can be saved in bad layouts.. i tried maf but i couldn't make it work on ff.. kma is similar to maf..they both use zip compression..the main difference is the extension and in theory kma can be opened on any browser..i don't want to give it a maf extension because i 'm not entirely sure if it's 100% compatible..if i give it a regular extension, users would expect it to open normally in any supporting browser..this isn't guaranteed(atleast for now).
[...]

Fair enough... I'll consider it experimental, then. Let me just stress that I wasn't trying to defend MimeHTML, much the contrary. In fact, I rather prefer plain HTML, hence my plug for the CHReader that I use whenever I can. But most of the times, be it for convenience or for lack of alternatives, it has to be .mht; and trust me, I know how unreliable (and how hopelessly tangled'n'twisted codewise) it can be. sad smiley

Ditto for Soccerfan. smiling smiley



Edited 1 time(s). Last edit at 05/12/2009 11:37PM by foobarly.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: soccerfan
Date: May 13, 2009 01:41AM

Quote
disrupted
soccer, that's very strange cause all my parenthesis are matched..i looked everywhere in the script..are you getting the same error with kmaregister? cause if you are that will help understand where the bug is.

I get the unmatched left parenthesis error for both 'read' and 'register'. No problems with 'save'.

Quote

try this kmaread..i removed some lines that might be the cause for that error:
http://kmeleon.holaservers.com/disrupted/kmaread-test.zip

extract kma read in the kmaservice folder and overwrite previous kmaread.exealso make sure the folder is in it's proper path k-meleon\tools\kmaservice

Sorry, same errors as above (reminder: I'm on kmeleon 1.1.3)

soccerfan

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted(unlogged)
Date: May 13, 2009 02:18AM

sorry..that was my mistake..the problem is in the macro not autoit.. i forgot a double quote but 1.5.x macro engine is more forgiving so i enver found out.. i updated the corrected macro in the same package or you can just download the macro and save in macros folder:
http://kmeleon.swiftfree.net/macros/kmaservice.kmm

i hope it will work now..please

remeber you can run kmaregister.exe without the macro by just double clicking on it.. i checked the kma extension and it's not registered to any major program so registering it shouldn't cause any conflicts.

once the kma is registered you can open a kma file by double clicking on it as well as opening it from kmeleon menu.

i hope it works fine this time.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: soccerfan
Date: May 13, 2009 02:29AM

Quote
disrupted(unlogged)
i hope it will work now..please...
i hope it works fine this time.

Voila, it works!! Tested a couple of websites and no problems so far.
Hope others can give it a run too. Many thanks disrupted.

soccerfan

Options: ReplyQuote
Re: kma service (experimental)
Posted by: soccerfan
Date: May 13, 2009 04:13AM

Quick followup.
I tried it at home and even though there are no errors,
I find that the saved kma files are only 1kB. Somehow,
the other files are not being assimilated. Path related?

And, upon trying to open one of your archived kma files, I got this error:
The file /C:/DOCUME~1/Owner/LOCALS~1/Temp/unkma/index.htm cannot be found. 
Please check the location and try again.

Trying it again opened it fine.

soccerfan

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted(unlogged)
Date: May 13, 2009 04:18AM

smiling smiley glad it worked.. so far i've saved about 30 sites without any problems. i don't think i'll use mht again..kma is better even though it's a mafuka zip .. but hey, it works and sites ofcourse are rendered exactly as they should be and file size is smaller than mht yet it contains all the site images etc... if there's enough demand, maybe i will write a script to make kma files open in ie from a second command in the contextmenu(view in ie)..this way it becomes more universal and not application-specific..but for now, i think it's better to keep it a kmeleon exclusive

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted(unlogged)
Date: May 13, 2009 04:22AM

oh ok..that's not a big problem.. the kmareader sent the page too fast before the file was fully unkmaed.. i'll add more sleep before launching kmeleon..this should fix it

p.s. very fast pc at home?

Options: ReplyQuote
Re: kma service (experimental)
Posted by: soccerfan
Date: May 13, 2009 04:43AM

Quote
disrupted(unlogged)
oh ok..that's not a big problem.. the kmareader sent the page too fast before the file was fully unkmaed.. i'll add more sleep before launching kmeleon..this should fix it

p.s. very fast pc at home?

The problem of my kma files being only 1kB remains sad smiley
Wonder if a similar problem prevents all the files being combined??

Home PC is 1.8GHz with XP SP1.

EDIT: I rebooted and can save and open kma files on my home PC.
I'm not sure what the problem was but I'll keep monitoring.

soccerfan



Edited 1 time(s). Last edit at 05/13/2009 04:58AM by soccerfan.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted(unlogged)
Date: May 13, 2009 05:02AM

it seems like it's not passing the parameter properly to 7z..could be related to folder path..where does kmeleon save files? when you right click on an image and you select save image..what is that path? also try testing by changing the kmeleon save path(not kma save path..this has no affect) see if it works when you change paths.

there's a weak link in kmasave..in that, it has to open save dialog (ctrl +s) first to kmeleon..if only kmeleon can accept a save parameter this would be a bliss.. but i've never seen a browser that accepts an external save command.. but kmeleon isn't just another browser..it's the browser that makes you a programmer.. maybe i'll add a feature request at least to save from macro directly without the dialog. anyway the problem of save dialog is 'save complete' which the script relies on kmeleon to do it first..ofcourse if the last time you've saved a file was html only..the next time you open the save dialog it will automatically select your last choice..there's noway for the script to find out what format was last selected by the user..so the macro initiates first by setting the save type to 2 (web complete).. it should work and i've tested it several times by first saving in html only or all files and then running kmasave and the macro would write the pref correctly for web complete..but any glitch can happen and save complete isn't selected when kmasave is initiated=big mess.
try this, save a page manually and make sure to select 'save complete' in the save dialog>type drop menu and click ok so the setting is registered in prefs..then try kmasave again..does it work?

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted(unlogged)
Date: May 13, 2009 05:05AM

it could have been the glitch i mentioned..kmeleon initiated to save as html only and kmasave couldn't find files..it's a weak link sad smiley try more testing and hopefully it won't happen again..i wonder if i put the setpref twice in the macro..would it have better emphasis grinning smiley

Options: ReplyQuote
Re: kma service (experimental)
Posted by: soccerfan
Date: May 13, 2009 08:22AM

Quote
disrupted(unlogged)
try this, save a page manually and make sure to select 'save complete' in the save dialog>type drop menu and click ok so the setting is registered in prefs..then try kmasave again..does it work?

This is what does work consistently. Thanks. I'm a happy camper.
Also, registering the kma extension works like a charm. Any way to undo it however?

And now, a request: It would be nice add a message box in your kmasave autoit
script saying 'kma file saved' once the operation completes. Something like:

MsgBox(0, "KMA INFO", "KMA file saved successfully.")

That way, we'd know when it is done, click 'ok', and know all is well.

soccerfan

Options: ReplyQuote
Re: kma service (experimental)
Posted by: caktus
Date: May 13, 2009 09:30AM

@ disrupted

Good show.smiling smiley I’ve been waiting for some one to take-on a project like this. Sounds better than waiting for “saved pages” to load while online at the same time….slowing on-line activities. I haven’t tried it out yet, but can it be made to work in concert with “File All Tabs” in the File menu?

BTW, regarding the “Save as type” i.e. HTML Only/HTML Complete, I sometimes wish I could get rid of the “HTML Only” option, permanently.

Also, when you mention “i've saved about 30 sites” are you referring to actually saving entire sites as with a web crawler?

Charlie

~~If it ain't broke, why screw it up?~~


Options: ReplyQuote
Re: kma service (experimental)
Posted by: panzer
Date: May 13, 2009 02:51PM

In our language ma fuka means he is just having s e x, that is all. grinning smiley

Good choice, Disrupted! grinning smiley

Options: ReplyQuote
Re: kma service (experimental)
Posted by: soccerfan
Date: May 13, 2009 08:22PM

OK disrupted, I modified the last few lines of kmasave.au3 to read:
DirRemove($pendkma1,1)
MsgBox(0, "KMA INFO", "KMA file saved successfully.") <-- added line
exit 

EndFunc
The message now shows up when the archive is saved. Perfect.

soccerfan

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted
Date: May 14, 2009 12:56AM

soccer, i liked your idea very much..so i added it in similar way that you did but also to check if the file was saved and if not will display a message "file failed to save mafuka!"





please note: while kma save is working, you can surf other pages/tabs..click on links etc as normal..the display is just to indicate it's still in progress but not to hold your browsing tll it has finished.

i also made a kmaregister update like you suggested..so now ift checks if the extension is already registered to kmareader..if not it asks if the user wants to unregister.







download from same link:
http://kmeleon.swiftfree.net/files/kmaservice.7z
(new sources included)

charlie..i don't think it's possible to integrate kmasave with save all tabs.. due to the nature of both kmasave and save all tabs.. they both call out kmeleon's save dialog..save all tabs waits for user input..where kmasave can't allow that..merging both functions together would add more variables to kmasave and since it's already too complicated for an additional function, this will probably end in failure..

panz..i think i want to learn slovenian grinning smiley

Options: ReplyQuote
Re: kma service (experimental)
Posted by: soccerfan
Date: May 14, 2009 02:27AM

@disrupted
Thanks for making it even better smiling smiley

Quote
disrupted
but i've never seen a browser that accepts an external save command.. but kmeleon isn't just another browser..it's the browser that makes you a programmer.. maybe i'll add a feature request at least to save from macro directly without the dialog.

I see you wasted no time in requesting this feature smiling smiley smiling smiley

soccerfan

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted
Date: May 14, 2009 05:12PM

update2 (macro and kmasave): http://kmeleon.swiftfree.net/files/kmaservice.7z

bug fixes:
- when kmeleon has no save folder set in prefs(like wih a new profile), kmasave proceeded to save, ending in failure. now kmsave will abort if no save folder exists.
- when kmeleon has a save folder set but that folder has been recently deleted, kmeleon will save in root folder while script will search in the path passed from the macro ending in failure. now, kmsave will create the folder first for kmeleon before initialising save.
- when cancel was pressed, kmasave still tried to save..now will abort as it should.

update:when kmeleon's save dialog is initiated(weak link)
- it's now set on top to prevent glitch of anything stealing focus.
- keyboard and mouse input are blocked to prevent user from interrupting save even for that split second..ensuring no user or system glitch may interfere.
- visual: for win 2000 and above, km save dialog is set to complete transparency while entering the file name so user doesn't see it.

new feature:kma save dialog includes name suggestion for practicality, the name suggestion is generated from the website's host name passed on from new macro.



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

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

If $CmdLine[0]=0 Then
MsgBox(48, "K-Meleon Mafuka: User Error", "Save as kma(k-meleon WebArchive) can only run with its macro. ")
Else
checkdir()
EndIf

Func checkdir()
$checkpath1=($CmdLine[1] & " ")
$checkpath2=StringIsSpace ($checkpath1)
If $checkpath2=1 Then
MsgBox(48, "K-Meleon Mafuka: Aborting", "K-meleon has no save directory set. Please set a save folder by saving a file or image first and try again.")
Else
pendkma()
EndIf
EndFunc

Func pendkma()
DirCreate($CmdLine[1] &"\kmapender")
$kompressor=(@ScriptDir & "\7z.exe")
$namesug1=StringReplace($CmdLine[2], "www2.", "")
$namesug2=StringReplace($namesug1, "www.", "")
$namesug3=StringReplace($namesug2, ".com", "")
$namesug4=StringReplace($namesug3, ".co.uk", "")
$namesug5=StringReplace($namesug4, ".edu", "")
$namesug6=StringReplace($namesug5, ".org", "")
$namesug7=StringReplace($namesug6, ".net", "")
$namesug8=StringReplace($namesug7, ".tv", "")
$namesug9=StringReplace($namesug8, ".uk", "")
$namesug10=StringReplace($namesug9, ".gr", "")
$namesug11=StringReplace($namesug10, ".ru", "")
$namesug12=StringReplace($namesug11, ".de", "")
$namesug13=StringReplace($namesug12, ".fr", "")
$kmaname1=FileSaveDialog("Select KMA Path/name", @ScriptDir & "\webarchives", "K-meleon Web Archive (*.kma)", 2, $namesug13)
If @error Then
DirRemove($CmdLine[1] &"\kmapender")
Exit
Else
$kmaname2=($kmaname1 & "-" & @HOUR & "-" & @MIN & ".kma")
$7zKompdest=("""" & $kmaname2 & """")
$7zpath=(@ScriptDir & "\7zkma\7z.exe")
$pendname=("kmapend")
WinActivate("[CLASS:KMeleon Browser Window]")
WinSetOnTop("[CLASS:KMeleon Browser Window]", "", 1)
BlockInput(1)
Send("^s")
WinWaitActive("Save As")
WinSetTrans("Save As", "", 0)
WinSetOnTop("[CLASS:KMeleon Browser Window]", "", 0)
WinSetOnTop("Save As", "", 1)
Sleep(40)
Send($pendname)
Sleep(80)
Send("{ENTER}")
sleep(60)
BlockInput(0)
sleep(1000)
$hold = GUICreate("make kma", 184, 28, -1, -1, BitOR($WS_DLGFRAME, $WS_POPUP, $WS_EX_TOPMOST))
$label = GUICtrlCreateLabel("Saving kma in progress..Bitte wait..", 15, 7, 210, 20)
GUISetState(@SW_SHOW)

While 1
WinSetOnTop("make kma", "", 1)
$msg = GUIGetMsg()
sleep(28000)
$initialsave=$CmdLine[1]
sleep(2000)
$pendkma1=($CmdLine[1] &"\kmapender")
$pendkmaindex=($pendkma1 & "\index.htm")
$kmaindex=($CmdLine[1] &"\kmapend.htm")
$kmadir=($CmdLine[1] &"\kmapend_files")
FileMove($kmaindex, $pendkmaindex, 8)
DirMove($kmadir, $pendkma1,1)
sleep(80)

sleep(3888)
$7zparm1=(" " & """" & $pendkma1 & "\*" & """" & " " & "-r")
$7zparm2=(" a -tzip ")
$7zallparms=($7zparm2 & $7zKompdest & $7zparm1)
$pendkomprun=($7zpath & $7zallparms)
run($pendkomprun, "", @SW_HIDE)
;MsgBox(4096, "Test", $pendkomprun)

ProcessWait("7z.exe")
sleep(1488)
DirRemove($pendkma1,1)
$checker=FileExists($kmaname2)
if $checker=1 Then
GUICtrlSetData ($label,"Kma Mafuka saved successfully.")
sleep(4000)
GUIDelete()
Else
GUICtrlSetData ($label,"Kma save failed.Please try again..")
sleep(4000)
GUIDelete()
EndIf
Return
WEnd
Exit
EndIf

EndFunc



Options: ReplyQuote
Re: kma service (experimental)
Posted by: soccerfan
Date: May 14, 2009 09:20PM

Works for me. Thanks.

soccerfan

Options: ReplyQuote
Re: kma service (experimental)
Posted by: barzel
Date: May 15, 2009 06:52PM

Nice effort indeed, but I keep getting the following error trying to save any page. This happen in k-m 1.5.3 running on win2k.
Thanks.



Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted
Date: May 16, 2009 12:59AM

it's hard to tell what's causing the problem from this error.. first make sure all kmasaervice files are in their proper folders because this seems like the script is missing a parameter or can't find 7z.exe

the kmaservice files should be saved like this
k-meleon\tools\kmaservice\kmasave.exe
and accompanying 7z should be in this folder
k-meleon\tools\kmaservice\7zkma\7z.exe

deleting any files or renaming the folders will cause errors.

if you're sure all files are in their proper folders, then we'll need to find out the exact script error..this cannot be done with kmasave.exe but with the source itself kmasave.au3

first download and install autoit3 from there
http://www.autoitscript.com/files/autoit3/autoit-v3-setup.exe
install autoit in any path you want

then download this macro, save it k-meleon\macros folder and replace the kmaservice.kmm with it (this macro calls the script for kmasave instead of the exe)
http://kmeleon.swiftfree.net/tests/kmaservice.kmm

and download the script kmasave.au3 and save it in k-meleon\tools\kmaservice folder
http://kmeleon.swiftfree.net/tests/kmasave.au3

restart kmeleon and select kma save
you will get a prompt to enter path for autoit, type in the path where you've installed autoit .

the macro will launch autoit with kmasave.au3 and
this time the error will display the exact line and function causing the problem.. post it here please. thanks


EDIT: if you're using a dialup connection; downloading autoit may be a bit of a hefty download just to test..then download this stripped down version of autoit with limited functions but just enough to execute kmasave.au3"
(580kb)

http://www.datafilehost.com/download-5a498ae2.html
extract autoit3tester.7z anywhere you want and enter the path in the macro prompt as above



Edited 1 time(s). Last edit at 05/16/2009 01:38AM by disrupted.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted
Date: May 16, 2009 02:12AM

kmaviewer:
http://kmeleon.swiftfree.net/files/kmaviewer.7z
enables viewing kma mafuka archives in internet explorer.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: barzel
Date: May 18, 2009 03:49PM

sorry for the late reply, I had the weekend off.
Anyway, this is my report:

installed autoit
replaced the kmaservice.kmm macro
placed the new autoit script in tools\kmaservice folder

When the "save as kma" command is invoked, after filling the path of autoit, the k-meleon window goes in foreground status and a "select kma path/name" window shows up in the taskbar. To reach said window I need to minimize the now "on top" k-meleon. After pressing the save button a default "save as" window come up, again reachable only minimizing the k-meleon window. If I press the save button that window close but I don't get nothing in the "webarchives" folder + no error is reported by autoit. Task manager shows that autotit.exe is still running and keeps doing it until I kill it.

I'm no expert but something must be definitely wrong... I hope that my report, although quite confused, might be of help.
Thanks.


EDIT: I tried compiling kmasave.exe from the the script listed in the first post and replaced the newer one with it. Now saving as kma works!!!
I understand that this first version of the script is less refined than your last but for now this is better than nothing.
Of course, I still hope that the reported error can be caught.



Edited 2 time(s). Last edit at 05/18/2009 07:47PM by barzel.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted
Date: May 18, 2009 10:21PM

the latest kmaservice is the same as the first post because i've uploaded with same name..it\s possible you were using the older kmaservice which had few bugs and since when using the au3 script with autoit no script errors popped then it's more probable you were using the older kmasave.exe.

hope it all goes well from there and remember once you type the kma file name..no more user input is required and the script with automatically do the rest..just sit back and relax smiling smiley. also -as requested by foobarly and some of our russian comrades- there's a kmaviewer if you want to be able to open your kma files on other computers where kmeleon may not be available..this opens kma in ie.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: barzel
Date: May 18, 2009 11:35PM

What I meant was that I compiled the kmasave source script posted in the first post, which doesn't have any window attribute command. Anyway, I found what the issue was: the script waits for a window named "Save as" but on my italian windows, despite the fact that my k-meleon is in english, said window is localized causing the script to wait indefinitely. After changing the title of the window the script waits for and compiling it all works as it should.

On a side note, I noticed that almost every time I open a kma archive in k-meleon, the browser shows a "File Not Found" error but a single reload brings up the page.
Adding a "sleep(400)" after the "processwait("7z.exe")" line in kmaread solved the issue for me. Maybe this can be of help to others.

Thanks for the assistance and sorry for the bother.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: disrupted
Date: May 19, 2009 12:32AM

no bother at all.. in fact thank you very much. this was a very dumb bug i didn't realise that save as dialog would indeed have a different title on non-english oses..i fixed it and now it no longer waits for save as.

this is very important fix for non-english oses:
http://kmeleon.swiftfree.net/files/kmaservice.7z

i also updated the kmaread by adding the extra sleep as you've said after processwait for 7z

same sleep was added aswell for the ie kmaviewer.
http://kmeleon.swiftfree.net/files/kmaviewer.7z

thanks again for testing and finding those bugs smiling smiley really appreciate it.

Options: ReplyQuote
Re: kma service (experimental)
Posted by: barzel
Date: May 19, 2009 03:38PM

Just a single word..... PERFECT!!!grinning smiley

EDIT: Now that I think of it, and at the cost of appearing a bit anal (maybe more than a bit), it seems to me that it would be better if the messages were displayed near the bottom right of the screen rather than at the center. What do others think of this?



Edited 1 time(s). Last edit at 05/19/2009 09:17PM by barzel.

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


K-Meleon forum is powered by Phorum.