Page 1 of 1

What's the easiest way to check if a tab exists...?

Posted: 04 Mar 2020 20:58
by Dustydog
What's the easiest way to check if a tab (in the unfocused pane) already exists, and to use that tab if it does? Else open a new tab to that path? (That last I believe I have down just fine, but I'd like to see how someone else does it; I suspect there may be an easier way.)

Re: What's the easiest way to check if a tab exists...?

Posted: 04 Mar 2020 21:20
by highend

Code: Select all

    $path  = "<path of a tab>";
    $index = gettokenindex($path, get("Tabs", , "i"), , "i");
    focus "PI";
    if ($index) { seltab $index; } else { tab("new", $path); }

Re: What's the easiest way to check if a tab exists...?

Posted: 07 Mar 2020 08:49
by Dustydog
Thank you for your time highend. That really helped.