It's nice that if you execute Rename with multiple items selected XY uses Batch Rename, but I'd like to see a way to change which mode is used.
I hardly ever use Batch Rename so it would be more useful (for me) if this would use RegExp, as it would eliminate my need for multiple CKSs or having to start the rename differently.
I think a simple tweak which could use the same values as the Rename script command ("b|r|s|k|e") would suffice.
Tweak to define Multiple Item Rename Mode
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
Re: Tweak to define Multiple Item Rename Mode
Or you could always do it yourself using a (little) script!
Code: Select all
// Save Clipboard
set $clipboard, <clipboard>;
// Copy Name(s)
#102;
set $list, <clipboard>;
// get last 2 chars, crlf means more than one item
substr $fix, $list, -2;
// nothing at all: we'll add 0 (just like when crlf)
regexreplace $fix, $fix, "^$", ":";
// turn crlf into ":"
regexreplace $fix, $fix, <crlf>, ":";
// if everything but ":" it means no crlf (and no empty), so it was one single name, so we'll add 1
regexreplace $fix, $fix, "^[^:]+$", "1";
// otherwise we'll add 0
regexreplace $fix, $fix, "^:$", "0";
//
// turn all crlf in ":"
regexreplace $list, $list, <crlf>, ":";
// remove everything but ":"
regexreplace $list, $list, "[^:]", "";
// thus we get the number of ":" = crlf = items
strlen $nb, $list;
// adding the fix
incr $nb, $nb, $fix;
// Restore Clipboard
copytext $clipboard;
// nice & clean
status "Renaming...";
// do appropriate rename operation
regexreplace $next, $nb, "^(0|1)$", "#172;";
regexreplace $next, $next, "^((?!^#172;$).)*$", "#122;";
load $next,,s;Proud XYplorer Fanatic
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Tweak to define Multiple Item Rename Mode
Other than there's no way to execute a script in all the places that rename can be called. (File->Rename, Context Menu->Rename)
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
Re: Tweak to define Multiple Item Rename Mode
Well, no, but since you mentioned multiple KS I thought you used KS to trigger your Rename operations, and in such a case a script works just as fine.TheQwerty wrote:Other than there's no way to execute a script in all the places that rename can be called. (File->Rename, Context Menu->Rename)
For menus you're sent to the User menu indeed, and for the context menu we'll have to wait for "onEvent Actions" to define our own context menus (which will be much faster than items' ctxt menu, I can't stand those things, can be so freaking slow, especially when I'm n a hurry... That's why I never use them.). Meanwhile, it's KS, Catalog items, POM, or you could also "hijack" the Tree's context menu and call the script from Favorites...
Proud XYplorer Fanatic
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Tweak to define Multiple Item Rename Mode
Yes, there's a ton of ways but if I have to remember to do something differently that defeats the purpose of the request.jacky wrote:Well, no, but since you mentioned multiple KS I thought you used KS to trigger your Rename operations, and in such a case a script works just as fine.TheQwerty wrote:Other than there's no way to execute a script in all the places that rename can be called. (File->Rename, Context Menu->Rename)
For menus you're sent to the User menu indeed, and for the context menu we'll have to wait for "onEvent Actions" to define our own context menus (which will be much faster than items' ctxt menu, I can't stand those things, can be so freaking slow, especially when I'm n a hurry... That's why I never use them.). Meanwhile, it's KS, Catalog items, POM, or you could also "hijack" the Tree's context menu and call the script from Favorites...
Besides what would be better with scripting is if the "onEvent Actions" would then have "BeforeRename" and "AfterRename" actions, with a way to abort the event. Then I could use a very modified version of your script (hopefully we'll have actual logic before onEvent Actions), to do the same thing.
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
Re: Tweak to define Multiple Item Rename Mode
Yeah, but at first I thought you used F2 to rename, and some other KS to RegExp Rename, hence the script that, assign to F2, is th eonly one KS you'd need to use. Of course, if you don't want to only use KS that doesn't apply anymore...TheQwerty wrote:Yes, there's a ton of ways but if I have to remember to do something differently that defeats the purpose of the request.
I so disagree on that oneTheQwerty wrote:hopefully we'll have actual logic before onEvent Actions
Proud XYplorer Fanatic
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Tweak to define Multiple Item Rename Mode
Thanks for adding this Don!
I appreciate not having to think before starting my renaming.
I appreciate not having to think before starting my renaming.
-
admin
- Site Admin
- Posts: 66300
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Tweak to define Multiple Item Rename Mode
That was my goal! XYplorer -- skip thinking, just do it.TheQwerty wrote:Thanks for adding this Don!
I appreciate not having to think before starting my renaming.
FAQ | XY News RSS | XY X
XYplorer Beta Club