Close tabs to the right

Discuss and share scripts and script files...
highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Close tabs to the right

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

mikeshick
Posts: 124
Joined: 06 Jul 2020 10:28

Re: Close tabs to the right

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

mikeshick
Posts: 124
Joined: 06 Jul 2020 10:28

Re: Close tabs to the right

Post by mikeshick »

Can this script be modified to close tabs to the right when they are unlocked?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Close tabs to the right

Post by highend »

tab() has the operation "get" with the data of "flags" that can return if a tab is locked...
One of my scripts helped you out? Please donate via Paypal

mikeshick
Posts: 124
Joined: 06 Jul 2020 10:28

Re: Close tabs to the right

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

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Close tabs to the right

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

mikeshick
Posts: 124
Joined: 06 Jul 2020 10:28

Re: Close tabs to the right

Post 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?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Close tabs to the right

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

Post Reply