Improvement requests :  K-Meleon Web Browser Forum
Use this forum to talk about a feature you're missing. 
Tab Url Copier?
Posted by: zelgon
Date: April 20, 2008 04:48PM

I guess that it can be accomplished through the macro. But I'm far from being able to do it I think. Anyone have anything like that already?

Basically I need to put into context menu option for saving all opened layers/tabs urls and send them into clipboard. (To eventually use that list later, in download manager, for archiving the pages.)

Yep, in firefox that can be done via Tab Url Copier.

Any hints? Macros?

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: Fred
Date: April 20, 2008 09:23PM

An easy macro solution for KM 1.1.5 and similar earlier versions
containing a macro folder is the following :
(It depends however on closing the browser with the opened tabs
and restarting the browser then anew.
You can restore the Session as it was then with Groups/Last Session.)

Open notepad and paste :

$np="notepad.exe"
$gt="kmeleon.plugins.macros.groups.last";
$gtnames=getpref(STRING,$gt)


TabsInNotepad{
alert($gtnames);
alert("Paste the tab URLs into notepad");
setclipboard(); getclipboard()==""?setclipboard($gtnames):0;
exec($np);
}

Save to the "macros" folder inside the K-Meleon main folder
as TabsInNotepad.kmm ( not as .txt ! ).

Open in the folder "Settings" inside the K-Meleon main folder
the file menus.cfg in notepad .
Search for the line :
&Paste=ID_EDIT_PASTE

Below that line enter the line :
macros(TabsInNotepad,Tabs in Notepad)

Go in notepad to File/Save to save the file to its origin.
It should then be saved as menus.cfg, not as .txt .

After restarting the browser, you should find a menu
entry in the menu point Edit.
Clicking on that opens an alert showing the last opened tab addresses,
and opens notepad where you can paste the addresses from clipboard.

I hope that it works and may be someone else has an other idea how
to do that without a browser restart.

Fred

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: zelgon
Date: April 21, 2008 02:18PM

Thanks ;-) I appreciate your effort.

However I need to copy url of all opened tabs. And this can copy only the active one.

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: JujuLand
Date: April 21, 2008 02:38PM

I think it's possible, if I don't say stupidity, there is a function which returns number of opened tabs (and layers?), and another which returns the URL for each tab (and layer?).

kko can confirm.

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: Tab Url Copier?
Posted by: kko
Date: April 21, 2008 04:42PM

Quote
JujuLand
kko can confirm.

Partly. smiling smiley

For layers (km 1.1) it's pretty easy (just copy&paste these lines in a new kmm file):

CopyURLs{
setclipboard(pluginmsgex(layers,GetLayersInWindow,"",STRING));
}
_CopyURLs_BuildMenu{
# layer button popup
$__m="Co&py All Layer URLs";
$kLayers==true?setmenu(LayerButtonPopup,macro,$__m,CopyURLs,CloseLayer):0;
$kLayers==true?setmenu(LayerButtonPopup,separator,$__m):0;
}
$OnInit=$OnInit."_CopyURLs_BuildMenu;";


For tabs (km 1.5) however, there's no comparable function I'd know of.

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: desga2
Date: April 21, 2008 05:06PM

Yes as kko wrote the best macro to do this (in 1.1.X) is: in Edit -> Configuration -> User Defined Macros create a new text file named 'LayerUrlsCopier.kmm' with this code:
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- Layer Urls Copier --------------------------------------------
#
# Dependencies	: -
# Resources	: -
# Preferences	: -
#
# ----------------------------------------------------------------------

CopyLayerURLs{
setclipboard(pluginmsgex(layers,GetLayersInWindow,"",STRING));
}

# ----- PRIVATE

_LayerUrlsCopier_BuildMenu{
# layer button popup
$__m=_("Co&py All Layer URLs");
$kLayers==true?setmenu(LayerButtonPopup,macro,$__m,CopyLayerURLs,CloseLayer):0;
$kLayers==true?setmenu(LayerButtonPopup,separator,$__m):0;
}

$OnInit=$OnInit."_LayerUrlsCopier_BuildMenu;";

# -----------------------------------------------------------------------
$macroModules=$macroModules."LayerUrlsCopier;";

* EDITED *

Macro code added to MacroLibrary.

K-Meleon in Spanish



Edited 4 time(s). Last edit at 04/22/2008 11:31AM by desga2.

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: zelgon
Date: April 21, 2008 08:41PM

Thank you all. smiling smiley

To perfection I would need to fulfill one more condition though, and that is to put only one url per line. (To make a versatile usable list from it.)


Current macro places all urls into one ultimatively super long line.

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: desga2
Date: April 22, 2008 09:38AM

I tried something as this code, but not work.
$_layers_url=pluginmsgex(layers,GetLayersInWindow,"",STRING);
$_layers_url=gsub("\nhttp://";, "http://";, $_layers_url);
setclipboard($_layers_url);
sad smiley

K-Meleon in Spanish

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: JujuLand
Date: April 22, 2008 10:52AM

@desga2, here is an hard-copy of the hex content of the clipboard

The separator is chr(9)chr(0) (UTF-8), it's an horizontal tabulation. I'm not sure , but I think it's \t

I have tried this:

CopyLayerURLs{
setclipboard(pluginmsgex(layers,GetLayersInWindow,"",STRING));
$_layers_url=gsub("\n", "\t", getclipboard());
setclipboard($_layers_url);
}

And it doesn't works anymore.

I think it's perhaps a macros.dll bug due to UTF-8 encoding. Other problem perhaps due to the same reason, accelerators (Co&py = p here) doesn't work anymore in the menu.

Last point, since we have localized K-Meleon), it's important to directly insert localization mechanisms in kmm files. Replace this

$__m="Co&py All Layer URLs";

by

$__m=_("Co&py All Layer URLs");

and the macro will be localized with a LayerURLCopier.kml put to in locales\xx-YY folder (sample in french smiling smiley

# LANGUAGE DEFINITION FILE

#--------------------------------------------------------
# Added by LayerURLColier Extension (don't edit this comment)
#--------------------------------------------------------
Co&py All Layer URLs=Co&pier les URL des onglets
#--------------------------------------------------------

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 4 time(s). Last edit at 04/22/2008 11:27AM by JujuLand.

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: desga2
Date: April 22, 2008 11:30AM

Quote
JujuLand
CopyLayerURLs{
setclipboard(pluginmsgex(layers,GetLayersInWindow,"",STRING));
$_layers_url=gsub("\n", "\t", getclipboard());
setclipboard($_layers_url);
}

I tried this before tried the code in my post and i suppuse that K-M not detect tabulation character "/t", but i think that problem is K-M not replaced "\n" and "\t" characters.

Quote
JujuLand
$__m="Co&py All Layer URLs";


by

$__m=_("Co&py All Layer URLs");

I changed this in MacroLibrary and before post with code.

K-Meleon in Spanish

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: kko
Date: April 22, 2008 05:26PM

Quote
zelgon
To perfection I would need to fulfill one more condition though, and that is to put only one url per line.

Yeah. The following line:

setclipboard(pluginmsgex(layers,GetLayersInWindow,"",STRING));

should actually be:

setclipboard(gsub("\t","\r\n",pluginmsgex(layers,GetLayersInWindow,"",STRING)));

to replace the tabulator that is separating the URLs by a Windows line break (which is \r\n, not just \n). But for whatever reason the \r is not interpreted correctly. Might be a bug... (that's why I left it out)

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: zelgon
Date: April 22, 2008 06:58PM

Thanks again to all. ;-)

So I will sum it up, this is the result:
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- Layer Urls Copier --------------------------------------------
#
# Dependencies	: -
# Resources	: -
# Preferences	: -
#
# ----------------------------------------------------------------------

CopyLayerURLs{
setclipboard(gsub("\t","\n",pluginmsgex(layers,GetLayersInWindow,"",STRING)));
}

# ----- PRIVATE

_LayerUrlsCopier_BuildMenu{
# layer button popup
$__m="Co&py All Layer URLs";
$kLayers==true?setmenu(LayerButtonPopup,macro,$__m,CopyLayerURLs,CloseLayer):0;
$kLayers==true?setmenu(LayerButtonPopup,separator,$__m):0;
}

$OnInit=$OnInit."_LayerUrlsCopier_BuildMenu;";

# -----------------------------------------------------------------------
$macroModules=$macroModules."LayerUrlsCopier;";
And it's working flawlessly. In any editor supporting linux line breaks (input), afterward best saved like iso-8859-1.

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: desga2
Date: April 22, 2008 07:07PM

Yes, i updated it in MacroLibrary.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 04/22/2008 07:08PM by desga2.

Options: ReplyQuote
Re: Tab Url Copier?
Posted by: Artumu
Date: April 26, 2008 01:33AM

That's a question!

Options: ReplyQuote


K-Meleon forum is powered by Phorum.