GP SoftwareTwitter
Opus FAQsManualCommandsObjects

GoExisting - open path, focusing existing tab if found on either side


Jon very kindly made this script on this thread. It seems that it’ll be useful to more people so I thought I’d repost it here with a more general name.

The script is also explained on the DearOpus scripts page.

The usage is GoExisting path
This will open the specified path. If it already exists in an open tab, on either side of a dual lister, that tab will be recycled and focused. It’s similar to the findexisting argument, but it searches both sides of a dual lister.

Please anyone feel free to publish other versions, I just wanted to make a thread for the script.


GoExisting.js.txt (5.75 KB)

Findexisting anyside
Columns: Format My Date (define date columns using formatting syntax)
Findexisting anyside

For a long time now I have used a series of buttons tied to a modified GO script that defaults to NEWTAB=findexisting but my version did not check both sides of a DUAL. This is a very nice addition @jon and @playful and @jon’s ++index[e.item().right ? 1 : 0]; technique taught me something I had not seen in action before.

I like to use ctrl and shift qualifiers to open in dual or open in NEW. Here is a version that does that.

[code]// GoExisting
// Original code written by @jon
// Tweaked by @playful and posted as version 1
// USEQUALKEYS support added by @aussieboykie
// This is a script for Directory Opus.
// See for development information.
// Also see Findexisting anyside
// Called by Directory Opus to initialize the script
function OnInit(initData)
{ = “GoExisting”;
initData.desc = “”;
initData.copyright = “”;
initData.version = “1.1”;
initData.default_enable = false;

var cmd = initData.AddCommand(); = “GoExisting”;
cmd.method = “OnGoExisting”;
cmd.desc = “Equivalent of Go NEWTAB=findexistingdual”;
cmd.label = “GoExisting”;
cmd.template = “PATH”;

// Implement the GoExisting command
function OnGoExisting(scriptCmdData)
var cmdPfx = ‘Go "’ + scriptCmdData.func.args.path + ‘"’;
var cmdSfx = (scriptCmdData.func.qualifiers == “none”) ? “”:" USEQUALKEYS";
var cmdString = cmdPfx + cmdSfx;
if (scriptCmdData.func.sourcetab.lister.dual == 0) {
cmdString = cmdString + " NEWTAB=findexisting";
else {
if (!DoGoExisting(scriptCmdData, scriptCmdData.func.sourcetab.lister.tabs)) {
cmdString = cmdString + " NEWTAB";

function DoGoExisting(scriptCmdData, tabs)
var FSUtil = DOpus.FSUtil();
var e = new Enumerator(tabs);
var index = new Array(0, 0);
while (!e.atEnd())
if (FSUtil.ComparePath(e.item().path, scriptCmdData.func.args.path))
if (scriptCmdData.func.sourcetab.right != e.item().right)
scriptCmdData.func.command.AddLine(‘Set FOCUS=toggle’);
scriptCmdData.func.command.AddLine('Go TABSELECT ’ + index[e.item().right ? 1 : 0]);
return true;
++index[e.item().right ? 1 : 0];
return false;
Regards, AB


Hey aussieboykie,
Thank you, it’s great to see that thing evolve.

For the record I didn’t tweak anything, only changed the name. :slight_smile:


I liked the original name myself :slight_smile:


Yeah I suppose descriptive names are overrated. Remember when you could get away with calling things v1, v2, v3, or calling the princess “kong” and the gorilla “cinderalla” Those where the days. :wink:


I see why! Leaving names as they are won’t yield problems, like when switching lang… just kidding! o))

Why is it, you only add the USEQUALKEYS switch to the GO command, when there are qualifiers held down?
Will there be any harm if USEQUALKEYS is always present and no qualifier held down? I’d say no, but not sure.



I’m sure you are right. A simple case of over engineering!

Regards, AB


“Over engineering”, I think I like that expression. o) Ok, thank you for clarifying. I am not familiar with that switch, never used it myself, but wanted to make sure to not miss a thing. I fixed the non-mirroring issue within the existing versions, will upload anytime soon. A nice weekened for all! o)