Improvement requests :  K-Meleon Web Browser Forum
Use this forum to talk about a feature you're missing. 
Open in 1.7 from 1.6
Posted by: rodocop
Date: March 29, 2012 05:11PM

Folks,
is it possible to send page from KM 1.6 to KM 1.7 with opening link in 1.6 own new tab?

Something like the same thing with Chromium...

What do you think about this?

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: rodocop
Date: March 29, 2012 05:15PM

for example,
I have 1.6 installed as my main browser and 1.7 as secondary (I know some sites which 1.6 cannot handle properly but 1.7 can).

If I found such a page, I wish to render it by 1.7's engine - but in the same 1.6 window.

It is possible with Chromium - so I think it may be possible with another KM. But what is the reality?

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: JamesD
Date: March 29, 2012 09:33PM

The problem seems to be that you need to be in the KM 1.7 folder to start KM. If I just exec it from a macro in 1.6, I get an error about cannot find XPCOM.

It works just fine to put the same information in a 'run' window. KM 1.7 will start with KM 1.6 already running. I use the '-new' on the command line.

I will try to find a way, but not sure how right now.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: rodocop
Date: March 30, 2012 06:34AM

Quote
JamesD
The problem seems to be that you need to be in the KM 1.7 folder to start KM. If I just exec it from a macro in 1.6, I get an error about cannot find XPCOM.

It works just fine to put the same information in a 'run' window. KM 1.7 will start with KM 1.6 already running. I use the '-new' on the command line.

I will try to find a way, but not sure how right now.

yes, I'm constantly using the "-new" option to load some KMs simultaneously. But loading another version in the tab of working main KM would be most user-friendly option.
Thank you for your answer and your future efforts!

I wish you good luck in this job.

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: JujuLand
Date: March 31, 2012 07:14AM

Quote
JamesD
The problem seems to be that you need to be in the KM 1.7 folder to start KM. If I just exec it from a macro in 1.6, I get an error about cannot find XPCOM.

The problem was already known (I posted a message there is a long time, and desga2 gives a beginning of answer a few post later) under Windows 7 with a shortcut on the desktop without indicating an execution path, or under Linux.

I solved the problem under Linux by this shell:

#!/bin/bash

cd "/opt/Program Files/K-Meleon170a"
env WINEPREFIX="/home/alain/.wine" wine ./k-meleon.exe $1


I suppose that a cmd file like this could have the same effects:

@echo off
cd "Z:\opt\Program Files\K-Meleon170a"
k-meleon.exe %1 %2


You have just then to call the cmd file instead of the exe to make it work:

exec("Z:\\opt\\Program Files\\K-Meleon170a\\k-meleon.cmd -new ".$URL);

The only problem under Linux I found was just that launching K-Meleon with this way simulate the -new option, what I don't want. But it's what you need here, and I think that -new should not be necessary, and %1 enough in the cmd file. Just test it...

A+



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


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



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 1 time(s). Last edit at 03/31/2012 07:20AM by JujuLand.

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: JamesD
Date: April 05, 2012 07:03PM

Thanks to the timely help from Jujuland, I have made files, macro and cmd, which will open a page or a link in KM 1.7 from KM 1.6. Note that you get a new window - not a new tab.

The value of the string in KM17n.cmd must be your path to K-Meleon 1.7.

KM17n.cmd

@echo off
cd "C:\\Program Files\\K-Meleon 17a2" 
k-meleon.exe -new %1 %2

KM17n.kmm

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

# ----------  KM17n.kmm ------------------------------------------------------------------
#
# Dependencies	: main.kmm (Go), sendto.kmm (menus)
# Resources 	: - K-Meleon 1.7 KM17n.cmd
# Preferences	: -
# Author and date  JamesD  2012-04-05
# -----------------------------------------------------------------------
# Note - The value of the string in KM17n.cmd must be your path to K-Meleon 1.7
# -----------------------------------------------------------------------
KM17n_OpenPage{
macroinfo=_("Open page in K-Meleon 1.7");
$_KM17n_Open=$URL;      &_KM17n_Open;
}
KM17n_OpenLink{
macroinfo=_("Open link in K-Meleon 1.7");
$_KM17n_Open=$LinkURL;  &_KM17n_Open;
}
_KM17n_Open{
exec($_KM17n_Path ." ". $_KM17n_Open);
}
_KM17n_BuildMenu {
index($macroModules,";SendTo;")>-1?&_KM17n_BuildMenu_SendTo:&_KM17n_BuildMenu_Default;
}
_KM17n_BuildMenu_Default {
$__w="Open In K-Meleon 1.7";
setmenu(DocumentOpenExternal,macro,$__w,KM17n_OpenPage);
setmenu(LinkOpenExternal,macro,$__w,KM17n_OpenLink);
}
_KM17n_BuildMenu_SendTo {
$__w="K-Meleon 1.7";
setmenu($_SendTo_Page,macro,$__w,KM17n_OpenPage);
setmenu($_SendTo_Link,macro,$__w,KM17n_OpenLink);
}

_KM17n_GetPath {
$__Data=readfile(getfolder(MacroFolder)."\\KM17n.cmd");
$_KM17n_Path=getfolder($__Data==""?UserMacroFolder:MacroFolder)."\\KM17n.cmd";
}

$OnInit=$OnInit."_KM17n_BuildMenu;";
$OnStartup=$OnStartup."_KM17n_GetPath;";
# -------------------------------------------------------------------------------
$macroModules=$macroModules."KM17n;";

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: rodocop
Date: April 06, 2012 06:01AM

Thank you, James!

As I understand, one must edit your cmd-file for the actual folder path to KM 1.7 - right?

And second point - where I should place cmd-file - im 'macros' folder, yes?



Edited 1 time(s). Last edit at 04/06/2012 06:03AM by rodocop.

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: JujuLand
Date: April 06, 2012 10:35AM

In K-Meleon root folder

A+



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


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



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: JamesD
Date: April 06, 2012 11:28AM

The macro expects to find the cmd file in either the macro folder or the user macro folder.

_KM17n_GetPath {
$__Data=readfile(getfolder(MacroFolder)."\\KM17n.cmd");
$_KM17n_Path=getfolder($__Data==""?UserMacroFolder:MacroFolder)."\\KM17n.cmd";
}

Yes, the path to your KM 1.7 should be in the second line of the cmd file.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: rodocop
Date: April 06, 2012 05:18PM

Thank you!
That's fine!

P.S. It works!
But is it possible to close cmd-window (after running 1.7) somehow?



Edited 1 time(s). Last edit at 04/06/2012 05:25PM by rodocop.

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: JujuLand
Date: April 06, 2012 07:33PM

I don't remember exactly, but I think this should work:

@echo off
cd "C:\\Program Files\\K-Meleon 17a2"
k-meleon.exe -new %1 %2 &&

or prehaps with only one &

It doesn't work under wine

I just see the batch you give, and I think it would be nice to give the parameter -new as a parameter, and not in the batch.

A+



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


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



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 2 time(s). Last edit at 04/06/2012 07:50PM by JujuLand.

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: JamesD
Date: April 06, 2012 07:48PM

I could not get the '&&' to work. I am trying to get by without the cmd file, but I have not gotten that quite right either.

exec("CMD /k cd \"C:\\Program Files\\K-Meleon 17a2\" &&  k-meleon.exe -new .$_KM17n_Open " );

I have to get $_KM17n_Open to expand to its value. When that works, then I can change the switch /k to /c to get the cmd.exe session to close.

Everything worked on the above code except that KM 1.7 tried to open www.$_KM17n_Open which, of course, was not found.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: JamesD
Date: April 07, 2012 12:36AM

I was able to get this to work without the cmd file. However I cannot get the cmd window to close until the KM 1.7 is closed. The && characters allow two commands to be sent in one call to cmd.exe.

Documentation says the /c switch should terminate cmd but it does not seem to do that for me. See http://ss64.com/nt/cmd.html and also http://www.computerhope.com/cmd.htm

KM17n.kmm

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

# ----------  KM17n.kmm ------------------------------------------------------------------
#
# Dependencies	: main.kmm (Go), sendto.kmm (menus)
# Resources 	: - K-Meleon 1.7 
# Preferences	: -
# Author and date  JamesD  2012-04-06
# Version       :  2.0
# ---------------------------------------------------------------------------------------------
# Note - The value of the string in line 22 must be your path to K-Meleon 1.7
#  EXAMPLE == exec ("CMD /c cd \" STRING \" && k-meleon.exe -new " .$_KM17n_Open);
# ---------------------------------------------------------------------------------------------
KM17n_OpenPage{
macroinfo=_("Open page in K-Meleon 1.7");
$_KM17n_Open=$URL;      &_KM17n_Open;
}
KM17n_OpenLink{
macroinfo=_("Open link in K-Meleon 1.7");
$_KM17n_Open=$LinkURL;  &_KM17n_Open;
}
_KM17n_Open{
exec ("CMD /c cd \"C:\\Program Files\\K-Meleon 17a2\" && k-meleon.exe -new " .$_KM17n_Open);
}
_KM17n_BuildMenu {
index($macroModules,";SendTo;")>-1?&_KM17n_BuildMenu_SendTo:&_KM17n_BuildMenu_Default;
}
_KM17n_BuildMenu_Default {
$__w="Open In K-Meleon 1.7";
setmenu(DocumentOpenExternal,macro,$__w,KM17n_OpenPage);
setmenu(LinkOpenExternal,macro,$__w,KM17n_OpenLink);
}
_KM17n_BuildMenu_SendTo {
$__w="K-Meleon 1.7";
setmenu($_SendTo_Page,macro,$__w,KM17n_OpenPage);
setmenu($_SendTo_Link,macro,$__w,KM17n_OpenLink);
}
$OnInit=$OnInit."_KM17n_BuildMenu;";
# --------------------------------------------------------------------------------------------------------
$macroModules=$macroModules."KM17n;";

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: Open in 1.7 from 1.6
Posted by: JujuLand
Date: April 07, 2012 08:27AM

I have made other tests under Linux.

The string to add to the command line launching K-Meleon, isn't &&, but just &
Unfortunately, it closes directly the console before K-Meleon is launched.

But I have tried another way. Wine has a command named start.exe which allows to launch a program and let the console to get the control.

Using it works well, K-Meleon is launched, and the console is closed.

I don't remember exactly, but I think that under Windows, a such command or mechanism exists.

The shell under wine is now:
#!/bin/bash

cd "/opt/Program Files/K-Meleon170a"
env WINEPREFIX="/home/alain/.wine" wine start ./k-meleon.exe $1 $2


The cmd file ought to be:

@echo off
cd "Z:\opt\Program Files\K-Meleon170a"
start k-meleon.exe %1 %2


It can perhaps also be used directly from within the macro. Try it:

exec ("CMD /c cd \"C:\\Program Files\\K-Meleon 17a2\" && start k-meleon.exe -new " .$_KM17n_Open);


A+



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


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



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 2 time(s). Last edit at 04/07/2012 01:17PM by JujuLand.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.