One thing I really like(d) in TabMix Plus for FF was the possibility to close tabs on the left etc. from the context menu when right-clicking on a tab - could someone help me to add this ?
Thanks !
@Yogi, yes I know that but it's not what I asked about : say you have ten tabs open, you're on the middle tab and you want to close all the tabs on the right (or left)...
Quote desga2
@ mhf:
This can be do with a macro, you can begin to make it when you want.
Either that is the wrong item or my setmenu statements are not valid.
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- EndTabLR.kmm
# ---------- K-Meleon Macro Language Close all tabs to left or right of current ---
#
# Dependencies : main.kmm, tabs plugin active
# Resources : -
# Preferences : -
# Version : 0.2 2009-07-22
# --------------------------------------------------------------------------------
_CloseAllLeft {
alert("close all left", "DEBUG", INFO);
}
_CloseAllRight {
alert("close all right", "DEBUG", INFO);
}
_EndTabLR_ModMenu{
### add another option to menu
setmenu("TabButtonPopup",macro,_("Close All Left"), _CloseAllLeft );
setmenu("TabButtonPopup",macro,_("Close All Right"),_CloseAllRight );
$OnStartup=$OnStartup."_EndTabLR_ModMenu;";
#$OnInit=$OnInit."_EndTabLR_ModMenu;";
$macroModules=$macroModules."EndTabLR;";
Re: Close left tabs, close right tabs
Posted by:
mhf
Date: July 23, 2009 05:02AM
I'm following you JamesD but I don't know enough (anything) about it so can't help but it's looking good !
_EndTabLR_ModMenu{
### add another option to menu
setmenu("TabButtonPopup",macro,_("Close All Left"), _CloseAllLeft );
setmenu("TabButtonPopup",macro,_("Close All Right"),_CloseAllRight );
}<= CLOSE THE FUNCTION !!!
Well, I have egg all over my face again. Thank you for spotting the missing brace.
I guess my next project will be to automate the Error Console to run OnStartup if user pref "k-meleon.errorchecking" is set to true. Then I will have to remember to set the pref when starting a new project.
This is not as automatic as I had hoped. There does not seem to be a variable to inform the MacroLanguage of the index number of the current tab. For now, at least, you must eyeball the tab bar or tab list and enter a number for how many tabs to delete.
EndTabLR.kmm
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- EndTabLR.kmm
# ---------- K-Meleon Macro Language Close all previous or next tabs from current --
#
# Dependencies : main.kmm, tabs plugin active
# Resources : -
# Preferences : -
# Version : 0.4 2009-07-23
# --------------------------------------------------------------------------------
_EndTabLR_CloseLeft {
$_EndTabLR_TabCount = prompt ("How many previous tabs to close?","Enter an integer");
$_EndTabLR_Count=0;
while ($_EndTabLR_Count < $_EndTabLR_TabCount) {
id(ID_TAB_PREV) ;
id(ID_CLOSE_TAB) ;
$_EndTabLR_Count=$_EndTabLR_Count+1;
}
}
_EndTabLR_CloseRight {
$_EndTabLR_TabCount = prompt ("How many next tabs to close?","Enter an integer");
$_EndTabLR_Count=0;
while ($_EndTabLR_Count < $_EndTabLR_TabCount) {
id(ID_TAB_NEXT) ;
id(ID_CLOSE_TAB) ;
$_EndTabLR_Count=$_EndTabLR_Count+1;
}
}
_EndTabLR_ModMenu {
## add another option to menu
setmenu ("TabButtonPopup",separator, -1 );
setmenu ("TabButtonPopup",macro, _("Close # Previous Tabs"), "_EndTabLR_CloseLeft" );
setmenu ("TabButtonPopup",macro, _("Close # Next Tabs"), "_EndTabLR_CloseRight" );
}
$OnStartup=$OnStartup."_EndTabLR_ModMenu;";
#$OnInit=$OnInit."_EndTabLR_ModMenu;";
$macroModules=$macroModules."EndTabLR;";
Re: Close left tabs, close right tabs
Posted by:
mhf
Date: July 23, 2009 10:55PM
Thanks JamesD - I'll give it a spin and let you know how it goes.
But you know the current $URL and $TITLE, you can compare it with the others to find it.
Start in first tab, compare $URL with tabs and when this is match you have the current tab number and you can close other tabs to left or right without prompt for how much you want to close.
Quote desga2
But you now the current $URL and $Title, you can compare it with the others to find it.
Start in first tab, compare $URL with tabs and when this is match you have the current tab number and you can close other tabs to left or right without prompt for how much you want to close.
How do I determine the first tab? I can compare next with current until I have a match, but then all I will know is how many total tabs. That is already available. I first tried to close each "next" tab thinking that would end at right most tab. Every tab but the current one closed. It made a circle and came back down the left or previous side. Also I think users can clone a tab. I would get an early match then, would I not?
That's great. I wish I could get full automation but the critical piece of data, the tab number of the current tab, does not seem to be available to the MacroLanguage.
Re: Close left tabs, close right tabs
Posted by:
mhf
Date: July 24, 2009 09:54PM
@ JamesD - it's OK, it's fine like that although of course fully automatic would be better.
I'd have thought the tab information must be in there somewhere because of the "Close other tabs" command...?
Quote mhf
I'd have thought the tab information must be in there somewhere because of the "Close other tabs" command...?
There is a specific Command ID to do that.
Quote http://kmeleon.sourceforge.net/wiki/CommandIDs
ID_CLOSE_ALLOTHERTAB
Only 1.5 and later. Close all other tabs but not current active tab.
@TabList knows the position of the current tab, but it not provided to the MacroLanguage. The "Tabs" item in the menu just above "Close # Previous Tabs" shows a check next to the current tab within the list of tabs. It would be great if we had a Special Variable "$TabIndex" which contained the position of the check. However, we don't. We have only "$TabNumber" which is the total number of tabs in the window.
i think it's very good cause sometimes you don't want to close all tabs on the left or on the right..so number input can be a good thing. it's like a feature
i've added endtabs to kmext under enhancements next to autotab switcher