General :  K-Meleon 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 05:34PM

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

Cheers
SoerenB

No more own machines, because of addiction.
Don't know when I'll be back to normal ...

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: JamesD
Date: July 29, 2010 07: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_InNew:open($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 09: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 10:54PM

(oops, was nonsense)



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

Options: ReplyQuote
Re: Is there any way to open a "Groups2" group from a hotlink ..
Posted by: JamesD
Date: July 29, 2010 11: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_InNew:open($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 30, 2010 12:17AM

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

No more own machines, because of addiction.
Don't know when I'll be back to normal ...

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

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_InNew:open($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_InNew:open($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 02:41PM by jsnj.

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

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 31, 2010 06:25AM

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 31, 2010 06:57AM

@ 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 01:37PM

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 04:48PM

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 05:16PM by desga2.

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

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 05:11PM by desga2.

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

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 05:45PM by JamesD.

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

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/02/2010 02:20AM by jsnj.

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

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

K-Meleon in Spanish



Edited 1 time(s). Last edit at 08/02/2010 05:48AM by desga2.

Options: ReplyQuote
Re: macro sort order
Posted by: siria
Date: June 22, 2011 06:57AM

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 surprised smiley A first test seems to confirm that - too crazy.



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

Options: ReplyQuote


K-Meleon forum is powered by Phorum.