General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Is there any way to open a "Groups2" group from a hotlink ..
Posted by: SoerenB
Date: July 29, 2010 10:34AM

Is there any way to open a "Groups2" group from a hotlink ..
... in KM154 on XP?

Cheers
SoerenB


Back again ...

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: JamesD
Date: July 29, 2010 12:24PM

Not so sure about hotlinks, but there is a quick open by typing the group name into the URL bar and pressing ALT + VK_RETURN.

Hotlinks expects to have a single URL to open. It is coded as follows:
hotlink{
macroinfo=_("Open the specified hotlink");
$OpenURL=getpref(STRING,$_hotlink.$ARG.".url");
$OpenURL==""? 0 : ( getpref(BOOL,$_hotlink.$ARG.".new")?&OpenURL_InNewyawning smileypen($OpenURL));
}
Not really sure how to stop the "OpenURL" and point to the Groups2 macro.

Edit:
An idea just popped into my mind. Give me a few hours to test.



Edited 1 time(s). Last edit at 07/29/2010 02:15PM by JamesD.

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: siria
Date: July 29, 2010 03:54PM

(oops, was nonsense)



Edited 5 time(s). Last edit at 07/30/2010 07:42AM by siria.

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: JamesD
Date: July 29, 2010 04:01PM

Quote
SoerenB
Is there any way to open a "Groups2" group from a hotlink ..

Yes, you can. This requires a change to the KM macro file 'hotlink.kmm'. The first macro named 'hotlink' in that file can be replaced with the following code:

hotlink{
macroinfo=_("Open the specified hotlink");
$OpenURL=getpref(STRING,$_hotlink.$ARG.".url");
if ( substr ( $OpenURL,0,1) == "&" ) {
	$_Groups2_GName = substr( $OpenURL,1);
	plugin(macros, "Groups2_OpenGroup(" . $_Groups2_GName .")") ;
	} else {
	$OpenURL=="" ? 0 : (getpref(BOOL,$_hotlink.$ARG.".new")?&OpenURL_InNewyawning smileypen($OpenURL));
	}
}

For whichever hotlink number that you wish to be a group, just enter the group name preceded by the & character in the place where you would normally put a site URL.

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: SoerenB
Date: July 29, 2010 05:17PM

Jeez!, JamesD,

This is perfect, works like a charm.
Should be in the default hotlink.kmm, as it doesn't seem to interfere with any other aspect of either the Hotlink or the Groups2 macros.

Maybe this thread should be moved to the Extensions Forum.

I'm going to edit my Open all bookmarks in a bookmarks folder synopsis one of these days.

Cheers
SoerenB


Back again ...

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: jsnj
Date: July 29, 2010 11:17PM

Quote
JamesD
Quote
SoerenB
Is there any way to open a "Groups2" group from a hotlink ..

Yes, you can. This requires a change to the KM macro file 'hotlink.kmm'. The first macro named 'hotlink' in that file can be replaced with the following code:

hotlink{
macroinfo=_("Open the specified hotlink");
$OpenURL=getpref(STRING,$_hotlink.$ARG.".url");
if ( substr ( $OpenURL,0,1) == "&" ) {
	$_Groups2_GName = substr( $OpenURL,1);
	plugin(macros, "Groups2_OpenGroup(" . $_Groups2_GName .")") ;
	} else {
	$OpenURL=="" ? 0 : (getpref(BOOL,$_hotlink.$ARG.".new")?&OpenURL_InNewyawning smileypen($OpenURL));
	}
}

For whichever hotlink number that you wish to be a group, just enter the group name preceded by the & character in the place where you would normally put a site URL.

You can also just check for a dot. All hotlinks whether they are JS or URLs should have a dot. The following should work. No need for the "&" character.


hotlink{
macroinfo=_("Open the specified hotlink");
$OpenURL=getpref(STRING,$_hotlink.$ARG.".url");
$OpenURL==""?0 : (index($OpenURL,".")==-1 ? &hotlinkgroup: (getpref(BOOL,$_hotlink.$ARG.".new")?&OpenURL_InNewyawning smileypen($OpenURL)));
}

hotlinkgroup{
$_Folder=pluginmsgex(bookmarks,FindNick,$OpenURL,STRING);
$_Folder ? 0 : $_Folder=pluginmsgex(hotlist,FindNick,$OpenURL,STRING);
$_Folder ? $URLBAR=$OpenURL : plugin(macros, "Groups2_OpenGroup(" . $OpenURL .")");
$_Folder ? id(ID_SELECT_URL):0; $_Folder ? id(ID_NAV_GO):0;
}


*Edit: Following Siria's thinking, added folder group recognition.



Edited 7 time(s). Last edit at 07/30/2010 07:41AM by jsnj.

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: jsnj
Date: July 30, 2010 07:30PM

Quote
siria
(oops, was nonsense)

It inspired the inclusion of folder groups to the feature request. So your post was useful.

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: desga2
Date: July 30, 2010 11:25PM

A new experimental version with HotGroups feature added:
Download new Groups2 0.6.3ex.

Only Hotlinks checked in Groups -> Options -> HotGroups menu are opened like Group/Nick.
This new experimental version overlayed default hotlinks accelerators Ctrl+[0-9].

Thanks for colaboration to this experimental version, with his ideas and code, to:
SoerenB
JamesD
siria
jsnj

K-Meleon in Spanish

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: JamesD
Date: July 30, 2010 11:57PM

@ desga2

I guess I am old and cannot see the tree for the forest, but what steps do I take to set a hot group?

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: jsnj
Date: July 31, 2010 06:37AM

Quote
desga2
A new experimental version with HotGroups feature added:
Download new Groups2 0.6.3ex.

Only Hotlinks checked in Groups -> Options -> HotGroups menu are opened like Group/Nick.
This new experimental version overlayed default hotlinks accelerators Ctrl+[0-9].

Thanks for colaboration to this experimental version, with his ideas and code, to:
SoerenB
JamesD
siria
jsnj

Seems the macro modules are initiated alphabetically, so since the hotlinks macro module is initiated after the groups2_HotGroups macro module, its accels override the HotGroups accels. Either the "groups2_HotGroups" name has to be changed to be initiated after "hotlinks" or the groups2_HotGroups macro has to be coded differently.

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: desga2
Date: July 31, 2010 09:48AM

Quote
JamesD
@ desga2

I guess I am old and cannot see the tree for the forest, but what steps do I take to set a hot group?

It's easy, go to Groups -> Options -> HotGroups -> Set Hotlink as HotGroup...,
This open Hotlinks Preference panel, set a Group name in a Hotlink, for example the Hotlink number 2 (Ctrl+2), Close Preferences.
Now check HotGroup 2 in HotGroups; Groups -> Options -> HotGroups -> HotGroup 2
When you use the Hotlink accelerator Ctrl+2, the Group/Nick name set in Hotlink2 will be opened.

K-Meleon in Spanish



Edited 2 time(s). Last edit at 07/31/2010 10:16AM by desga2.

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: desga2
Date: July 31, 2010 10:10AM

Quote
jsnj
Seems the macro modules are initiated alphabetically, so since the hotlinks macro module is initiated after the groups2_HotGroups macro module, its accels override the HotGroups accels. Either the "groups2_HotGroups" name has to be changed to be initiated after "hotlinks" or the groups2_HotGroups macro has to be coded differently.

It's working fine for me. Is posible KM load macro modules in alphabetical order because load macro modules from \macros folder and this are sorted alphabetically by Windows.

Note that it's important not use this groups2_HotGroups.kmm macro file with others groups2.kmm macros loaded and I'm using groups2_HotGroups.kmm file from \macros subdirectory in my KM user profile, not in main \K-Meleon\macros folder.
User Defined Macros are loaded at the end, after main macros.

If you are using HotGroups macro from main \K-Meleon\macros folder you can rename the macro file from groups2_HotGroups.kmm to x_HotGroups2.kmm, for example, to macro file will be loaded after hotlink.kmm macro module and accelerators will be overlayed.

Greetings.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 07/31/2010 10:11AM by desga2.

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: JamesD
Date: July 31, 2010 10:40AM

HotGroups is working for me in my UserMacroFolder. I will test moving the file to MacroFolder.

It works in MacroFolder with name of file as x_HotGroups2.kmm.



Edited 1 time(s). Last edit at 07/31/2010 10:45AM by JamesD.

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: jsnj
Date: August 01, 2010 06:10PM

Quote
desga2
...
I'm using groups2_HotGroups.kmm file from \macros subdirectory in my KM user profile, not in main \K-Meleon\macros folder.
User Defined Macros are loaded at the end, after main macros.

If you are using HotGroups macro from main \K-Meleon\macros folder you can rename the macro file from groups2_HotGroups.kmm to x_HotGroups2.kmm, for example, to macro file will be loaded after hotlink.kmm macro module and accelerators will be overlayed.

Greetings.

Since most users place new macros in the main macros folder and the extension installers do the same, to solve the problem, just build the hotgroups accels again on startup. No renaming necessary.

$OnStartup = $OnStartup . "_Groups2_Startup;_Groups2_BuildHotGroupsMenu;";

or only set them OnStartup:

_Groups2_BuildHotGroupsMenu {
# Create HotGroups menu & accels:
setmenu(_("&HotGroups"), macro, _("&Set Hotlink as HotGroup..."), "kmPrefs(hotlinks)");
setmenu(_("&HotGroups"), separator, 1);
}
_Groups2_BuildHotGroupsAccels{
$_i=0; while($_i != 10) {
setmenu(_("&HotGroups"), macro, _("HotGroup ") . $_i, "_Groups2_HotGroup" . $_i);
setaccel("CTRL " . $_i, "macros(_Groups2_OpenHotGroup(" . $_i . "))"); $_i = $_i + 1;
}
}

$OnStartup = $OnStartup . "_Groups2_Startup;_Groups2_BuildHotGroupsAccels;";



Edited 3 time(s). Last edit at 08/01/2010 07:20PM by jsnj.

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: desga2
Date: August 01, 2010 10:47PM

OK, jsnj posted a good solution, code uploaded to same link.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 08/01/2010 10:48PM by desga2.

Options: ReplyQuote
Re: macro sort order
Posted by: siria
Date: June 21, 2011 11:57PM

A bit offtopic here, but just noticed something and can hardly believe it...
Quote
desga2
Quote
jsnj
Seems the macro modules are initiated alphabetically, so since the hotlinks macro module is initiated after the groups2_HotGroups macro module...

It's working fine for me. Is posible KM load macro modules in alphabetical order because load macro modules from \macros folder and this are sorted alphabetically by Windows.

Always thought so, after reading this somewhere, probably here, and it 'seemed' to work that way. Only kept wondering why the toolbar names in the menu are so mixed up. Now when checking variables like $OnSetup or $OnInit, it turns out that macros are not at all read in alphabetical order, at least not on my machine, with KM1.6b2 on win98se. No, they are not even sorted by some date, although date seems to have much influence, just not for all, made me completely confused... Until something dawned on me, when I remembered how mp3-tracks are 'sorted' on most cheap mp3-players: in physical order, as they are placed on disk :O A first test seems to confirm that - too crazy.



Edited 1 time(s). Last edit at 06/22/2011 12:00AM by siria.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.