Rename tabs to first 9 characters
-
dogeatdog
- Posts: 45
- Joined: 29 Sep 2019 04:04
Rename tabs to first 9 characters
is it possible to rename tabs to a variable like the first 9 characters of a folder?
-
Norn
- Posts: 522
- Joined: 24 Oct 2021 16:10
Re: Rename tabs to first 9 characters
Code: Select all
//Rename tabs to first 9 characters of folder
$tabs = get("tabs", "|");
foreach($tab, $tabs, "|") {
$count++;
$path = tab("get", "path", $count);
$base = gpc($path, "base");
$newCapation = substr($base, 0, 9);
tab("rename", $newCapation, $count);
}Windows 11 24H2 @100% 2560x1440
-
dogeatdog
- Posts: 45
- Joined: 29 Sep 2019 04:04
Re: Rename tabs to first 9 characters
Norn that's incredible thank you very much.
One annoying request is can the tab somehow update automatically when changing directory? I notice the tab just has a text field, I tried to have it load a script but I couldn't get it to work.
I would be so grateful to get this working.
One annoying request is can the tab somehow update automatically when changing directory? I notice the tab just has a text field, I tried to have it load a script but I couldn't get it to work.
I would be so grateful to get this working.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Rename tabs to first 9 characters
tab("rename", substr(gpc(tab("get", "path"), "base"), 0, 9));and use it as a script for: configuration - custom event actions => after painting the file list?
One of my scripts helped you out? Please donate via Paypal
-
dogeatdog
- Posts: 45
- Joined: 29 Sep 2019 04:04
Re: Rename tabs to first 9 characters
Thank you highend I love this community so much.
Is it possible to exclude some tabs somehow or only apply the script to the first two tabs on a given pane? It's always the same tabs they are locked and don't move only on the first pane.
Is it possible to exclude some tabs somehow or only apply the script to the first two tabs on a given pane? It's always the same tabs they are locked and don't move only on the first pane.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Rename tabs to first 9 characters
Code: Select all
if (regexmatches(tab("get", "id"), "^(1|2)$")) {
tab("rename", substr(gpc(tab("get", "path"), "base"), 0, 9));
}
One of my scripts helped you out? Please donate via Paypal
-
dogeatdog
- Posts: 45
- Joined: 29 Sep 2019 04:04
Re: Rename tabs to first 9 characters
Highend, you are impressive.
Thank you very much, works perfectly

Thank you very much, works perfectly
-
Garonne
- Posts: 195
- Joined: 21 Apr 2015 19:10
- Location: Win11, 100% Scaling
- Contact:
Re: Rename tabs to first 9 characters
That should be extendable with "special" handling for tabs you might want to name individually, right?highend wrote: ↑12 Aug 2022 07:45?Code: Select all
if (regexmatches(tab("get", "id"), "^(1|2)$")) { tab("rename", substr(gpc(tab("get", "path"), "base"), 0, 9)); }
That's not a request for another update of your code, though... If I need another if...then...else I'm sure, that's done easily enough if I take the time to dive into the scripting guide...
XYplorer Beta Club