about Groups function
Posted by: pgf
Date: December 28, 2008 05:58PM

Hi,

I want to know when will the new version(1.5.x) add Groups function?
(Or let the sessions have the same functions of groups)

Thanks

Re: about Groups function
Posted by: JamesD
Date: December 28, 2008 07:53PM

I don't think groups is going to be added to 1.5.2 version. Not ever having used groups myself, could you please tell me what functions you wish added. Sessions is to provide functions which were handled by groups. If we can find which functions are not available, we could then ask specifically for those.

Re: about Groups function
Posted by: pgf
Date: December 28, 2008 09:51PM

Thanks for you reply
the most important functions of groups are:
1, type group's name in the URL Bar, press Ctrl+Enter to open
2, Group is not session, we can open a group without influence opened tabs
(when open a session, all opened tabs will be closed)

I think these functions are very useful.
Usually, I open some news websites by typping "news" and press Ctrl+Enter.

Re: about Groups function
Posted by: desga2
Date: December 29, 2008 01:00AM

Quote
pgf
Thanks for you reply
the most important functions of groups are:
1, type group's name in the URL Bar, press Ctrl+Enter to open
2, Group is not session, we can open a group without influence opened tabs
(when open a session, all opened tabs will be closed)

I think these functions are very useful.
Usually, I open some news websites by typping "news" and press Ctrl+Enter.

What K-Meleon version with Groups are you using?

1) Sorry but Ctrl+Enter not open (by default) any Group. This accelerator is for automcompletion www. and .com. I think you are wrong.
But you can use aliases for bookmarks.

2) You are right. I'll opened an improvement request to add an option in Sesions plugin to set if you like to add session tabs or to replace current session (opened tabs).

- EDITED: Opened improvement request: #1075

Greetings.

K-Meleon in Spanish



Edited 2 time(s). Last edit at 12/29/2008 01:07AM by desga2.

Re: about Groups function
Posted by: pgf
Date: December 29, 2008 11:42AM

Thanks,
Sorry, that is Shift+Enter.

Re: about Groups function
Posted by: JamesD
Date: December 29, 2008 08:14PM

I have a macro which may provide the function which is being requested for groups. This is a first try at this and may need improvements later. I have placed the menu under "File", but that may not the best location. I can add accelerator keys also if required for the load group function.

To use GroupUnit.kmm you should have the tab(s) open which will become the group and choose "Save" from the popup menu. You will be asked to supply a name for the group. The information is saved in the prefs system.

The tabs opened by GroupUnit do not have a history, nor do they replace or close any currently open tabs.

GroupUnit.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#  
# ---------- GroupsUnit.kmm
# ---------- K-Meleon Macro Language  Save/Open group of URLs in tabs ----
#
# Dependencies        : - main.kmm KM version 1.5 tabs
# Resources           : - 
# Preferences         : - k-meleon_GroupsUnit.<name>.<#>
#                     : - k-meleon_GroupsUnit.<name>.Cnt
# Version             : - 0.2   2008-12-29
# --------------------------------------------------------------------------------

_GroupsUnit_RunCode_Save{
macroinfo="Save the current tab's URLS";
$_GroupsUnit_Name = prompt("Assign a name for this group.", "GroupUnit Name (save)");
$_GroupsUnit_Number_of_Tabs = $TabNumber ;
$_GroupsUnit_Tab_Count = 0 ;
while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Save_Loop;
}

_GroupsUnit_Save_Loop {
$_GroupsUnit_Tab_Count == 0 ? setpref( INT, "k-meleon_GroupsUnit.".$_GroupsUnit_Name.".Cnt", $_GroupsUnit_Number_of_Tabs ) :0; 
id(ID_TAB_NEXT) ;
setpref( STRING, "k-meleon_GroupsUnit.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count, $URL );
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1 ;
}

_GroupsUnit_RunCode_Load{
$_GroupsUnit_Name = prompt("Enter name of group to load.", "GroupUnit Name (load)");
$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_GroupsUnit.".$_GroupsUnit_Name.".Cnt");
$_GroupsUnit_Tab_Count = 0 ;
while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Load_Loop;
}

_GroupsUnit_Load_Loop{
$_GroupsUnit_URL = getpref(STRING, "k-meleon_GroupsUnit.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count, $URL );
opentab( $_GroupsUnit_URL ); 
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1 ;
}

_GroupsUnit_RunCode_Delete{
$_GroupsUnit_Name = prompt("Enter name of group to delete.", "GroupUnit Name (delete)");
$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_GroupsUnit.".$_GroupsUnit_Name.".Cnt");
$_GroupsUnit_Tab_Count = 0 ;
while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Delete_Loop;
}

_GroupsUnit_Delete_Loop{
$_GroupsUnit_Tab_Count == 0 ? delpref("k-meleon_GroupsUnit.".$_GroupsUnit_Name.".Cnt");
delpref("k-meleon_GroupsUnit.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count);
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1 ;
}

_GroupsUnit_BuildMenu{
# add another option to the File menu
$_GroupsUnit_Popm = "GroupsUnit" ;
$kTabs?setmenu("&File",popup,$_GroupsUnit_Popm,4):0;
$kTabs?setmenu($_GroupsUnit_Popm,macro,"Save a group",_GroupsUnit_RunCode_Save,1):0;
$kTabs?setmenu($_GroupsUnit_Popm,macro,"Load a group",_GroupsUnit_RunCode_Load,2):0;
$kTabs?setmenu($_GroupsUnit_Popm,macro,"Delete a group",_GroupsUnit_RunCode_Delete,3):0;
}

$OnInit=$OnInit."_GroupsUnit_BuildMenu;";
$macroModules=$macroModules."GroupsUnit;";


Re: about Groups function
Posted by: desga2
Date: December 30, 2008 03:51AM

Some implementations to JamesD macro code:
- One problem; rebuild() not delete Groups entry deleted. (need restart)
I tried with setmenu(), but this function not deleted.

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
# File name: Groups2.kmm
# ---------- Groups2 in tabs for K-Meleon 1.5.x ----
#
# Dependencies        : - main.kmm KM version 1.5 tabs
# Resources           : - 
# Preferences         : - k-meleon_Groups2.<name>.<#>
#                     : - k-meleon_Groups2.<name>.count
#                     : - k-meleon_Groups2.list
# Version             : - 0.2b 2008-12-29
# Authors             : JamesD and desga2
# --------------------------------------------------------------------------------

_GroupsUnit_RunCode_Save{
macroinfo="Save the current tab's URLS";
$_GroupsUnit_Name = prompt("Assign a name for this group.", "GroupUnit Name (save)");
if($_GroupsUnit_Name != "" ){
	$_Glist="";
	$_Glist=getpref( STRING, "k-meleon_Groups2.list");
	if(index( $_Glist, $_GroupsUnit_Name ) != -1){
		$_Goverwrite = confirm("Grup name: '".$_GroupsUnit_Name."' already exist.\nDo you want overwrite it?", "GroupUnit Name (save)", YESNO, QUESTION);
		$_Goverwrite == "YES" ? plugin(macros,"_Goverwrite(".$_GroupsUnit_Name.")") : 0;
	} else {
		$_Glist=$_Glist.$_GroupsUnit_Name."|";
		setpref( STRING, "k-meleon_Groups2.list", $_Glist );
		$_GroupsUnit_Number_of_Tabs = $TabNumber;
		$_GroupsUnit_Tab_Count = 0;
		while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Save_Loop;
		&_Groups2_BuildGroupsMenu;
	}
}
}

_GroupsUnit_Save_Loop{
$_GroupsUnit_Tab_Count == 0 ? setpref( INT, "k-meleon_Groups2.".$_GroupsUnit_Name.".count", $_GroupsUnit_Number_of_Tabs ) :0;
id(ID_TAB_NEXT);
setpref( STRING, "k-meleon_Groups2.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count, $URL );
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1;
}

_Goverwrite{
$_GroupsUnit_Name = $ARG;
#alert("Group name in $ARG: ".$_GroupsUnit_Name, "Groups2 DEBUG", INFO);
# First Delete:
$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_GroupsUnit_Name.".count");
$_GroupsUnit_Tab_Count = 0 ;
while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Delete_Loop;
# Second Save:
$_GroupsUnit_Number_of_Tabs = $TabNumber;
$_GroupsUnit_Tab_Count = 0;
while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Save_Loop;
}

_Groups2_OpenGroup{
$_GroupsUnit_Name = $ARG;
#alert("Group name in $ARG: ".$_GroupsUnit_Name, "Groups2 DEBUG", INFO);
$_GroupsUnit_Name==""?$_GroupsUnit_Name=$URLBAR:0; $_GroupsUnit_Name==""?$_Group=$URL:0;
$_GroupsUnit_Name==$URL?0:$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_GroupsUnit_Name.".count");
$_GroupsUnit_Tab_Count = 0 ;
if($_GroupsUnit_Name != $URL ) while($_GroupsUnit_Tab_Count<$_GroupsUnit_Number_of_Tabs) &_GroupsUnit_Load_Loop;
}

_GroupsUnit_RunCode_Load{
$_GroupsUnit_Name = prompt("Enter name of group to load.", "GroupUnit Name (load)");
if($_GroupsUnit_Name != "" ){
	$_Glist="";
	$_Glist=getpref( STRING, "k-meleon_Groups2.list");
	if(index( $_Glist, $_GroupsUnit_Name ) != -1){
		$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_GroupsUnit_Name.".count");
		$_GroupsUnit_Tab_Count = 0 ;
		id(ID_CLOSE_ALLTAB);
		$URLBAR="about:blank";
		while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Load_Loop;
	} else {
		alert("No group found with name: ".$_GroupsUnit_Name, "GroupUnit Name (load)", EXCLAIM);
	}
}
}

_GroupsUnit_Load_Loop{
$_GroupsUnit_URL = getpref(STRING, "k-meleon_Groups2.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count, $URL );
if($URLBAR=="about:blank"){
	open($_GroupsUnit_URL);
	$URLBAR="";
} else {
	opentab( $_GroupsUnit_URL );
}
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1;
}

_GroupsUnit_RunCode_Delete{
$_GroupsUnit_Name = prompt("Enter name of group to delete.", "GroupUnit Name (delete)");
if($_GroupsUnit_Name != "" ){
	$_Glist="";
	$_Glist=getpref( STRING, "k-meleon_Groups2.list");
	if(index( $_Glist, $_GroupsUnit_Name ) != -1){
		$_Glist = sub( $_GroupsUnit_Name."|", "", $_Glist );
		setpref( STRING, "k-meleon_Groups2.list", $_Glist );
		$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_GroupsUnit_Name.".count");
		$_GroupsUnit_Tab_Count = 0 ;
		while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Delete_Loop;
		#setmenu("_Groups_List",macro,"","");
		&_Groups2_BuildGroupsMenu;
	} else {
		alert("No group found with name: ".$_GroupsUnit_Name, "GroupUnit Name (delete)", EXCLAIM);
	}
}
}

_GroupsUnit_Delete_Loop{
$_GroupsUnit_Tab_Count == 0 ? delpref("k-meleon_Groups2.".$_GroupsUnit_Name.".count"):0;
delpref("k-meleon_Groups2.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count);
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1 ;
}

_Groups2_BuildMenu{
# Groups menu
if($kTabs){
	$_g="&Groups";
	setmenu(Main,popup,$_g,"&Tools");
	$__m="_Groups";
	setmenu($_g,inline,$__m);
	setmenu($__m,macro,"&Save a group",_GroupsUnit_RunCode_Save);
	setmenu($__m,macro,"&Load a group",_GroupsUnit_RunCode_Load);
	setmenu($__m,macro,"&Delete a group",_GroupsUnit_RunCode_Delete);
	setmenu($__m,separator,3);
	&_Groups2_BuildGroupsMenu;
}
}

_Groups2_BuildGroupsMenu{
$_g="&Groups";
$_m="_Groups_List";
setmenu($_g,inline,$_m);
$__glist=getpref( STRING, "k-meleon_Groups2.list");
#alert("Group list:\n".$__glist, "Groups2 DEBUG", INFO);
while($__glist != ""){
	$__gname = substr($__glist, 0 , index($__glist, "|"));
	#alert("Group name:\n".$__gname, "Groups2 DEBUG", INFO);
	setmenu($_m,macro,$__gname,"_Groups2_OpenGroup(".$__gname.")");
	$__glist=sub( $__gname."|", "", $__glist );
	#alert("Group list:\n".$__glist, "Groups2 DEBUG", INFO);
}
rebuildmenu($_g);
rebuildmenu($_m);
}

_Groups2_SetAccels{
# SHIFT VK_RETURN not work
setaccel("ALT VK_RETURN","macros(_Groups2_OpenGroup)");
}

$OnInit=$OnInit."_Groups2_SetAccels;_Groups2_BuildMenu;";
$macroModules=$macroModules."Groups2;";

K-Meleon in Spanish



Edited 2 time(s). Last edit at 12/30/2008 03:52AM by desga2.

Re: about Groups function
Posted by: JamesD
Date: December 30, 2008 06:49AM

@ desga2

Wow! You are quicker than I. I had only begun to expand GroupsUnit. I will have a look at what you have done. Here is what I have done on GroupsUnit.

I added the _() for possible local. I put a check for empty string from prompt box. I put accel key for load. Note, that I have not fully testing everything yet.

GroupsUnit.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#  
# ---------- GroupsUnit.kmm
# ---------- K-Meleon Macro Language  Save/Open group of URLs in tabs ----
#
# Dependencies        : - main.kmm KM version 1.5 tabs
# Resources           : - 
# Preferences         : - k-meleon_GroupsUnit.<name>.<#>
#                     : - k-meleon_GroupsUnit.<name>.Cnt
# Version             : - 0.3   2008-12-29
# --------------------------------------------------------------------------------

### - - - - - PUBLIC - - - - 

GroupsUnit_RunCode_Load{
macroinfo=_("Load a group");
$_GroupsUnit_Name = prompt(_("Enter name of group to load."), _("GroupUnit Name (load)"));
$_GroupsUnit_Name != "" ?&_GroupsUnit_Load : 0;
}

### - - - - - PRIVATE - - - -

_GroupsUnit_Load{
$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_GroupsUnit.".$_GroupsUnit_Name.".Cnt");
$_GroupsUnit_Tab_Count = 0 ;
while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Load_Loop;
}

_GroupsUnit_Load_Loop{
$_GroupsUnit_URL = getpref(STRING, "k-meleon_GroupsUnit.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count, $URL );
opentab( $_GroupsUnit_URL ); 
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1 ;
}

_GroupsUnit_RunCode_Save{
macroinfo=_("Save the current tab's URLS as a group");
$_GroupsUnit_Name = prompt(_("Assign a name for this group."), _("GroupUnit Name (save)"));
$_GroupsUnit_Name != "" ?&_GroupsUnit_Save : 0;
}

_GroupsUnit_Save{
$_GroupsUnit_Number_of_Tabs = $TabNumber ;
$_GroupsUnit_Tab_Count = 0 ;
while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Save_Loop;
}

_GroupsUnit_Save_Loop {
$_GroupsUnit_Tab_Count == 0 ? setpref( INT, "k-meleon_GroupsUnit.".$_GroupsUnit_Name.".Cnt", $_GroupsUnit_Number_of_Tabs ) :0; 
id(ID_TAB_NEXT) ;
setpref( STRING, "k-meleon_GroupsUnit.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count, $URL );
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1 ;
}

_GroupsUnit_RunCode_Delete{
macroinfo=_("Delete a group");
$_GroupsUnit_Name = prompt(_("Enter name of group to delete."), _("GroupUnit Name (delete)"));
$_GroupsUnit_Name != "" ?&_GroupsUnit_Delete : 0;
}

_GroupsUnit_Delete{
$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_GroupsUnit.".$_GroupsUnit_Name.".Cnt");
$_GroupsUnit_Tab_Count = 0 ;
while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Delete_Loop;
}

_GroupsUnit_Delete_Loop{
$_GroupsUnit_Tab_Count == 0 ? delpref("k-meleon_GroupsUnit.".$_GroupsUnit_Name.".Cnt");
delpref("k-meleon_GroupsUnit.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count);
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1 ;
}

_GroupsUnit_BuildMenu{
# add another option to the File menu
$_GroupsUnit_Popm = "GroupsUnit" ;
$kTabs?setmenu("&File",popup,$_GroupsUnit_Popm,4):0;
$kTabs?setmenu($_GroupsUnit_Popm,macro,_("Save a group"),_GroupsUnit_RunCode_Save,1):0;
$kTabs?setmenu($_GroupsUnit_Popm,macro,_("Load a group"),GroupsUnit_RunCode_Load,2):0;
$kTabs?setmenu($_GroupsUnit_Popm,macro,_("Delete a group"),_GroupsUnit_RunCode_Delete,3):0;
macros(_GroupsUnit_accelerators);
}

_GroupsUnit_accelerators{
setaccel("CTRL SHIFT U", "macros(GroupsUnit_RunCode_Load)");
}

$OnInit=$OnInit."_GroupsUnit_BuildMenu;";
$macroModules=$macroModules."GroupsUnit;";


Re: about Groups function
Posted by: JamesD
Date: December 30, 2008 07:28AM

@ desga2

One concern about using "list" pref. Since that requires index and substr , will there be a problem for those who wish to use with a language which requires UTF-8? I had thought to use something like this.

k-meleon_GroupsUnit.count to keep total number of groups.
k-meleon_GroupsUnit.1 [2][3][4] etc to hold the name of the group.

That is very good with the inline menu. I have not yet discovered why the group name remains after the delete. I will keep trying.

Re: about Groups function
Posted by: JamesD
Date: December 30, 2008 09:30AM

@ desga2

For the rebuildmenu, Groups2 is sending the list of remaining groups. We need to send the deleted group also as a deletion. See this from the MacroLanguage.
COMMAND must be specified for item types "command" and "macro". 
If COMMAND is an empty string and LABEL is not, this is a deletion.
Label is the group being deleted. We need it to be processed through.
setmenu($_m,macro,$__gname,"_Groups2_OpenGroup(".$__gname.")");
where COMMAND is empty string.

At least I hope this is all we need.

Re: about Groups function
Posted by: JamesD
Date: December 30, 2008 09:51AM

@ desga2

I think I have Groups2 deleting from menu. See code at lines 99, 147, and 150.

Groups2.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
# File name: Groups2.kmm
# ---------- Groups2 in tabs for K-Meleon 1.5.x ----
#
# Dependencies        : - main.kmm KM version 1.5 tabs
# Resources           : - 
# Preferences         : - k-meleon_Groups2.<name>.<#>
#                     : - k-meleon_Groups2.<name>.count
#                     : - k-meleon_Groups2.list
# Version             : - 0.2c 2008-12-29
# Authors             : JamesD and desga2
# --------------------------------------------------------------------------------

_GroupsUnit_RunCode_Save{
macroinfo="Save the current tab's URLS";
$_GroupsUnit_Name = prompt("Assign a name for this group.", "GroupUnit Name (save)");
if($_GroupsUnit_Name != "" ){
	$_Glist="";
	$_Glist=getpref( STRING, "k-meleon_Groups2.list");
	if(index( $_Glist, $_GroupsUnit_Name ) != -1){
		$_Goverwrite = confirm("Grup name: '".$_GroupsUnit_Name."' already exist.\nDo you want overwrite it?", "GroupUnit Name (save)", YESNO, QUESTION);
		$_Goverwrite == "YES" ? plugin(macros,"_Goverwrite(".$_GroupsUnit_Name.")") : 0;
	} else {
		$_Glist=$_Glist.$_GroupsUnit_Name."|";
		setpref( STRING, "k-meleon_Groups2.list", $_Glist );
		$_GroupsUnit_Number_of_Tabs = $TabNumber;
		$_GroupsUnit_Tab_Count = 0;
		while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Save_Loop;
		&_Groups2_BuildGroupsMenu;
	}
}
}

_GroupsUnit_Save_Loop{
$_GroupsUnit_Tab_Count == 0 ? setpref( INT, "k-meleon_Groups2.".$_GroupsUnit_Name.".count", $_GroupsUnit_Number_of_Tabs ) :0;
id(ID_TAB_NEXT);
setpref( STRING, "k-meleon_Groups2.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count, $URL );
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1;
}

_Goverwrite{
$_GroupsUnit_Name = $ARG;
#alert("Group name in $ARG: ".$_GroupsUnit_Name, "Groups2 DEBUG", INFO);
# First Delete:
$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_GroupsUnit_Name.".count");
$_GroupsUnit_Tab_Count = 0 ;
while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Delete_Loop;
# Second Save:
$_GroupsUnit_Number_of_Tabs = $TabNumber;
$_GroupsUnit_Tab_Count = 0;
while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Save_Loop;
}

_Groups2_OpenGroup{
$_GroupsUnit_Name = $ARG;
#alert("Group name in $ARG: ".$_GroupsUnit_Name, "Groups2 DEBUG", INFO);
$_GroupsUnit_Name==""?$_GroupsUnit_Name=$URLBAR:0; $_GroupsUnit_Name==""?$_Group=$URL:0;
$_GroupsUnit_Name==$URL?0:$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_GroupsUnit_Name.".count");
$_GroupsUnit_Tab_Count = 0 ;
if($_GroupsUnit_Name != $URL ) while($_GroupsUnit_Tab_Count<$_GroupsUnit_Number_of_Tabs) &_GroupsUnit_Load_Loop;
}

_GroupsUnit_RunCode_Load{
$_GroupsUnit_Name = prompt("Enter name of group to load.", "GroupUnit Name (load)");
if($_GroupsUnit_Name != "" ){
	$_Glist="";
	$_Glist=getpref( STRING, "k-meleon_Groups2.list");
	if(index( $_Glist, $_GroupsUnit_Name ) != -1){
		$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_GroupsUnit_Name.".count");
		$_GroupsUnit_Tab_Count = 0 ;
		id(ID_CLOSE_ALLTAB);
		$URLBAR="about:blank";
		while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Load_Loop;
	} else {
		alert("No group found with name: ".$_GroupsUnit_Name, "GroupUnit Name (load)", EXCLAIM);
	}
}
}

_GroupsUnit_Load_Loop{
$_GroupsUnit_URL = getpref(STRING, "k-meleon_Groups2.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count, $URL );
if($URLBAR=="about:blank"){
	open($_GroupsUnit_URL);
	$URLBAR="";
} else {
	opentab( $_GroupsUnit_URL );
}
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1;
}

_GroupsUnit_RunCode_Delete{
$_GroupsUnit_Name = prompt("Enter name of group to delete.", "GroupUnit Name (delete)");
if($_GroupsUnit_Name != "" ){
	$_Glist="";
	$_Glist=getpref( STRING, "k-meleon_Groups2.list");
	if(index( $_Glist, $_GroupsUnit_Name ) != -1){
		$_Glist = sub( $_GroupsUnit_Name."|", "", $_Glist );
		setpref( STRING, "k-meleon_Groups2.list", $_Glist );
		$_GroupsUnit_DelName = $_GroupsUnit_Name;
		$_GroupsUnit_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_GroupsUnit_Name.".count");
		$_GroupsUnit_Tab_Count = 0 ;
		while( $_GroupsUnit_Tab_Count < $_GroupsUnit_Number_of_Tabs ) &_GroupsUnit_Delete_Loop;
		#setmenu("_Groups_List",macro,"","");
		#alert($_Glist."\n just prior to call to _Groups2_BuildGroupsMenu", "DEBUG", "INFO");
		&_Groups2_BuildGroupsMenu;
	} else {
		alert("No group found with name: ".$_GroupsUnit_Name, "GroupUnit Name (delete)", EXCLAIM);
	}
}
}

_GroupsUnit_Delete_Loop{
$_GroupsUnit_Tab_Count == 0 ? delpref("k-meleon_Groups2.".$_GroupsUnit_Name.".count"):0;
delpref("k-meleon_Groups2.".$_GroupsUnit_Name.".".$_GroupsUnit_Tab_Count);
$_GroupsUnit_Tab_Count = $_GroupsUnit_Tab_Count + 1 ;
}

_Groups2_BuildMenu{
# Groups menu
if($kTabs){
	$_g="&Groups";
	setmenu(Main,popup,$_g,"&Tools");
	$__m="_Groups";
	setmenu($_g,inline,$__m);
	setmenu($__m,macro,"&Save a group",_GroupsUnit_RunCode_Save);
	setmenu($__m,macro,"&Load a group",_GroupsUnit_RunCode_Load);
	setmenu($__m,macro,"&Delete a group",_GroupsUnit_RunCode_Delete);
	setmenu($__m,separator,3);
	&_Groups2_BuildGroupsMenu;
}
}

_Groups2_BuildGroupsMenu{
  #alert("Just starting _Groups2_BuildGroupsMenu", "DEBUG", "INFO");
  $_g="&Groups";
  $_m="_Groups_List";
  setmenu($_g,inline,$_m);
  $__glist=getpref( STRING, "k-meleon_Groups2.list");
  #alert("Group list:\n".$__glist, "Groups2 DEBUG", INFO);
  while($__glist != ""){
	$__gname = substr($__glist, 0 , index($__glist, "|"));
	#alert("Group name:\n".$__gname, "Groups2 DEBUG", INFO);
	setmenu($_m,macro,$__gname,"_Groups2_OpenGroup(".$__gname.")");
	$__glist=sub( $__gname."|", "", $__glist );
	#alert("Group list:\n".$__glist, "Groups2 DEBUG", INFO);
    }
  $_GroupsUnit_DelName != ""?setmenu($_m,macro,$_GroupsUnit_DelName,"") : 0;
  rebuildmenu($_g);
  rebuildmenu($_m);
  $_GroupsUnit_DelName = "";
}

_Groups2_SetAccels{
# SHIFT VK_RETURN not work
setaccel("ALT VK_RETURN","macros(_Groups2_OpenGroup)");
}

$OnInit=$OnInit."_Groups2_SetAccels;_Groups2_BuildMenu;";
$macroModules=$macroModules."Groups2;";




Re: about Groups function
Posted by: pgf
Date: December 30, 2008 01:35PM

Thanks for your help.

But I still have a question. Why use session instead of group?
Why delete good functions when version updating?

Then I go back to the old version.

Re: about Groups function
Posted by: desga2
Date: December 30, 2008 08:27PM

@ pgf:

Sessions is better (more complete) than Groups because in Sessions you can save full session, this include; all windows opened with all his tabs, his windows size and possitions.
Groups only save tabs opened in current window.

It's possible that currently Sessions need some implementions to be more convenient use, and Groups can be comfortably replaced by Sessions but we need a little time to do it.

K-Meleon in Spanish



Edited 2 time(s). Last edit at 12/30/2008 08:28PM by desga2.

Re: about Groups function
Posted by: desga2
Date: December 30, 2008 09:19PM

Quote
JamesD
@ desga2

One concern about using "list" pref. Since that requires index and substr , will there be a problem for those who wish to use with a language which requires UTF-8? I had thought to use something like this.

k-meleon_GroupsUnit.count to keep total number of groups.
k-meleon_GroupsUnit.1 [2][3][4] etc to hold the name of the group.

That is very good with the inline menu. I have not yet discovered why the group name remains after the delete. I will keep trying.

The use of numbers to do this have a problem when you deleted a number of between.
For example if you have 4 Groups;

k-meleon_GroupsUnit.count = 4
k-meleon_GroupsUnit.1
k-meleon_GroupsUnit.2
k-meleon_GroupsUnit.3
k-meleon_GroupsUnit.4

Now you like delete Group number 3;
k-meleon_GroupsUnit.count = 3 (4-1)
k-meleon_GroupsUnit.1
k-meleon_GroupsUnit.2
k-meleon_GroupsUnit.4

How can we do for create the Group list menu?
How can we access to the Group number 4 to load it?

I thinking that you can are rigth with language which requires UTF-8, but this solution not work because it will generated new problems.

I thinking some hybrid solution between your and mine:
We can use a list of numbers instead groups name.
For example:
k-meleon_Groups2.list = "1|2|4|"

But now we need use first empty number in list when we created a new group.
In example we created a new group in 3 that is first empty/free number in list instead 5 that is next new number in list.

All this can complicate a little more the macro code.

Thanks for fix delete items in list Groups problem. I tried it before but I did something wrong. Now i can fixed.

In my before code there are some important implements that you can use:
- New main menu location created "&Groups" (like in old versions).
- Accelerator Alt+Enter to load a Group name typed in URL bar. (Add group method)
- "Load Group" in menu load group with replace current tabs method (like Sessions).
- List of groups in menu to load group with add group to current tabs method.

But i think that we are working for nothing because is more quickly copy original groups.kmm macro from 1.1.6 version and replace layers functions for tabs functions to work in 1.5.x tongue sticking out smiley
grinning smiley We are trying to reinvent the wheel. grinning smiley

K-Meleon in Spanish



Edited 1 time(s). Last edit at 12/30/2008 09:19PM by desga2.

Re: about Groups function
Posted by: JamesD
Date: December 31, 2008 02:19AM

@ desga2

I never used layers or groups so I don't know they did things. I do have plan to fix the delete group and sync up with number of groups. All I need is some time, but that is in short supply. As I have said before "life gets in the way of computing."

Re: about Groups function
Posted by: JamesD
Date: December 31, 2008 05:36AM

@ desga2

The users that are requesting Groups would be more at home with the groups.kmm from 1.1.6 because they know what it does. I took a look at the code there and noticed that it uses bookmarks. That would not help me because I use Favorites.

If it were a small amount of coding to update Groups to tab from layers then that may be better than to reinvent the wheel.

Since I do not know bookmarks at all, I would be very much behind the curve in helping on changing Groups. I may go ahead with groups2 even with its less functions.

If you work on changing Groups and need my help on something, please feel free to ask. Your help on GroupUnit/Groups2 has been wonderful.

Re: about Groups function
Posted by: JamesD
Date: January 03, 2009 01:17AM

@ desga2

This is an updated version of Groups2.kmm. It has an automatic upgrade from earlier version using pref "list" to this UTF-8 capable version.

There is no change to functions in this version. It is only to be able to work for users who need UTF-8 for proper display of text.

Groups2.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
# File name: Groups2.kmm
# ---------- Groups2 in tabs for K-Meleon 1.5.x ----
#
# Dependencies        : - main.kmm KM version 1.5 tabs
# Resources           : - 
# Preferences         : - k-meleon_Groups2.<name>,  <#>
#                     : - k-meleon_Groups2.<name>,<count>
#                     : - k-meleon_Groups2.count, <count>
#                     : - k-meleon_Groups2.<#>, <name>
# Version             : - 0.3a 2009-01-02
# Authors             : JamesD and desga2
# --------------------------------------------------------------------------------

_Groups2_RunCode_Save{
macroinfo="Save the current tab's URLS";
$_Groups2_Name = prompt("Assign a name for this group.", "Group Name (save)");
if($_Groups2_Name != "" ){
	macros(_Groups2_ObtainC) ;
	if ($_Groups2_Match== "true") { 
		$_Goverwrite = confirm("Group name: '".$_Groups2_Name."' already exist.\nDo you want overwrite it?", "Group Name (save)", YESNO, QUESTION);
		$_Goverwrite == "YES" ? plugin(macros,"_Goverwrite(".$_Groups2_Name.")") : 0;
	} else {
		setpref( STRING, "k-meleon_Groups2.". $_Groups2_Exist_Count, $_Groups2_Name ) ;
		$_Groups2_Exist_Count = $_Groups2_Exist_Count + 1;
		setpref( INT, "k-meleon_Groups2.count", $_Groups2_Exist_Count);
		$_Groups2_Number_of_Tabs = $TabNumber;
		$_Groups2_Tab_Count = 0;
		while( $_Groups2_Tab_Count < $_Groups2_Number_of_Tabs ) &_Groups2_Save_Loop;
		&_Groups2_BuildGroupsMenu;
	}
}
}

_Groups2_Save_Loop{
$_Groups2_Tab_Count == 0 ? setpref( INT, "k-meleon_Groups2.".$_Groups2_Name.".count", $_Groups2_Number_of_Tabs ) :0;
id(ID_TAB_NEXT);
setpref( STRING, "k-meleon_Groups2.".$_Groups2_Name.".".$_Groups2_Tab_Count, $URL );
$_Groups2_Tab_Count = $_Groups2_Tab_Count + 1;
}

_Goverwrite{
$_Groups2_Name = $ARG;
$_Groups2_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_Groups2_Name.".count");
$_Groups2_Tab_Count = 0 ;
while( $_Groups2_Tab_Count < $_Groups2_Number_of_Tabs ) &_Groups2_Delete_Loop;
$_Groups2_Number_of_Tabs = $TabNumber;
$_Groups2_Tab_Count = 0;
while( $_Groups2_Tab_Count < $_Groups2_Number_of_Tabs ) &_Groups2_Save_Loop;
}

Groups2_OpenGroup{
$_Groups2_Name = $ARG;
$_Groups2_Name==""?$_Groups2_Name=$URLBAR:0; $_Groups2_Name==""?$_Group=$URL:0;
$_Groups2_Name==$URL?0:$_Groups2_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_Groups2_Name.".count");
$_Groups2_Tab_Count = 0 ;
if($_Groups2_Name != $URL ) while($_Groups2_Tab_Count<$_Groups2_Number_of_Tabs) &_Groups2_Load_Loop;
}

_Groups2_RunCode_Load{
$_Groups2_Name = prompt("Enter name of group to load.", "Group Name (clear then load)");
if($_Groups2_Name != "" ){
	macros(_Groups2_ObtainC) ;
	if ($_Groups2_Match== "true") {	
		$_Groups2_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_Groups2_Name.".count");
		$_Groups2_Tab_Count = 0 ;
		id(ID_CLOSE_ALLTAB);
		$URLBAR="about:blank";
		while( $_Groups2_Tab_Count < $_Groups2_Number_of_Tabs ) &_Groups2_Load_Loop;
	} else { alert("No group found with name: ".$_Groups2_Name, "Group Name (load)", EXCLAIM); }
}
}

_Groups2_Load_Loop{
$_Groups2_URL = getpref(STRING, "k-meleon_Groups2.".$_Groups2_Name.".".$_Groups2_Tab_Count );
if($URLBAR=="about:blank"){
	open($_Groups2_URL);
	$URLBAR="";
} else {
	opentab( $_Groups2_URL );
}
$_Groups2_Tab_Count = $_Groups2_Tab_Count + 1;
}

_Groups2_RunCode_Delete{
$_Groups2_Name = prompt("Enter name of group to delete.", "Group Name (delete)");
if($_Groups2_Name != "" ){
	macros(_Groups2_ObtainC) ;
	if ($_Groups2_Match== "true") {	
		$_Groups2_DelName = $_Groups2_Name;
		macros(_Groups2_collapse);
		$_Groups2_Number_of_Tabs = getpref( INT, "k-meleon_Groups2.".$_Groups2_Name.".count");
		$_Groups2_Tab_Count = 0 ;
		while( $_Groups2_Tab_Count < $_Groups2_Number_of_Tabs ) &_Groups2_Delete_Loop;
		setpref( INT, "k-meleon_Groups2.count",$_Groups2_Exist_Count -1 )
		&_Groups2_BuildGroupsMenu;
	} else {
		alert("No group found with name: ".$_Groups2_Name, "Group Name (delete)", EXCLAIM);
	}
 }
}

_Groups2_Delete_Loop{
$_Groups2_Tab_Count == 0 ? delpref("k-meleon_Groups2.".$_Groups2_Name.".count"):0;
delpref("k-meleon_Groups2.".$_Groups2_Name.".".$_Groups2_Tab_Count);
$_Groups2_Tab_Count = $_Groups2_Tab_Count + 1 ;
}

_Groups2_ObtainC{
$_Groups2_Exist_Count = getpref( INT, "k-meleon_Groups2.count");
if ($_Groups2_Exist_Count!=0) {
	$_GU_cntr = 0;
	while($_GU_cntr < $_Groups2_Exist_Count) { macros(_Groups2_Read); }
	} 
}

_Groups2_Read{
$_Groups2_EName = getpref( STRING, "k-meleon_Groups2.". $_GU_cntr ) ;
$_Groups2_Match =  $_Groups2_Name == $_Groups2_EName ? "true" : "false" ;
if ($_Groups2_Match== "true") {
	$_Groups2_Match_cntr = $_GU_cntr;
	$_GU_cntr = $_GU_cntr + 990 ;
	} else { $_GU_cntr = $_GU_cntr + 1 ;}
}

_Groups2_collapse{
while (	$_Groups2_Match_cntr +1 < $_Groups2_Exist_Count ) {
	$_Groups2_collaspe_value = getpref( STRING, "k-meleon_Groups2.". $_Groups2_Match_cntr +1 ) ;
	setpref( STRING, "k-meleon_Groups2.".$_Groups2_Match_cntr, $_Groups2_collaspe_value);
	$_Groups2_Match_cntr = $_Groups2_Match_cntr +1 ;
	}
delpref("k-meleon_Groups2.".$_Groups2_Exist_Count -1);	
}

_Groups2_BuildMenu{
if($kTabs){
	$_g="&Groups";
	setmenu(Main,popup,$_g,"&Tools");
	$__m="_Groups";
	setmenu($_g,inline,$__m);
	setmenu($__m,macro,"&Save a group",_Groups2_RunCode_Save);
	setmenu($__m,macro,"&Load a group",_Groups2_RunCode_Load);
	setmenu($__m,macro,"&Delete a group",_Groups2_RunCode_Delete);
	setmenu($__m,separator,3);
	&_Groups2_BuildGroupsMenu;
	}
}

_Groups2_BuildGroupsMenu{
  $_g="&Groups";
  $_m="_Groups_List";
  setmenu($_g,inline,$_m);
  $_Groups2_Exist_Count = getpref( INT, "k-meleon_Groups2.count");
  if ($_Groups2_Exist_Count!=0) {
	$_GU_cntr = 0;
	while($_GU_cntr < $_Groups2_Exist_Count) { 
		$_Groups2_EName = getpref( STRING, "k-meleon_Groups2.". $_GU_cntr ) ;
		setmenu($_m,macro,$_Groups2_EName,"Groups2_OpenGroup(".$_Groups2_EName.")");	
		$_GU_cntr = $_GU_cntr + 1 ;	
		}
    $_Groups2_DelName != ""?setmenu($_m,macro,$_Groups2_DelName,"") : 0;	
	} 
  rebuildmenu($_g);
  rebuildmenu($_m);
  $_Groups2_DelName = "";
}

_Groups2_SetAccels{
setaccel("ALT VK_RETURN","macros(Groups2_OpenGroup)");
}

_Groups2_compat{
## Automatic update from Ver. 0.2c to Ver. 0.3x
$__glist="";
$__GCnt=0;
$__glist=getpref( STRING, "k-meleon_Groups2.list");
$__glist!= "" ? delpref("k-meleon_Groups2.list") :0;
while($__glist != ""){
	$__gname = substr($__glist, 0 , index($__glist, "|"));
	setpref( STRING, "k-meleon_Groups2.". $__GCnt, $__gname ) ;
	$__glist=sub( $__gname."|", "", $__glist );
	$__GCnt = $__GCnt +1;
	}
$__GRCnt = getpref( INT, "k-meleon_Groups2.count");
$__GRCnt != 0 ? $__GCnt =  $__GRCnt; 
setpref( INT, "k-meleon_Groups2.count", $__GCnt);
}

$OnInit=$OnInit."_Groups2_compat;_Groups2_SetAccels;_Groups2_BuildMenu;";
$macroModules=$macroModules."Groups2;";



Re: about Groups function
Posted by: desga2
Date: January 03, 2009 02:30AM

@ JamesD:

Thanks, I'll tested it this weekend.

Is this the same code than last email that you send me?
(Sorry sad smiley my english grammar is awful)

K-Meleon in Spanish



Edited 1 time(s). Last edit at 01/03/2009 10:41PM by desga2.

Re: about Groups function
Posted by: JamesD
Date: January 03, 2009 03:18AM

Quote
desga2

Is this the same code than last email that you send me?

No, I had some errors in G2_compat and this version of Groups2 is newer. Sorry about the email. My eyes not catch difference between : and ;.

Re: about Groups function
Posted by: misterp
Date: January 03, 2009 07:47AM

Here is another strategy - just have the option to load a session by adding the top tabs to the already open tabs. Then you don't have to keep track of a second set of groups/sessions.

This is just the macro I use, it is not pretty or good code, it contains two EN-US strings, but it is robust enough for my current sessions.

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

# ---------- Open top(last window) of Session as tabs ----------------------
#
# Dependencies	: main.kmm
# Resources	: -
# Preferences	: -
#
# -----------------------------------------------------------------------------


OpenAllGroup{
# Obtain Popups pref value:
$_PUB_value = getpref(BOOL, $pref_Popups);
$_PUB_value == true ? &pref_TogglePopups : 0;
$grpName = prompt("Session to add as tabs:","");
$num = getpref( INT, "kmeleon.plugins.sessions2." . $grpName . ".window0.count");
$_i = 0;
while ( $_i < $num ) &_OpenIt;
# Restore pref value:
$_PUB_value == true ? &pref_TogglePopups : 0;
}

# ----- PRIVATE

_OpenIt{
$tmp = getpref( STRING, "kmeleon.plugins.sessions2." . $grpName . ".window0.tab" . $_i);
$tmp = gsub("'","\\'",$tmp);
$srch = "http:";
&_FindLast;
$srch = "https:";
&_FindLast;
$srch = "chrome:";
&_FindLast;
$tmp = substr($tmp,0,index($tmp,"\t"));
openbgtab($tmp);
$_i = $_i + 1;
}

_FindLast{
$_index = index($tmp,$srch);
$_i2 = $_index;
while ($_index > -1) &_RmFront;
$_i2 > -1 ? $tmp = substr($srch,0,1).$tmp : 0;
}

_RmFront{
$tmp = substr($tmp,$_index+1);
$_index = index($tmp,$srch);
}

_AddSessionTabs_BuildMenu{
setmenu("&Load Session",macro,"Add as tabs","OpenAllGroup");
}

$OnInit=$OnInit."_AddSessionTabs_BuildMenu;";

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


Re: about Groups function
Posted by: JamesD
Date: January 03, 2009 08:30AM

@ misterp

Your AddSessionTabs.kmm is very good. You should put it into the MacroLibrary.

Re: about Groups function
Posted by: Alex.Tarantul
Date: August 20, 2009 12:53AM

Quote
JamesD
How can we do for create the Group list menu?
Tell me, please, how do I create a list of available groups in menu? Now I have to memorize the names of groups, but it is not good, because if a lot of teams, their all names difficult to remember grinning smiley



Edited 1 time(s). Last edit at 08/20/2009 12:54AM by Alex.Tarantul.

Re: about Groups function
Posted by: JamesD
Date: August 20, 2009 02:08AM

Alex

Are you using the groups2.kmm macro from the macrolibary? http://kmeleon.sourceforge.net/wiki/KmmGroups2

If this is the case, then you open in tabs each site you wish to include in a group. Have no other tabs open and click on "Groups" on the main menu. The first option on the dropdown is "Save a group". Click on that and you will get place to assign a name to the current group of tabs. Once you have done that, the name of the group will appear in the lower part of the dropdown each time you click on "Groups".

Hope this helps.

Re: about Groups function
Posted by: Alex.Tarantul
Date: August 20, 2009 07:09PM

Now all OK. It turned out I translated the menu macro to Russian language and a bit hurt the macro code. Now everything works. I see list of my saved groups. Thank you! (Excuse me for my bad english grinning smiley )

Re: about Groups function
Posted by: JamesD
Date: August 20, 2009 10:01PM

@ Alex

Glad you got it working. Do not worry about your English. Mine is not much better and I have 65 years of practice.

K-Meleon forum is powered by Phorum.