Development :  K-Meleon Forum
K-Meleon development related discussions. 
Pages: 12Next
Current Page: 1 of 2
how to update old macros to kmm
Posted by: ndebord
Date: August 01, 2008 02:44AM

I have an extensive list of macros designed to work with KM 0.9 and KM 1.0xx.
Some are executables, some are search engines and some are just URLs that I
like to have listed under the Tools menu.

I know the old method of hand coding macros.cfg has been replaced by using
*.kmmm files. I vaguely recall that you could set up a "personal" kmm file of
some kind in which you can place your old stuff, but the details escape me or
perhaps the detailed step by step samples are somewhere I've not looked.

So for example for executables:

----------------

macros.cfg
AIM {
menu = "AIM";
exec("C:\\AIM\\AIM.EXE");
}

----------------

menus.cfg
-
macros(AIM)
-

------------------

accel.cfg
%ifplugin macros
ALT A = macros(AIM)
%endif

------------------

And for Search Engines:

macros.cfg

Scroogle{
&OldSearch; $search = "Scroogle";
$eng = "http://www.scroogle.org/cgi-bin/nbbw.cgi?Gw=";;
&SetSearch;
}

EngineSync{
setcheck("macros(Scroogle)", getpref(STRING, $sen) == "Scroogle" ? true:false);

--------------------

menus.cfg
macros(Scroogle)

-----------------------

And for URLs:

menus.cfg
macros(SportsYahoo)

---------------------

macros.cfg

Verizon{
menu = "Verizon";
#$site = "http://business.verizon.net/";;
$site = "https://www22.verizon.com/ForyourHome/Registration/Reg/Login.aspx";;
opennew($site);
}


Tks for listening,

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: JujuLand
Date: August 01, 2008 02:59AM

----------------

macros.cfg
AIM {
menu = "AIM";
exec("C:\\AIM\\AIM.EXE");
}

----------------

menus.cfg
-
macros(AIM)
-

------------------

accel.cfg
%ifplugin macros
ALT A = macros(AIM)
%endif

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

# ------------ AIM menu ----------------
#
# Dependencies :
# Resources : -
# Preferences : -
#
# -------------------------------------------------------

_AIM{
exec("C:\\AIM\\AIM.EXE");
}
# ----- PRIVATE

_AIM_BuildMenu{
setmenu("AIM",macro,"AIM",&_AIM,"&Tools");
setaccel("ALT A","macros(_AIM)");
}

$OnInit=$OnInit."_AIM_BuildMenu;";
# ----------------------------------------------------------
$macroModules=$macroModules."AIM;";


Really easier, just one file to touch, all the originals are modified, and it's also easier to disable with kmprefs.

It's a good beginning to do the others. The hardest is sometime to place the menu entries

smiling smiley

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 to kmm
Posted by: desga2
Date: August 01, 2008 06:21AM

Quote
ndebord
And for Search Engines:

You can add search engines easily in Advanced Preferences (F2) -> Browsing (section)-> Finding Websites (subsection) -> Search Engines (tab) -> Add... (button)
And after you can change an existing search engine or add it in Web Search (tab).

Quote
ndebord
And for URLs:
Is it not better to use bookmarks to URLs? (or more easy at least) smiling smiley

You can use this (works in 1.1.X and 1.5):

$OpenURL="https://www22.verizon.com/ForyourHome/Registration/Reg/Login.aspx";;
&OpenURL_InNew;

For menus you must use setmenu() function as Jujuland example.

Please, read Macro Documentation.

K-Meleon in Spanish



Edited 2 time(s). Last edit at 08/01/2008 06:22AM by desga2.

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: Fred
Date: August 01, 2008 07:50AM

I think, the biggest drawback for many is the UTF-8 language.

The post, that you remember was by me.
You can find it explained here, at the bottom of the page:

http://kmeleon.sourceforge.net/forum/read.php?1,76458,76549

But this method works only in K-Meleon 1.1.16, not anymore
as simply in K-Meleon 1.5 .

If you try it this way, because the new way is too
complicated, remember to create a new profile inside
the K-Meleon folder, possibly using a profile.ini,
containing just the words:

[profile]
path=profiles
IsRelative=1

inside your K-Meleon main folder, before the first start.
The files to adapt are /defaults/settings/menus.cfg and
accel.cfg inside the folder /defaults, before a profile
is being created.
Your macros.cfg has to be renamed to something.kmm and
put into the /macros folder, any name you want, that is
not yet present in the macros folder.
This is the easy way for the 1.1 versions.
Regards
Fred

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: kko
Date: August 01, 2008 05:12PM

@ndebord: Thank you for finally asking these questions! I think your examples are pretty good. This might be the beginning of a FAQ. I'll see what I can do...


Related (in regard to km 1.5): K-Meleon 1.1.6 and 1.5RC (JohnHell's post at the bottom of page 1 and the following post on page 2)


Also: In the meantime there are quite a lot of custom macros for 1.1/1.5 available in the MacroLibrary.


Quote
ndebord
So for example for executables:

----------------

macros.cfg
AIM {
menu = "AIM";
exec("C:\\AIM\\AIM.EXE");
}

----------------

menus.cfg
-
macros(AIM)
-

------------------

accel.cfg
%ifplugin macros
ALT A = macros(AIM)
%endif

------------------


First open "Edit" > "Configuration" > "User-Defined Macros". In case you get an error message that the folder is missing, open "Edit" > "Configuration" > "Profile Directory", create a new subfolder named "macros" and open it.

Create a new text file and rename it to "<whateverYouLike>.kmm". Not "<whateverYouLike>.kmm.txt"! Best choose an application (editor) for kmm files (K-Meleon Macro Modules), so that you can open these files with a double click.

In this case you may choose "AIM" or "Executables" as file name.

The code could look like this:

AIM{
exec("C:\\AIM\\AIM.EXE");
}

_AIM_BuildMenu{
setmenu("&Tools",macro,"AIM",AIM);
}
$OnInit=$OnInit."_AIM_BuildMenu;";

_AIM_SetAccels{
setaccel("ALT A","macros(AIM)");
}
$OnInit=$OnInit."_AIM_SetAccels;";

See also JujuLand's post.


The most difficult part is the setmenu() statement: setmenu("&Tools",macro,"AIM",AIM);

1. parameter: "&Tools" - that is the name of the menu where you want to add your macro. You may want to choose a different menu, for instance a submenu of the Tools menu (examine \K-Meleon\defaults\settings\menus.cfg to learn what menus exist by default). By default, your item is added at the bottom of the chosen menu. This can be influenced - a lot of things can be influenced, but that's maybe a bit too difficult for the beginning.
2. parameter: macro - this is always the same for macros, it just tells km that this menu item is meant to call a macro.
3. parameter: "AIM" - this is the menu label, the text that will be displayed in the menu. You can choose a different name or add an access key ("&AIM" means that you can select the menu item by pressing Alt+A).
4. parameter: AIM - that is the name of the macro that the menu item is meant to call.


Pay attention to the Macro Coding Guidelines!
Choose unique names for your macros and (global) variables to avoid conflicts with macros in other kmm files. This is even more important in km 1.5 since it allows to redefine macros (if there exist several macros with the same name, no error will be issued, instead the macro that is parsed (loaded) last will be used).



Edited 1 time(s). Last edit at 08/01/2008 05:15PM by kko.

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: kko
Date: August 01, 2008 05:13PM

Quote
ndebord
And for Search Engines:

macros.cfg

Scroogle{
&OldSearch; $search = "Scroogle";
$eng = "http://www.scroogle.org/cgi-bin/nbbw.cgi?Gw=";;
&SetSearch;
}

EngineSync{
setcheck("macros(Scroogle)", getpref(STRING, $sen) == "Scroogle" ? true:false);

--------------------

menus.cfg
macros(Scroogle)

-----------------------

See also desga2's post. If you just want to have a search engine in the "Web Search" menu, you don't need to write a macro for it. You just need to add it to your search engine database and select it for display in the menu:

1) Open "Tools" > "Web Search" > "Configure...".
2) Switch to tab "Search Engines". If the desired engine is not already listed there, add it. Press the "Add..." button, then enter a description ("Scroogle") and the URL ("http://www.scroogle.org/cgi-bin/nbbw.cgi?Gw=";), and press OK. Now the engine is stored in your search engine database (search.xml in your profile directory).
3) Switch to tab "Web Search". Choose your newly created engine in one of the existing combo-boxes or add a new one by pressing the "Add Entry" button (each of these combo-boxes represents a menu entry).

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: kko
Date: August 01, 2008 05:14PM

Quote
ndebord
And for URLs:

menus.cfg
macros(SportsYahoo)

---------------------

macros.cfg

Verizon{
menu = "Verizon";
#$site = "http://business.verizon.net/";;
$site = "https://www22.verizon.com/ForyourHome/Registration/Reg/Login.aspx";;
opennew($site);
}

See also desga2's post. It works basically the same as with executables:

Verizon{
$OpenURL="https://www22.verizon.com/ForyourHome/Registration/Reg/Login.aspx";;
&OpenURL_InNew;
#&OpenURL_InBg;
#&OpenURL_InNewWindow;
}

_Verizon_BuildMenu{
setmenu("&Tools",macro,"Verizon",Verizon);
}
$OnInit=$OnInit."_Verizon_BuildMenu;";



Edited 1 time(s). Last edit at 08/01/2008 05:15PM by kko.

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: kko
Date: August 01, 2008 05:20PM

Quote
Fred
I think, the biggest drawback for many is the UTF-8 language.

Macros should be written in plain English (then UTF-8 is the same as plain text) and should be translated through a kml file (you can write your own ones).


Quote
Fred
If you try it this way, because the new way is too
complicated, remember to create a new profile inside
the K-Meleon folder, possibly using a profile.ini,
containing just the words:

[profile]
path=profiles
IsRelative=1

inside your K-Meleon main folder, before the first start.

1) The way macros are working does not depend on the profile location.
2) You can create/delete profile.ini at any time.
3) An empty profile.ini is sufficient. (See ProfileLocation.)


Quote
Fred
The files to adapt are /defaults/settings/menus.cfg and
accel.cfg inside the folder /defaults, before a profile
is being created.

It is not recommended to modify the default configuration files - you will loose your modifications when upgrading to a new version. If you want to safe your time, take the time to do it the recommended way and perform your customizations in the configuration files located in your profile directory (they are all accessible through menu "Edit" > "Configuration"). If you do it the recommended way, you need to do it only once, otherwise you have to do it again and again...


Quote
Fred
Your macros.cfg has to be renamed to something.kmm...

Arrgh! Do you use a sledgehammer for driving screws?

Quote
Fred
...and
put into the /macros folder, any name you want, that is
not yet present in the macros folder.

Same as above. It is not recommended to add macros to the default macros folder ("Edit" > "Configuration" > "Macros") - you will loose them when upgrading to a new version. Add your macros to the user macros folder ("Edit" > "Configuration" > "User-Defined Macros").

Quote
Fred
This is the easy way for the 1.1 versions.

If that really worked for you in 1.1, then it's purely due to good luck. In 1.5 this will definitely break the macros apart.

Again, this is a sledgehammer method and a good example for how you should not do it.

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 01, 2008 11:44PM

Alain,

Please bear with me, as I am struggling with the new structure.

IF I understand you correctly, this is a replacement for what used to go into macros.cfg and now should be in a file called "aim.kmm" And so if I understand, you would have a series of files with the descriptive name followed by the .kmm extension?

And when you refer to a location, are you talking about menus.cfg? I would say under Tools, as that is the old location of choice (if memory serves) in earlier versions of KM.

As for the language itself, I will have to take some time to figure out the changes. That will come with time.

Much thanks,


# cut and paste =============================================

# ------------ AIM menu ----------------
#
# Dependencies :
# Resources : -
# Preferences : -
#
# -------------------------------------------------------

_AIM{
exec("C:\\AIM\\AIM.EXE");
}
# ----- PRIVATE

_AIM_BuildMenu{
setmenu("AIM",macro,"AIM",&_AIM,"&Tools");
setaccel("ALT A","macros(_AIM)");
}

$OnInit=$OnInit."_AIM_BuildMenu;";
# ----------------------------------------------------------
$macroModules=$macroModules."AIM;";

# end cut and paste ===================================================

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 01, 2008 11:50PM

desga2,

Pardon me about the search engine part of it. I use(d) the old search engine design in KM 0.9 and KM 1.0.2 which was changed in KM 1.1xxx, so included it in here as an example of the old ways.

I have somewheres around 90 search engines in the old Tools/Web Search Menu of KM 1.0.2xx

As for the bookmarks thing. IF Mozilla, aka Gecko, had a more robust Bookmarks manager, I would put everything there. Having a few choice URLS hard coded into KM's menu structure is faster and easier to use and more stable, not a small advantage to my mind.

The setmenu function is something I'll have to learn or at the very least, copy to fit my samples.

Much thanks,

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: Fred
Date: August 02, 2008 12:03AM

Of course your way is better and the correct one.
But if a person is deterred by just looking at the
new macro structures, and there is no place to get any
detailed information about handling it, they can at
least try to get a work-around suitable for their
earlier existing personal macros. I did not have any
other intention that showing such a possibility.
It's at least a way to let them try the newer versions,
which they otherwise possibly would not do at all.
As you know, this would anyhow only work for the 1.1.x ,
and not anymore for the upcoming 1.5 versions, which
makes it necessary to get accustomed with the new way
of adding personal macros sooner or later.

Fred

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 02, 2008 12:10AM

Fred,

Yes, the old post I was referring to was yours. I had forgotten that. I kept it
around without attribution in a "how to" text file for macro creation. I'll
make a notation that this no longer works in KM 1.5.

As for the profile I gather you are talking about using the standard single
user profile method used in newer KMs where you have a profile.ini file inside
the program folder for K-Meleon instead of a multi-user file in documents.

And the ???????.kmm files are kept in the /macros folder. Got it thanks.

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: Fred
Date: August 02, 2008 12:14AM

P.S.:
My proposal to create a profile inside the K-Meleon
main folder, using a profile.ini, was made to avoid meddling
around with an existing earlier profile, which would
cause a dialog asking to delete or relocate the earlier
menus.cfg inside the earlier profile.

Fred

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 02, 2008 03:02AM

Fred,

This is what I have in KM 1.5RC's profile.ini located in c:\program files\k-meleon:

[Profile]
path=Profiles
isrelative=1

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: JamesD
Date: August 02, 2008 03:07AM

@ ndebord

This is one way of having a group of personal macro items in one file and have it show up in the TOOLS menu. For each personal item you would just add one line of type "setmenu" and perhaps one of type "setaccel" together with the macro module that you wish to execute. The advantage of this is that the one file "MyPersonal.kmm" is all you have to keep up. You can copy it to the user personal macro folder of any profile. You can use, or not, separator lines to set off items by type or use.

I try not to change any of the default macro and cfg files because they are replaced when I load a new version. The exception to this is toolbars.cfg.

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#  
# ---------- MyPersonal.kmm
# ---------- K-Meleon Macro Language Personal Macros ---------------
#
# Dependencies        : main.kmm 
# Resources           : - 
# Preferences         : -
# Version             :  0.5   2008-08-01
# --------------------------------------------------------------------------------

_AIM{
exec("C:\\AIM\\AIM.EXE");
}
_Verizon{
$OpenURL="https://www22.verizon.com/ForyourHome/Registration/Reg/Login.aspx";;
&OpenURL_InNew;
#&OpenURL_InBg;
#&OpenURL_InNewWindow;
}
_MyPersonal_ModMenu{
$_MyPersonal_Popm = "My Personal";
setmenu("&Tools",popup,$_MyPersonal_Popm,Misc);
setmenu($_MyPersonal_Popm,macro,"AIM",_AIM);
setmenu($_MyPersonal_Popm,macro,"Verizon",_Verizon);
setmenu($_MyPersonal_Popm,separator,1);
&_MyPersonal_Setaccel;
}
_MyPersonal_Setaccel{
setaccel("ALT A","macros(_AIM)");
}
$OnInit=$OnInit."_MyPersonal_ModMenu;";
$macroModules=$macroModules."MyPersonal;";


Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 02, 2008 03:08AM

kko,


A faq would be a superb addition. I'm admittedly slow at this, but with time and more posts, I'm sure I'll be able to make the transition. I made up an AIM.KMM file using yours and Alain's sample. I'll wait a bit before figuring out where to add the tools thing in menus.cfg.

Much thanks.

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: JujuLand
Date: August 02, 2008 03:41AM

>Really easier, just one file to touch, all the originals are modified, and it's >also easier to disable with kmprefs.

it ought to be all the original aren't modified confused smiley

>The hardest is sometime to place the menu entries

I was refering about the difficult I have had sometimes to place the menu entries at the place I wanted.

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 to kmm
Posted by: ndebord
Date: August 02, 2008 05:32AM

kko,

Where are the two files located? One would be c:\program files\k-meleon\macros and this is the one you should NOT use for your macro kmm files?

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 02, 2008 05:34AM

James,

Help me out on this. Where exactly (in file manager) would you find:

<<the user personal macro folder of any profile>>

I see the c:\program files\k-meleon\macros sub-folder. Is the other created somehow in the profile ?????.slt sub-folder?

Tks

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: JamesD
Date: August 02, 2008 05:54AM

Try EDIT - CONFIGURATION - PROFILE DIRECTORY. When that opens one of the folders that you see is MACROS. That is the user's personal macro folder. In my case that is C:\Program Files\k-meleon15b2\Profiles\tufvx7du.default. So the full path to my macro folder is C:\Program Files\k-meleon15b2\Profiles\tufvx7du.default\macros. I always keep my profile within KM. Before I run a new KM I make sure there is a file called profile.ini in C:\Program Files\k-meleon15b2 or whatever folder you place your KM. Profile.ini is just an empty file. Just make sure not to make it Profile.ini.txt. Save it as "all files". If you don't keep your profile within KM, it will be located in DOCUMENTS AND SETTINGS\KMELEON, I think. EDIT - CONFIGURATION - PROFILE DIRECTORY will find it for you.

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: desga2
Date: August 02, 2008 05:56AM

@ ndebord:
Go to Edit -> Configuration -> User-Defined Macros

Or in Explorer go to C:\K-Meleon\Profiles\default\????????.slt\macros

Copy your macro files in this folder.

K-Meleon in Spanish

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: JamesD
Date: August 02, 2008 05:59AM

degas2 beat me to it. I was just about to point you the FAQ on this subject. http://kmeleon.sourceforge.net/wiki/FAQ#macros

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 02, 2008 06:15AM

Hmmm. Aside. How is it that we went from ????????.slt to ????????.default? The 8.3 convention is no longer used by Gecko?

(I ask as it has been my practice to hex edit the slt file to get a common name for my km that I use on a couple of computers.)

I see:

[Profile0]
Name=default
Path=ted4yokj.default
IsRelative=1
Default=1
[General]
StartWithLastProfile=1

And I wonder if you can edit this with notepad and that will change the name of the default sub-folder also?

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 02, 2008 06:43AM

Let me apologize to everyone here who is trying to help me understand the new macro language in KM 1.5. My method is pure trial and error. So as I read your various posts, I try to do what is suggested.

James,

Now I have mypersonal drop down dialog box under Tools and therein I have both AIM and Verizon (the URL example) working just fine. Nice. More playing to be done here now.

<VBG>

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 02, 2008 06:46PM

desag2,

<<Or in Explorer go to C:\K-Meleon\Profiles\default\????????.slt\macros>>

I no longer see an SLT sub-folder anywhere. Is this because I used the single user, in the program folder setup?

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 02, 2008 06:48PM

Alain,

<<I was refering about the difficult I have had sometimes to place the menu entries at the place I wanted.>>

Yes, I see how that could be a problem. I'm using James solution for now, but I too would like to be able to move stuff around. Perhaps on the main level, not have to drop down to a "sub-dialog" box (for lack of a better word) location.

Tks

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: JamesD
Date: August 02, 2008 09:55PM

@ ndebord

After a whole bunch of trial and error, I found that the "menu" name to put in the setmenu statement can be found in k-meleon\defaults\settings in a file called menus.cfg. For me that is C:\Program Files\k-meleon15b2\defaults\settings\menus.cfg.

If you are looking to use one of the menu items already on the main menu remember that the underscore such as in Tools will be spelled &Tools in that file. All the standard KM menus are described in that menus.cfg file. Note, do not change that file, just read it for information.

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: desga2
Date: August 02, 2008 10:47PM

@ JamesD:
Quote
JamesD
After a whole bunch of trial and error..
Why don't you ask us about this before?
I thought that you know it.

K-Meleon in Spanish

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: ndebord
Date: August 02, 2008 11:18PM

James,

Much thanks. I feel that now I have a slightly better understanding of the new mechanism inside KM. I'll start (as time allows) porting over my stuff.

N

Options: ReplyQuote
Re: how to update old macros to kmm
Posted by: JamesD
Date: August 03, 2008 12:53AM

@ desga2

It is not recent trial and error. I suspect I did ask and was informed.

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


K-Meleon forum is powered by Phorum.