Acecool Proper Tabs - Prevent closing locked tabs

Tabs don't behave the way I expect them to behave so I'm writing a script to correct this. There are a few issues I've run into but I am working on resolving them. I am also looking into a way to add configuration to the scripts without requiring users to edit the files directly.

First script: Prevent locked tab from being closed ( unless you use the menu / right click > close to close it - There is no way to detect if the menu was used, or if middle click was used so I am adding a modifier + middle-click / menu option [ ie if modifiers { qualifiers } not "none" then allow, otherwise prevent... ] )

Acecool - Prevent Locked Tabs from being Closed without Modifier.js ( Will either be 1 file or a collection, although the process of renaming a zip file is stupid, of files with configuration options )

// Acecool™ - Prevent Locked Tabs From Being Closed Without Confirmation
// Josh 'Acecool™' Moser - 1985-Indefinitely - Released under the Acecool™ Company License ( ACL )
// This is a script for Directory Opus.
// See for development information.

// Called by Directory Opus to initialize the script
function OnInit( _data )
{ = "Acecool™ - Prevent Locked Tabs From Being Closed Without Confirmation";
	_data.version = "1.0";
	_data.copyright = "Josh 'Acecool™' Moser - 1985-Indefinitely - Released under the Acecool™ Company License ( ACL )";
//	_data.url = "";
	_data.desc = "Prevents you from being closed without confirming it first...";
	_data.default_enable = true;
	_data.min_version = "12.0";

// Prevent closing tabs when the tab is locked unless holding Ctrl / Alt / Shift ??....
// Called when a tab is closed - closeTabData -!Documents/Scripting/CloseTabData.htm
function OnCloseTab( _data )
	// Tab Object
	var _tab	=;

	// Lock State of Tab Object - Can be: "off", "on", "changes", "reuse"
	var _state	= _tab.lock;

	// Is the tab locked ( any state )
	var _locked = ( _state != "off" ) ? true : false;

	// Key Modifiers held while trying to close tab... - Can be: "none", "shift", "ctrl", "alt", "shift,ctrl", "shift,alt", "shift,ctrl,alt", "ctrl,alt"
	var _mods	= _data.qualifiers;
	var _modded	= ( _mods != "none" ) ? true : false;

	// Prevent closing the tab if the tab is locked and no mods are pressed...
	if ( _locked && !_modded )
		return true;

Planned: If you have a tab / path opened ( I may require it to be locked, or not ; depending on settings but by default it will do this regardless of lock status ) and you switch another tab to said path, then instead of that tab switching paths it remains the same and focuses the tab that is already opened.. Likewise, when going back ( and I hope we can alter the history system ) it will re-focus the other tab instead of switching the path since the path is already open...

On top of this, I may add config because multiple listers can be opened... that this switching will only occur for the current lister with an option to allow it to switch to other listers or dual panes... By default, as I only use 1 lister, it will allow hopping...

Could you adjust the subject of your thread to something like "Prevent locked tabs from being closed"?
Username and unknown abbreviations have not been used in thread subjects until now. Subjects already got kind of chaotic in the script addins area recently and maybe its a good idea to return to something which is more easy on the eyes (look at page 2 to get some examples).

Thank you! o))

I can add that to the subject to add a bit of clarity for the currently released script, but the package name is Proper Tabs because of all the changes planned.

Nothing against "Proper Tabs", but consider to remove "[ WIP ] Acecool Script Package" since it does not add any useful information. "Script packages" is what this forum is about (although your post does not contain one), "Acecool" is your nick and can be seen in the "First Post" column of the thread index and "[ WIP ]" - if it is really necessary, might be better placed at the end or ommitted completely, since you specifiy your script to be version 1.0, which does not imply work in progress.

Also consider to not use "_" as prefix for every variable you use or create, it's against all common practices in the world of scripting unless you like to mark private variables or function parameters, both of which is not the case here.

If you release script snippets under a specific license ("Released under the Acecool™ Company License (ACL)"), please put the full license here as well. I searched the interweb and could not find something like an Acecool Company License, so generic usage of this and wether this belongs here at all, is totally unclear. The same applies to the Acecool (TM) Trademark, I could not find an "Acecool" brand in the US or european union.

After all, a very bold initial post for an effective 6 lines of code.

Thanks. o)

Default script version ( I need to look into changing it as I use a different versioning system.. .. ) and having to change it every time I start a new script is annoying...

It will be a script package ( WIP == Work In Progress ) after I am done adding all of the features; I am still looking into the scripting system and am making a master-script-copy which basically is one file with all of the functions properly commented containing argument data and possibly with other documentation...

I am working on the final License; Acecool is my trademark since 1985 and I own ( was registered by me in the 90s and was somehow stolen by "Ace Kool" big wave surfer who is now deceased so I am working on reobtaining my domain names - Per trademark law since I coined the term first and have been operating under it the longest all other users of it are in violation - It is registered in the United States as a Business ). - In short, the license allows for being able to use, modify and redistribute with my copyright in addition to learning from it in order to build your own systems, but you may not sell it without express written consent.

If you learn from it and write your own system without using any of my code then you can do with it as you please; with some of these scripts though they are so basic that there are very few ways to write them for the same functionality therefore I am staking no claim ( and others may freely use my coding standards ) in it.

I will hopefully release the next part of it today but I am still reading up on tab manipulation, etc... and I am going to add the config system too..

So the license does not exist and neither does a trademark or domain. You obviously lack on DO scripting knowlegde too for now. Consider to take yourself some time to get into the things first and come here and present your results afterwards. Proper coding also means looking at what other people do in that domain and listening to what the community around it suggests. I don't think there's something wrong with posting snippets, but the ratio between blabla and result is nowhere near sensible right now. Since you also did not react to suggestions regarding the threads subject I must assume all you intend to create is noise.

EDIT: Oh the subject did change actually, maybe this is a starting point. o)

Legally a TradeMark doesn't need to be registered according to trademark government website - it acts similarly to copyright - as soon as something is created, it is copyright to the author.

When a new word used for business, etc.. is created ( Mine being Acecool meaning A School to revolve around my philosophy ) it is automatically TradeMarked and protected by Law... Should there be a lawsuit, the person with the earliest record of use of the name ( and the name can't simply be Toys Are Us - they used backwards R to create a new logo - my word combines two existing to make and mean something entirely new ) wins.... Take a look at the government site - I have records dating as early as 1989 showing my use of the word, and I registered the site in the early 90s ( which was stolen by my registrar who didn't honor the 10 year contract and I've been fighting to take the stolen site down - it is now down and I'm working on recovering my domain names )...

Hi, I'm using your script, and it's working well thank you.

But I usually use the ctrl + w hotkey to close tabs,
and it seems that your script currently doesn't prevent this.
Can you add this function?? It would be really appreciated.

1 Like

That's because the script checks if Ctrl (or Shift or Alt) is held down and reverts to normal behavior if it is:

// Prevent closing tabs when the tab is locked unless holding Ctrl / Alt / Shift ??....

To remove that, change this part:

	// Key Modifiers held while trying to close tab... - Can be: "none", "shift", "ctrl", "alt", "shift,ctrl", "shift,alt", "shift,ctrl,alt", "ctrl,alt"
	var _mods	= _data.qualifiers;
	var _modded	= ( _mods != "none" ) ? true : false;

To this:

	var _modded	= false;
1 Like

That was quick.
I really appreciate your help.
This was just what I needed. Thank you so much.

1 Like

Might there be a way to prevent it from closing even when "Close existing listers" is checked? I want to keep one dopus window permanently locked/pinned but close the other ones that tend to open all over—screenshot of the setting I'm talking about:


That's not related to tabs, right?

How would you identify your pinned lister? Via the layout that launched it?

Any way that works basically! I'm not too picky about it

Ah sorry, I didn't reply to you—Any way that works basically! I'm not too picky about it. But yes, it would be great to pick one lister layout (maybe the one I selected above) and have that one remain open/pinned but still be able to double click on the desktop to remove all the little ones

Here's an example, I'd like to pin my box sync folder (left, which opens on startup) but close the little ones that open as my default ones or by crtl + e (right)

Well, that question wasn't meant like "How do you want me to cook your steak?", but rather like "Where do we find something to eat?" :wink:

Meaning: I would need more info for a solution.

Since it's not really related to this script's topic I suggest you start a fresh thread in the help section.

This code will not work if this script is in use:

Also, this code prohibits opening tab groups correctly. All tabs are not closed when a tab group is loaded with "close existing folder tabs when opening this group" is selected. The left most tab in each pane of a dual lister remains open after loading the new tab group.

Event: ActivateLeftTabOnClose (switch to left instead of previously used tab) - Buttons/Scripts - Directory Opus Resource Centre (
This script is so simple I don't think it should be asked here.