Development :  K-Meleon Forum
K-Meleon development related discussions. 
How to update old macros for KM 1.1?
Posted by: ndebord
Date: May 25, 2007 12:50PM

Anybody care to try and explain to this old dog how to update old macros to the new system in plain english?

Tks

N

Options: ReplyQuote
Re: How to update old macros for KM 1.1?
Posted by: kko
Date: May 25, 2007 05:04PM

The main difference between the old and the new system is that the old macros.cfg was split into several kmm files. The old macros.cfg contained macros that implemented certain features (like groups, proxies and so on) and also contained the helper macros (the infrastructure) that were used by the feature macros.

The feature macros were moved to their own kmm files, the infrastructure is now all in main.kmm.

The best strategy to convert your old macros to the new system is to move your macros from macros.cfg into new kmm files (these are text files with extension kmm instead of txt, create them in your user macros directory in your profile dir). Start with a set of macros that implement a certain feature. Create a kmm file for them. When you now start km, you will very probably get error messages (macro so and so not defined). Most probably, the macro in question is and old helper macro (like XUL) that has a different name in the new macro system. Simply look into main.kmm to find the fitting substitute. The table of contents can be of help. Most probably you will need the macros in the sections "Opening URLs" and "Miscellaneous > Special Macro Execution" (at the very bottom of the file).

Always create one kmm file after the other and then debug it. When there are bugs in several kmm files, debugging is unnecessary complicated.

When you can't make it yourself, consider to post your code here. Otherwise it's hardly possible to say what's wrong. And your problems and their solution might be a good example for others who have similar problems! (No questions, no answers, no FAQ)

Options: ReplyQuote
Re: How to update old macros for KM 1.1?
Posted by: ndebord
Date: May 27, 2007 11:37AM

kko,

Let's start with one in wide use. Wackget, as an example to see how the new code works in practice. (Assumes Wackget is located in a sub-folder (tools) inside K-Meleon's main folder, which in my case is C:\program files\k-meleon

macros.cfg
wackget{
menu = "Download by wackget";
exec("tools\\Wackget.exe " . $LinkURL);
}

menus.cfg
macros(wackget, Download by wackget)

N

Options: ReplyQuote
Re: How to update old macros for KM 1.1?
Posted by: JujuLand
Date: May 27, 2007 09:11PM

Some explanations:

The path isn't initialized, it can be done by using 'SHIFT ALT W' shortkey
You have now a right-click menu entry to download a link with Wackget


Copy and paste this, and save it under macros folder with the name wackget.kmm:

# Top of kmm file -------------------------------------------------

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

# ---------- Wackget (An external download manager for K-Meleon) ----------------------------------------------------------
#
# Needed files : wackget.exe (in Tools folder for example)
# Dependencies :
# Resources : -
# Preferences :
# ------------------------------------------------------------------------------------------------------------------

# In case of manual install, registry keys can't be found and menu is grayed
# To Bypass it, just fill the content of this variable the example value adapted
# to your config
# Example :
# $_Wackget_Path="\"C:\\Program Files\\Wackget\\wackget.exe\" %1"
# You must restart K-Meleon to take the modifications
# You have a shortcut to modify this value:
# SHIFT+ALT+W

$_Wackget_Path="";
$_Wackget_CommandLine="";

# ---------- General -----------------------------------------------------------

Wackget_Path{
$ext="kmm"; &getExtensionHandler; exec(sub("%1","macros\\Wackget.kmm",$cmdline));
}

_Wackget_CommandLine{
$_Wackget_CommandLine=$_Wackget_Path;
}

# ----- MACROS

Wackget{
menugrayed=($_Wackget_CommandLine=="");
exec(sub("%1",$LINKURL,$_Wackget_CommandLine));
}

# ----- PRIVATE

_Wackget_BuildMenu{
# context menus
setmenu(LinkSave,macro,"Download with &Wackget",Wackget,ID_SAVE_LINK_AS);
# accel
setaccel("SHIFT ALT W","macros(Wackget_Path)");
}

#
$OnInit=$OnInit."_Wackget_CommandLine;"."_Wackget_BuildMenu;";
# ------------------------------------------------------------------------------------------------------------------
$macroModules=$macroModules."Wackget;";

# End of kmm file ---------------------------------------------------------------

For other language than english:

Copy and paste and save it under your locales\xx-yy folder with the name wackget.kml (modify the translation with your own language (here in french):

# LANGUAGE DEFINITION FILE

#--------------------------------------------------------
# Added by Wackget Extension (don't edit this comment)
#--------------------------------------------------------
Download with &Wackget=Télécharger avec &Wackget
#--------------------------------------------------------

A+


Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:31.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/75.0

Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr





Edited 2 time(s). Last edit at 05/27/2007 09:15PM by JujuLand.

Options: ReplyQuote
Re: How to update old macros for KM 1.1?
Posted by: ndebord
Date: May 27, 2007 09:37PM

Alain,

Thanks. A couple of questions for you. In KM 1.0.2, in the Tools subfolder, I have some additional files that Wackget requires:

WGBHO JS 142
WGDLL DLL 24576
WGET EXE 200704

Where in the new scheme of things do I place these? In Tools once again?

Much thanks

N



Edited 1 time(s). Last edit at 05/27/2007 10:10PM by ndebord.

Options: ReplyQuote
Re: How to update old macros for KM 1.1?
Posted by: JujuLand
Date: May 27, 2007 10:04PM

I have created Tools under K-Meleon root folder there is a long time, and I must say that at one moment, there were many files (too much), and it was difficult to remember which file goes with which other.

I now just use Tools for my tool Connexion, but it can be used by others.

If you want you can dispatch under subtools like Tools\Wackget, Tools\Connexion...

You the captain on your ship :-)

Do my macro works ? I suppose yes

I have added Wackget to K-Meleon Extension Setup. See on K-Meleon Extension Setup page.

On this page you can find some new macro files which can help you if needed.

A+


Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:31.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/75.0

Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr




Options: ReplyQuote
Re: How to update old macros for KM 1.1?
Posted by: JujuLand
Date: May 28, 2007 03:15AM

I have modified the macro:

1) It search for registry to locate the exe. I have used setup to install it, and I have found a key to locate it. If the key isn't found, SHIFT ALT W is always ok

2) As I tried another downloader (wxDownload), I put the downloader entries under a submenu named 'Download with'

The new version is on the Extension Setup page (with a setup for wxDownload)

A+


Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:31.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/75.0

Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr




Options: ReplyQuote
Re: How to update old macros for KM 1.1?
Posted by: Rapido
Date: May 28, 2007 08:15PM

Just make a backup of the old macro.cfg and menu.cfg and save theme somewhere safe.
Then i'ts safe to install K-M 1.1 and just copy your saved macros and menus or and search cfg's to profile folder and make sure that you have made backup of your pluginfolder aswell and put it in where your K-M exe is installed and then run K-M 1.1 and you should have all your macros and stuff working. It worked for me anyway.

Yours: Rapido

Options: ReplyQuote
Re: How to update old macros for KM 1.1?
Posted by: ndebord
Date: May 28, 2007 11:09PM

Rapido,

Are you saying that I can copy the old macro.cfg and menu.cfg files to the new profile folder and then use them as is?

Tks

N

Options: ReplyQuote
Re: How to update old macros for KM 1.1?
Posted by: Rapido
Date: May 29, 2007 01:38AM

Hi! ndebord! Yes you can and if you don't belive it just look at this thread: http://kmeleon.sourceforge.net/forum/read.php?3,71706,phorum_session_v5=fcd123ba92b40d7319ba85cd37dd5576

Yours: Rapido
Greetings from Sweden!

Options: ReplyQuote
Re: How to update old macros for KM 1.1?
Posted by: QT
Date: August 14, 2007 04:45AM

How to update reload image macro?
macros.cfg
ReloadImage {
$tmp=true; getpref(INT,$images)==2 ? &ImgToggle : $tmp=false;
$tmq=true; getpref(BOOL,"dom.disable_image_src_set") ? togglepref(BOOL,"dom.disable_image_src_set") : $tmq=false;
$JSfunc="";
$JSdoit="var t='".$ImageURL."',i=images;for(var j=0;j<i.length;j++)if(i[j].src==t){i[j].src="";i[j].src=t;}";
&hndlDocs;
$tmp ? &ImgToggle : "";
$tmq ? togglepref(BOOL,"dom.disable_image_src_set") : "";
}

menus.cfg
macros(ReloadImage, Reload Image)


Options: ReplyQuote


K-Meleon forum is powered by Phorum.