Last folder highlight
-
ivan
- Posts: 577
- Joined: 02 Apr 2008 12:52
- Contact:
Last folder highlight
Hello,
Having brainstormed a little, I came up with this suggestion:
Would it be possible to have an option so when clicking in the address bar only the last folder's name is highlighted?
Example:
The tree to the folder you're in looks like this: abc\def\ghi\jkl\ and you have a file in folder jkl that you want to rename to jkl (so the folder and the file in it are the same name, including upper and lower cases). Normally, first i'd click to select the whole tree and then click again and move the mouse to highlight the folder, press Ctrl + C and you know the rest. It would be much more convenient if by default it was possible to highlight the last folder (in this case it'd be jkl) on the very first click.
Thank you very much in advance!
Having brainstormed a little, I came up with this suggestion:
Would it be possible to have an option so when clicking in the address bar only the last folder's name is highlighted?
Example:
The tree to the folder you're in looks like this: abc\def\ghi\jkl\ and you have a file in folder jkl that you want to rename to jkl (so the folder and the file in it are the same name, including upper and lower cases). Normally, first i'd click to select the whole tree and then click again and move the mouse to highlight the folder, press Ctrl + C and you know the rest. It would be much more convenient if by default it was possible to highlight the last folder (in this case it'd be jkl) on the very first click.
Thank you very much in advance!
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
Even easier than that: you can use a script to do it for you!
Create a new UDC under "Run Script" and put this :
Then, you can simply go into D:\abc\def\ghi\jkl and select a file, execute the script, and the file should be renamed to "jkl" ! (extension unaffected)
Create a new UDC under "Run Script" and put this :
Code: Select all
regexreplace $name, <curitem>, "^.+\\([^\\]+?)\\[^\\]+?.*$", "$1";
rename bat, $name;Proud XYplorer Fanatic
-
ivan
- Posts: 577
- Joined: 02 Apr 2008 12:52
- Contact:
I take it the script has to be in the same folder as the file to be renamed? I actually already have a proggie that deals with renames on a massive scale. This is just a one file at a time job so I don't know how much of an alternative copying script over, running it and so on would be to a couple of clicks and drags but thank you nevertheless 
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
No, go in menu "User|Manage Commands" and then under "Run Script" you create a new UDC with the given script.ivan wrote:I take it the script has to be in the same folder as the file to be renamed?
Then, anytime you need to trigger it you just select the file to rename, and use menu "User|Run Script|[whatever name you gave it]" or, of course, you can assign a keyboard shortcut to it so that you only have to press the key of your choice to trigger it!
Proud XYplorer Fanatic
-
admin
- Site Admin
- Posts: 66324
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Nice one, jacky!jacky wrote:Even easier than that: you can use a script to do it for you!
Create a new UDC under "Run Script" and put this :Then, you can simply go into D:\abc\def\ghi\jkl and select a file, execute the script, and the file should be renamed to "jkl" ! (extension unaffected)Code: Select all
regexreplace $name, <curitem>, "^.+\\([^\\]+?)\\[^\\]+?.*$", "$1"; rename bat, $name;
PS: you should post it in Script Exchange...
FAQ | XY News RSS | XY X
-
ivan
- Posts: 577
- Joined: 02 Apr 2008 12:52
- Contact:
-
admin
- Site Admin
- Posts: 66324
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
As jacky posted it, it's a multiline script. So take care that the 2nd line is indented.ivan wrote:weird, it didn't work for me
when i try do apply the UDC it renames the file to $name and not the folder's name
FAQ | XY News RSS | XY X
-
ivan
- Posts: 577
- Joined: 02 Apr 2008 12:52
- Contact:
-
admin
- Site Admin
- Posts: 66324
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
That's automatic if a file of the name already exists! (avoids collision)ivan wrote:Yep, I've corrected it but now it adds "-01" to the end of the filename (exc extension)
FAQ | XY News RSS | XY X
-
ivan
- Posts: 577
- Joined: 02 Apr 2008 12:52
- Contact:
-
admin
- Site Admin
- Posts: 66324
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
If the extension is different, no number is suffixed (there would be no collision).ivan wrote:Technically the file of the same name doesn't exist because of different case and extension
FAQ | XY News RSS | XY X
-
ivan
- Posts: 577
- Joined: 02 Apr 2008 12:52
- Contact:
-
admin
- Site Admin
- Posts: 66324
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
But I just tried it and it works.ivan wrote:Well I'd hate to disappoint you but it seems that there is a collision happening. jacky said that in that script extension is unaffected so maybe it doesn't take it into account when renaming and this results in a collision?
So what are your files in what folder? Show me the constellation that breaks my code!
FAQ | XY News RSS | XY X
-
j_c_hallgren
- XY Blog Master
- Posts: 5826
- Joined: 02 Jan 2006 19:34
- Location: So. Chatham MA/Clearwater FL
- Contact:
Me too! Worked just fine! But I had to go into editor mode to paste the copied script as it needed to be, however.admin wrote:But I just tried it and it works.![]()
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
-
admin
- Site Admin
- Posts: 66324
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
I see it's about time to add some file-based export/import for UDCs...j_c_hallgren wrote:Me too! Worked just fine! But I had to go into editor mode to paste the copied script as it needed to be, however.admin wrote:But I just tried it and it works.![]()
FAQ | XY News RSS | XY X
XYplorer Beta Club