Looking to always open tree selection in the same tab

Hello,

I'm getting used to working with Directory Opus and love it. Is there a way to open a folder I select from the tree always in the same tab?

Basically I have dual panes + a ton of tabs open, and whenever I click on a folder in the tree, it opens it in the last active tab, which is not always quick to find.

Instead of opening what I select in the last active tab (or instead of changing the tab I'm in to the new folder), I would like to make it so that any folder I select in the tree always open in the first, most left tab. Is this possible? Thanks so much in advance

Really? Is it not directly in front of you?

How did you configure Preferences / Folder Tree / Selection Events?


Here's a user command script that should do what you want.

function OnClick(clickData) {
    var cmd = clickData.func.command;
    cmd.deselect = false;
    cmd.RunCommand('Go TABPOS=first');
    cmd.RunCommand('Go PATH="' + cmd.files(0) + '"');
}
as XML
<?xml version="1.0"?>
<button backcol="none" display="icon" textcol="none">
	<label>UC38321</label>
	<icon1>#usercommand</icon1>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>// https://resource.dopus.com/t/looking-to-always-open-tree-selection-in-the-same-tab/38321</instruction>
		<instruction />
		<instruction>function OnClick(clickData) {</instruction>
		<instruction>    var cmd = clickData.func.command;</instruction>
		<instruction>    cmd.deselect = false;</instruction>
		<instruction>    cmd.RunCommand(&apos;Go TABPOS=first&apos;);</instruction>
		<instruction>    cmd.RunCommand(&apos;Go PATH=&quot;&apos; + cmd.files(0) + &apos;&quot;&apos;);</instruction>
		<instruction>}</instruction>
	</function>
</button>
How to

How to use buttons and scripts from this forum

That's awesome! Thanks so much for that script. Since I'm in a dual pane view, is there a way to make that folder always open in the left pane?

Try

function OnClick(clickData) {
    var cmd = clickData.func.command;
    var tab = clickData.func.sourcetab;
    var dtab = clickData.func.desttab;;
    cmd.deselect = false;

    if (tab.right) {
        cmd.SetSourceTab(dtab);
        cmd.RunCommand('Set SOURCE=left');
        cmd.RunCommand('Set FOCUS=left');
    }

    cmd.RunCommand('Go TABPOS=first');
    cmd.RunCommand('Go PATH="' + cmd.files(0) + '"');
}

Thanks so much for your help!

Actually it wasn't so much a question of speed :wink: It's to avoid losing sight of folders I need to see at all times while working. Thanks to your script I can have them all open in the right pane and only affect my left pane while navigating. Thanks again

You can lock folder tabs so that folder changes are always redirected to another tab, or so that you can change folders in a tab but then click the tab again to revert back to the original "locked" folder. That may provide a cleaner way to do what you want.

More detail at the bottom of this page:

https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Tabs.htm

Thanks Leo! I love the locked tab feature and use it a lot. I just wanted to find a way to have the new selection always open in the first tab.

1 Like