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

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Dustydog
Posts: 321
Joined: 13 Jun 2016 04:19

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

Post 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.)

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

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

Post 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); }
One of my scripts helped you out? Please donate via Paypal

Dustydog
Posts: 321
Joined: 13 Jun 2016 04:19

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

Post by Dustydog »

Thank you for your time highend. That really helped.

Post Reply