Development :  K-Meleon Web Browser Forum
K-Meleon development related discussions. 
Save Layers As Group
Posted by: jsnj
Date: October 07, 2003 08:49PM

I thought having to write each URL in a new macro for each group seemed somewhat archaic, so I came up with this after looking more closely at MonkeeSage's session macro. I'm not a macros master so there might be better ways to do this but I haven't seen any attempts posted in the forums or macros section. All opened layers are saved as a group in prefs.js. When saved, each group name, in effect, serves as an alias to be typed into the URL Bar combined with an accelerator opening the group. This only works properly in v0.8 beta and possibly MonkeeSage's builds since the updated layers.dll is needed. When v0.8 is released I'll post it in the macros section unless somebody posts a better way of doing it.

In macros:

SaveAsGroup {
menu = "Save As Group";
$group = pluginmsgex(layers,"GetLayersInWindow","",STRING);
$name = prompt("Save Group Name As:", "Group Name?", "");
$name == "" ? "" : setpref(STRING, "kmeleon.group." . $name, $group);
$tip = "' in the URL Bar and press Shift+Enter to open this group.";
$name == "" ? "" : alert("Type '" . $name . $tip,"Group Saved As: " . $name);
}

AddToGroup {
menu = "Add URL To Group";
$name = prompt("Enter name of Group to add this URL to:", "Group Name?", "");
$name == "" ? "" : getpref(STRING, "kmeleon.group." . $name);
$group = getpref(STRING, "kmeleon.group." . $name);
$name == "" ? "" : setpref(STRING, "kmeleon.group." . $name, $group . $URL . "\t");
$name == "" ? "" : alert("URL added to Group: " . $name, "Group Updated");
}

OpenGroup{
id(ID_SELECT_URL);
id(ID_EDIT_COPY);
$name = getclipboard();
$group = getpref(STRING, "kmeleon.group." . $name);
$index = index($group, "\t\t");
$index == -1 ? pluginmsg(layers, "ReplaceLayersInWindow", $group) : pluginmsg(layers, "ReplaceLayersInWindow", substr($group, 0, $index));
statusbar("Loading Group");
}


In menus:

# Under &Bookmarks {, or F&avorites {, or &Layers {, or Ho&tlist {

macros(SaveAsGroup)
macros(AddToGroup)


In Accelerators:

ALT S = macros(SaveAsGroup)
ALT A = macros(AddToGroup)
SHIFT VK_RETURN = macros(OpenGroup)

Options: ReplyQuote
Re: Save Layers As Group
Posted by: jsnj
Date: October 08, 2003 05:49PM

In the OpenGroup macro above I'm not sure what the $index and substr stuff is about. I left it in because that's what's in the session macro, but the following seems to work just as well:

OpenGroup{
id(ID_SELECT_URL);
id(ID_EDIT_COPY);
$name = getclipboard();
$group = getpref(STRING, "kmeleon.group." . $name);
pluginmsg(layers, "ReplaceLayersInWindow", $group);
statusbar("Loading Group");
}

Options: ReplyQuote
Re: Save Layers As Group
Posted by: Geex
Date: October 10, 2003 07:57PM

When I try to load the group, it does not work for me. Instead, it brought me to the google search.

Options: ReplyQuote
Re: Save Layers As Group
Posted by: jsnj
Date: October 10, 2003 08:54PM

What K-Meleon version are you using?

Options: ReplyQuote
Re: Save Layers As Group
Posted by: Geex
Date: October 11, 2003 07:24AM

I am using Version 0.7.1 Build 734 Compiled Wed Feb 12 18:21:25 2003 and Monkeesage's latest build.

Options: ReplyQuote
Re: Save Layers As Group
Posted by: Geex
Date: October 11, 2003 07:35AM

Sorry I missed out on the details:

E.g. my group name is 1. So after saving it, the dialog box informed me to type in '1' in the url bar and press shift+enter. And so I did that on the next restart but the status bar kept reading, "send request to 1..." and no layers were loaded. Since I am using Proximitron, it ended in an error page in the end.

Is there any way to know where the information on the group is stored?

Thanks!

Options: ReplyQuote
Re: Save Layers As Group
Posted by: jsnj
Date: October 11, 2003 08:38AM

The URL addresses are stored in prefs.js which you can access at Edit-Preferences-Configs-prefs. Your URL's would be stored next to:

user_pref("kmeleon.group.1",

But as I mentioned in my 1st post in this thread, this is made to work with v0.8 and has only been tested in v0.8 beta. That's why I posted it in the Development forum instead of the General forum. It won't work in v0.7.1 and I don't know if it works in MonkeeSage's builds. You can find links to the beta in this thread.

Options: ReplyQuote
Re: Save Layers As Group
Posted by: Geex
Date: October 12, 2003 05:20AM

Thanks, I will check out the beta version smiling smiley

Options: ReplyQuote
Re: Save Layers As Group
Posted by: Geex
Date: October 12, 2003 02:37PM

Hi, sorry to bother again. I am using the latest beta now but still, I get the same problem. The browser is trying to load my group name as a webpage I think. Hence, saving is successful but the loading does not work. sad smiley

Options: ReplyQuote
Re: Save Layers As Group
Posted by: jsnj
Date: October 12, 2003 05:57PM

Are you holding down the Shift key along with the Enter key to open them? Make sure you have the following in Accelerators:

SHIFT VK_RETURN = macros(OpenGroup)

Options: ReplyQuote
Re: Save Layers As Group
Posted by: Geex
Date: October 13, 2003 07:08AM

Yes, but it still does not work...

Options: ReplyQuote
Re: Save Layers As Group
Posted by: jsnj
Date: October 13, 2003 05:24PM

I don't know what else to tell you. I double checked to make sure I posted the macros correctly in this thread and I did. Works fine on my end. Anyone else out there tried this macro with the betas?

Options: ReplyQuote
Re: Save Layers As Group
Posted by: ra
Date: October 13, 2003 08:03PM

I definately would if it were for the remaining, open windows and not for layers...

Options: ReplyQuote
Re: Save Layers As Group
Posted by: Geex
Date: October 14, 2003 05:33PM

It's ok, jsnj. I'll just work without that nice function sad smiley

Thanks for the help smiling smiley

Options: ReplyQuote


K-Meleon forum is powered by Phorum.