General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Move item from a rt click submenu to main menu?
Posted by: Mello
Date: December 15, 2019 12:40AM

When I right click on a link which I want to send to Chromium browser I'd prefer to have Chromium appear directly in the main context menu rather than in the "Send Link To" submenu.

Is it possible to combine "Send Link To" function with submenu Chromium function?



Edited 1 time(s). Last edit at 12/15/2019 12:41AM by Mello.

Options: ReplyQuote
Re: Move item from a rt click submenu to main menu?
Posted by: JohnHell
Date: December 15, 2019 01:30AM

Of course you can, just add the macro that handles the open in Chromiun (that might be a stand-alone macro as I don't remember being shipped by default) to the LinkPopup (or LinkSave, as of sendto.kmm) menu by $OnSetup event.

Text to modify in orange; yellow options optional (where should appear, number or over entry):

macrotocreatethemenuentry{
	setmenu("LinkSave", macro, "menuentryname", "macrothathandlestheopeninchroumiun",[5,$_SendTo_Link]);
}

$OnSetup = $OnSetup."macrotocreatethemenuentry;";

setmenu in Macro Language Reference


You can make it easier if you just change the original setmenu in the chromiun macro, if you don't want it to appear anymore in the submenu.



Edited 4 time(s). Last edit at 12/16/2019 12:44AM by JohnHell.

Options: ReplyQuote
Re: Move item from a rt click submenu to main menu?
Posted by: siria
Date: December 15, 2019 02:04AM

Quote
Mello
When I right click on a link which I want to send to Chromium browser I'd prefer to have Chromium appear directly in the main context menu rather than in the "Send Link To" submenu.
Is it possible to combine "Send Link To" function with submenu Chromium function?

Several possibilities, menu lines can be created either
- by macros ("setmenu" lines in *.kmm files in macros folder)
- or in menus.cfg

Personally I'd look where that line is created in the original macro (in a kmm), and then just change the parent menu in that Chromium "setmenu" line.
Something like...
setmenu("LinkSave",macro,"Send to Chromium","SendToChromiumOrWhateverItsNamed",-1);

Or in menus.cfg in profile (but no position possible):
!LinkSave{
Send to Chromium=macros(SendToChromiumOrWhateverItsNamed)
}

Or edit KM/browser/defaults/settings/menus.cfg
BUT bad idea, those changes are lost again when updating KM, since that file gets overwritten.



Edited 1 time(s). Last edit at 12/15/2019 02:11AM by siria.

Options: ReplyQuote
Re: Move item from a rt click submenu to main menu?
Posted by: Mello
Date: December 15, 2019 08:03PM

Thanks both
I've played around a bit - can get menu entry moved easily but Chromium doesn't open.

Using macro as an example
macro is called chromium.kmm

Default link and menu entries inside are:

Quote

Chromium_OpenLink{
menugrayed=($Chromiumpath=="");
$Chromiumlinkurl=($Chromiumpath." ".$LinkURL);
exec($Chromiumlinkurl);
}

_Chromium_BuildMenu{
setmenu($_SendTo_Page,macro,"Chromium",Chromium_OpenPage);
setmenu($_SendTo_Link,macro,"Chromium",Chromium_OpenLink);
}



Edited 1 time(s). Last edit at 12/15/2019 08:03PM by Mello.

Options: ReplyQuote
Re: Move item from a rt click submenu to main menu?
Posted by: JohnHell
Date: December 15, 2019 08:12PM

If that is all the macro, is the path set in the variable elsewhere?

$Chromiumpath

My guess it is not empty if isn't greyed out, but might be wrongly set. Might be without double slashes \\ for a path with spaces?

I find quite redundant there to set a variable for the path and link and then call exec that variable, when all could be done in the exec line confused smiley



Edited 1 time(s). Last edit at 12/15/2019 08:13PM by JohnHell.

Options: ReplyQuote
Re: Move item from a rt click submenu to main menu?
Posted by: siria
Date: December 15, 2019 09:03PM

Quote
Mello
Thanks both
I've played around a bit - can get menu entry moved easily but Chromium doesn't open.

Using macro as an example
macro is called chromium.kmm

Default link and menu entries inside are:

Quote

Chromium_OpenLink{
menugrayed=($Chromiumpath=="");
$Chromiumlinkurl=($Chromiumpath." ".$LinkURL);
exec($Chromiumlinkurl);
}

_Chromium_BuildMenu{
setmenu($_SendTo_Page,macro,"Chromium",Chromium_OpenPage);
setmenu($_SendTo_Link,macro,"Chromium",Chromium_OpenLink);
}

What makes no sense:
if that macro "Chromium_OpenLink" works from inside the SendTo submenu, then it must work equally from all other menu locations too, as long as a $LinkURL exists. It could possibly have a prob if the chromium folder path contains a blank, but that would break in ALL menu locations too.

Does the error console say anything? (with "All" errors enabled, check first directly after KM startup, then check after clicking that command)

And for testing would insert a line above the exec:
alert("$LinkURL: ".$LinkURL."\n$Chromiumpath: ".$Chromiumpath,"debug SendToChromium");

Options: ReplyQuote
Re: Move item from a rt click submenu to main menu?
Posted by: George_Hall
Date: December 15, 2019 10:28PM

Quote
siria
Quote
Mello
Thanks both
I've played around a bit - can get menu entry moved easily but Chromium doesn't open.

Using macro as an example
macro is called chromium.kmm

Default link and menu entries inside are:

Quote

Chromium_OpenLink{
menugrayed=($Chromiumpath=="");
$Chromiumlinkurl=($Chromiumpath." ".$LinkURL);
exec($Chromiumlinkurl);
}

_Chromium_BuildMenu{
setmenu($_SendTo_Page,macro,"Chromium",Chromium_OpenPage);
setmenu($_SendTo_Link,macro,"Chromium",Chromium_OpenLink);
}

What makes no sense:
if that macro "Chromium_OpenLink" works from inside the SendTo submenu, then it must work equally from all other menu locations too, as long as a $LinkURL exists. It could possibly have a prob if the chromium folder path contains a blank, but that would break in ALL menu locations too.

Does the error console say anything? (with "All" errors enabled, check first directly after KM startup, then check after clicking that command)

And for testing would insert a line above the exec:
alert("$LinkURL: ".$LinkURL."\n$Chromiumpath: ".$Chromiumpath,"debug SendToChromium");

It does not work becuase the Chromium Path needs to set manually.

Like how it is done in Chromium EX http://kmext.sourceforge.net/extensions/chromiumex.7z under K-Meleon Extensions Central Web Development http://kmext.sourceforge.net/ext5.htm

chromium.kmm from Chromium EX http://kmext.sourceforge.net/extensions/chromiumex.7z uses the lines below to manually chromium path once when the macro is first loaded.

getChromiumpath{
alert("use the next prompt to browse for the Chromium executable. ","Chromium EX", INFO);
$Chromiumpath=promptforfile("C:\\Program Files\\", "Chrome.exe", "Chrome.exe");
setpref( string, "extensions.Chromiumpath", $Chromiumpath);
}



Edited 1 time(s). Last edit at 12/15/2019 10:29PM by George_Hall.

Options: ReplyQuote
Re: Move item from a rt click submenu to main menu?
Posted by: Mello
Date: December 15, 2019 10:55PM

The path for chromium has been set and works fine for sending
both page and links to chromium - I've been using it for ages - it only doesn't work when item is switched from submenu to main menu.

As for error checking, I don't know what inserting that code "a line above the exec:" means siria. what exe? where? :s

Error showing without that is: expected 2 arguments got 6

Would you provide example of your suggested alteration in the chromium.kmm code I posted above?

I know nothing about macros etc other than copying and pasting suggestions in.



Edited 2 time(s). Last edit at 12/15/2019 11:20PM by Mello.

Options: ReplyQuote
Re: Move item from a rt click submenu to main menu?
Posted by: siria
Date: December 16, 2019 12:37AM

Just meant the exec line in your own code quote above.

Please post the complete macro code here.
And mark the line with your own changes, it's the prime suspect line ;-)

To get line numbers for macro errors in console:
create this pref manually on about:config
kmeleon.plugins.macros.debug = true (bool)

Options: ReplyQuote
Re: Move item from a rt click submenu to main menu?
Posted by: siria
Date: December 16, 2019 03:04AM

If the macro is the one linked by George, just add the green line inside:

_Chromium_BuildMenu{
setmenu($_SendTo_Page,macro,"Chromium",Chromium_OpenPage);
# setmenu($_SendTo_Link,macro,"Chromium",Chromium_OpenLink);
setmenu("LinkSave",macro,"Send To Chromium",Chromium_OpenLink);
}

Just not sure if newer KM-versions can handle duplicate menu entries or not. Dimly remember that was broken at some point. Just try to keep the original line too - or not, if that conflicts with the same command in the new line.

Options: ReplyQuote
Re: Move item from a rt click submenu to main menu?
Posted by: Mello
Date: December 16, 2019 10:06AM

Great! grinning smiley

Just adding the green line worked.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.