Can we rename a tab in a script?

Discuss and share scripts and script files...
Biggynuff
Posts: 110
Joined: 13 May 2010 14:08

Can we rename a tab in a script?

Post by Biggynuff »

Hi all,

I have a toolbar button I find really useful. It very simply allows me (with one click) to close all tabs in the current window, then open tabs for pre selected folders, auto size the columns for all tabs and lock them to the folders used most often . . . very easy in XY but incredibly useful to me 8)

I've found the tab renaming feature to be excellent. It means I can look at a tab and read a user friendly name instead of a path name or folder name

Now, in the script I can use the #342; command to rename the tab, but this command opens up a 'user input' box to enter the name required for the tab. A bit tedious having to do it each time I open 6 or 7 new tabs :oops:

My question is, is there a way to include text for the name of the tab inside the script on the toolbar button that opens the tabs, so the tabs can be renamed automatically by XY???

A simple part of the script looks like this:

Code: Select all

 #340; //Open a new tab
 #353; //Now close all other tabs
 goto Computer; //go to location
 #372; // Auto size the columns
 #350; // Lock the tab

???Can I use a command here to rename the tab without the text box appearing???
This is followed by several other entries which do the same but for different folders

Any suggestions welcome :P

admin
Site Admin
Posts: 66249
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Can we rename a tab in a script?

Post by admin »

I could add a new scripting command to rename a tab. But since there is no way (for the user) to identify a tab, it would only work for the current tab. Would that work for you?

Biggynuff
Posts: 110
Joined: 13 May 2010 14:08

Re: Can we rename a tab in a script?

Post by Biggynuff »

Hi Don,

I didn't mean to cause you any work :shock:

I'm not sure if this would be useful to other users, but I could certainly see it being a benefit. The user not being able to select the tab shouldn't be a problem for my idea . . . as soon as the command is used to create the new tab it is automatically selected anyway, so the rename function could be used as the very next command in the script

Any thoughts?

Just for interest, I've found the toolbar button to open preselected tabs for commonly used folders to be amazingly useful. I have several sets of tabs available under just a few menu items. It's almost like loading up a new config in the blink of an eye and makes working a breeze

Wow, XY is just better and better :P

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Can we rename a tab in a script?

Post by TheQwerty »

Biggynuff wrote:I'm not sure if this would be useful to other users..
Oh it would be.. I've suggested this before as a new Tab function: http://www.xyplorer.com/xyfc/viewtopic. ... 008#p30008
admin wrote:
TheQwerty wrote:My mind-blowing idea for the day... new function Tab()!
I think this is pretty self explanatory - otherwise ask.

Number = Tab([Type], [Location], [Name], [Iconize]);

Args:
Type: c|f|b = Current Tab, New Foreground Tab, or New Background Tab.
Location: If omitted, <curpath> is used.
Name: If omitted, tab is not renamed or name is removed.
Iconize: 0|1

Returns:
The tab's number by position for use by SelTab().
Looks good!
Don thought it was so good it needed to sit for a 550 days. :P

EDIT: Now it probably makes sense to extend type out so it's possible to create tabs in either pane or add a another argument to chose pane by A|I|1|2.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Can we rename a tab in a script?

Post by Stefan »

I am also interested for more Tab SC functions.

Maybe it helps to remind to this ideas too:
http://www.xyplorer.com/xyfc/viewtopic. ... 943#p43943
Stefan wrote:Disadvantage: if there are two tabs with same path, my script quits at the second found tab with that name.
@Don
the "seltab +;" do cycle from last tab to first and so on.
Could there be an option to stop at the most right tab? Like "seltab +!;"

How can i count open tabs (from one pane)?
Since 'seltab +;' does cycle from last to first.

I want to read the curpath of all tabs... but only once.
My solution above fails if two tabs point to the same path.
Did i have overseen an solution?
admin wrote:I think it would be a bit easier if I gave you a getInfo("tabs") and openInTabs(pathlist).

But note that each tab also might have fully defined find files specs and a search results cache... it's not just the path.

admin
Site Admin
Posts: 66249
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Can we rename a tab in a script?

Post by admin »

TheQwerty wrote:
Biggynuff wrote:I'm not sure if this would be useful to other users..
Oh it would be.. I've suggested this before as a new Tab function: http://www.xyplorer.com/xyfc/viewtopic. ... 008#p30008
admin wrote:
TheQwerty wrote:My mind-blowing idea for the day... new function Tab()!
I think this is pretty self explanatory - otherwise ask.

Number = Tab([Type], [Location], [Name], [Iconize]);

Args:
Type: c|f|b = Current Tab, New Foreground Tab, or New Background Tab.
Location: If omitted, <curpath> is used.
Name: If omitted, tab is not renamed or name is removed.
Iconize: 0|1

Returns:
The tab's number by position for use by SelTab().
Looks good!
Don thought it was so good it needed to sit for a 550 days. :P

EDIT: Now it probably makes sense to extend type out so it's possible to create tabs in either pane or add a another argument to chose pane by A|I|1|2.
It was in the back of my head all the time.

I now did it, but differently. The result is quite the same though IMO.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Can we rename a tab in a script?

Post by TheQwerty »

admin wrote:I now did it, but differently. The result is quite the same though IMO.
Umm.. it's better than nothing but I think what I detailed was a much nicer and cleaner function.

The version you created looks kind of painful to use. :P

And using numbers instead of names for the operation seems like a huge mistake to me - I'll never remember those and it diverges from GetInfo() in a way that can be confusing.

admin
Site Admin
Posts: 66249
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Can we rename a tab in a script?

Post by admin »

TheQwerty wrote:
admin wrote:I now did it, but differently. The result is quite the same though IMO.
Umm.. it's better than nothing but I think what I detailed was a much nicer and cleaner function.

The version you created looks kind of painful to use. :P

And using numbers instead of names for the operation seems like a huge mistake to me - I'll never remember those and it diverges from GetInfo() in a way that can be confusing.
The latter is already changed in my version. Other than that: great function. What's the problem?
Or how do you do this with your function?

Code: Select all

      // name the last tab "Gozilla" (needs v9.30.0006!)
      tab("rename", "Gozilla", -1);

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Can we rename a tab in a script?

Post by TheQwerty »

admin wrote:Or how do you do this with your function?

Code: Select all

      // name the last tab "Gozilla" (needs v9.30.0006!)
      tab("rename", "Gozilla", -1);
Okay, so my way requires that we have "GetInfo('TabCount')" and then only renames the current tab:

Code: Select all

SelTab(GetInfo('TabCount'));
Tab('C',, 'Gozilla');
But I feel that's a corner case that's not going to be used often... let's create a new background tab named 'Gozilla' that points to 'C:\Program Files\Gozilla\', which I suspect is a more typical usage...

My way:

Code: Select all

Tab('B','C:\Program Files\Gozilla\','Gozilla');
Your way:

Code: Select all

Tab('Rename','Gozilla',Tab('Newb','C:\Program Files\Gozilla\'));


I see the merit of your way, but I think it would have been better conceptualized as:
$tabIndex = NewTab('C|B|F',[Location],[Rename],[Iconize]);
TabOption('Rename|Iconize|...',Data,Index);
GetInfo('TabCount',[Pane]);
:?

EDIT: Updated Your Way to use named arguments from 9.30.0006.

admin
Site Admin
Posts: 66249
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Can we rename a tab in a script?

Post by admin »

What runs slicker with a user depends on the work style. The current implementation can do a lot of things, is quite intuitive IMO, and is easily extensible (without adding new arguments as would be necessary in your version).

admin
Site Admin
Posts: 66249
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Can we rename a tab in a script?

Post by admin »

PS: Sorry about introducing "Gozilla" -- the spelling is "Godzilla" of course!

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Can we rename a tab in a script?

Post by TheQwerty »

I don't think there is any question that more people are looking for the ability to create and name a tab than are looking to name the right-most tab.

Making a less desired task easier than one that is more common is not intuitive - it's absurd.

EDIT: I thought maybe we were trying to avoid a lawsuit by using Gozilla. :P

admin
Site Admin
Posts: 66249
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Can we rename a tab in a script?

Post by admin »

I thought your way had holes. E.g. what would this mean? Goto 'C:\Program Files\Gozilla\' and remove any name?

Code: Select all

Tab('C','C:\Program Files\Gozilla\');

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Can we rename a tab in a script?

Post by TheQwerty »

admin wrote:I thought your way had holes. E.g. what would this mean? Goto?

Code: Select all

Tab('C','C:\Program Files\Gozilla\');
Yes it would be equivalent to Goto, but I don't see any problem with that.

In fact it would be kind of useful since you can reuse the same code to open a new foreground/background tab or use the current tab, instead of having to branch your script flow.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Can we rename a tab in a script?

Post by Stefan »

1.)
Those examples didn't work for me:

Code: Select all

v9.30.0005 - 2010-07-21 17:22
    + Scripting got a new function.
      Name:   tab
      Action: Opens a new tab or modifies a tab.
      Syntax: tab([operation], [data], [index])


      Examples:                 
        text tab(); //ret index of current tab (first tab = 0)
        text tab(, "c"); //ret tab count
This works:

Code: Select all

      Examples:                 
        text tab(0); //ret index of current tab (first tab = 0)
        text tab(0, "c"); //ret tab count

2.)
The change log of v9.30.0003 is not updated yet, style No.2 is missed:

Code: Select all

    + SC inputselect enhanced: Added a way to show checkboxes.
      See updated change log of v9.30.0003.

        style:      1 = show file system icons for the items (= default)
                    2 = show tick boxes

Post Reply