General :  K-Meleon Forum
General discussion about K-Meleon. 
Help with SetMenu macro statement
Posted by: James
Date: August 02, 2007 06:46AM

I am trying to modify a menu using the SetMenu statement of the macro language. Below is part of the code from my FavRenAdd.kmm file.


_FavRenAdd_ModMenu{
# add another option to Favorites menu
setmenu(Favorites,macro,"Rename-Add",_FavRenAdd_RenameAdd,-1);
}
$OnInit=$OnInit."_FavRenAdd_ModMenu;";

I am seeing no change in the Favorites menu. Can someone point out my mistake and get me headed in the right direction?

Thanks for any help.

Options: ReplyQuote
Re: Help with SetMenu macro statement
Posted by: JujuLand
Date: August 02, 2007 12:47PM

It's not possible.
The favorite menu is added to K-Meleon menus by the kplugin Favorites. It's the same with Hotlist and AdBlockPlus for example.

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: Help with SetMenu macro statement
Posted by: kko
Date: August 02, 2007 05:36PM

Quote
James
_FavRenAdd_ModMenu{
# add another option to Favorites menu
setmenu(Favorites,macro,"Rename-Add",_FavRenAdd_RenameAdd,-1);
}
$OnInit=$OnInit."_FavRenAdd_ModMenu;";

I am seeing no change in the Favorites menu. Can someone point out my mistake and get me headed in the right direction?

The favorites menu you want to add an item to is called F&avorites, not simply Favorites! The ampersand (&) in the menu name indicates that the letter following the ampersand is an access key for this item.

Tip: When you want to modify a default menu, first make sure how this menu is exactly called. The first place to look at is the default menus.cfg file which is placed in \K-Meleon\defaults\settings\ (Open Edit > Configuration > Macros and go up one directory level. Then navigate down to defaults\settings.)

Note: As Alain mentioned, the favorites plugin is writing into this menu. That for, you cannot do everything with the favorites menu that you can do with other menus:

1) Something like:

setmenu(F&avorites,macro,"Rename-Add",_FavRenAdd_RenameAdd,-1);

may not work as intended. Better specify a true position:

setmenu(F&avorites,macro,"Rename-Add",_FavRenAdd_RenameAdd,1);

2) The favorites menu does only exist when the favorites plugin is loaded. You should catch this case in order to avoid writing to a non-existant menu:

$kFavorites==true?setmenu(F&avorites,macro,"Rename-Add",_FavRenAdd_RenameAdd,1):0;

There are other global variables like $kFavorites for the other plugins. They're all defined in main.kmm.

Options: ReplyQuote
Re: Help with SetMenu macro statement
Posted by: James
Date: August 02, 2007 10:23PM

Many thanks, KKO. As someone who does not use shortcut keys, I just never thought of the amperstand. That part of my macro is working now. I am going now to check on the main.kmm to see if there are other useful things I might have missed. You were right about the position. I found that a 1 did much better than a -1.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.