Page 2 of 2

Re: Close tabs to the right

Posted: 02 Sep 2020 21:47
by highend
"Close Tabs Rt"

And you see a label in the original script that has the exact same name? Apart from the fact that no label at all needs to be used because the script only has a single one...

Re: Close tabs to the right

Posted: 02 Sep 2020 22:49
by mikeshick
I think I misunderstood what label stands for. I need to read the help files more..but I have a bit difficult time understanding. Sorry...and thank you.

Re: Close tabs to the right

Posted: 02 Sep 2020 22:50
by mikeshick
Can this script be modified to close tabs to the right when they are unlocked?

Re: Close tabs to the right

Posted: 02 Sep 2020 22:54
by highend
tab() has the operation "get" with the data of "flags" that can return if a tab is locked...

Re: Close tabs to the right

Posted: 02 Sep 2020 23:48
by mikeshick
I tried this:
"Close Tabs to the Right"
$curTabID = tab("get", "flags");
$cntTabs = tab("get", "count");
$maxTabs = $cntTabs - $curTabID;
while($i++ < $maxTabs) { tab("close", 0, $curTabID + 1); }

but all my unlocked tabls disappeared.

Re: Close tabs to the right

Posted: 02 Sep 2020 23:59
by highend
Em, what?

Does using "flags" return the id of a tab? Not really.
And how should this work at all if you don't check if the return value of "flags" matches (or not) if a tab is locked?

Code: Select all

$curTabID = tab("get");
    $maxTabID = tab("get", "count");
    while($maxTabID > $curTabID) {
        // Close only non-locked tabs (1 = Locked location)
        if ( tab("get", "flags", $maxTabID) != 1) { tab("close", 0, $maxTabID); }
        $maxTabID--;
    }

Re: Close tabs to the right

Posted: 03 Sep 2020 00:38
by mikeshick
Yeah...I don't know the language at all. I get it conceptually, but don't know the detail. Thanks for your help.

Do you have recommendations for learning it?

Re: Close tabs to the right

Posted: 03 Sep 2020 09:28
by highend
Read the scripting topics in the help file and read and write code as much as possible (viewtopic.php?f=7&t=12509)