Page 2 of 2
Re: Rename only part of a file on certain conditions
Posted: 24 Apr 2022 10:33
by kiwichick
highend wrote: ↑24 Apr 2022 10:10
Ofc it doesn't work.
Do you think that feeding the full list of selected items as source into EACH LOOP does make any sense? No, it doesn't.
Use
renameitem() with the correct variables^^
I always appreciate your willingness to help but sometimes it feels like you are being deliberately obscure. You make comments and ask questions that seem aimed at making someone feel foolish for not knowing what to do and not understanding what's been provided. Having to go round and round with small bits of code and vague clues about what what to do next is sometimes more hindrance than help, and it's darn confusing. I'm giving up on this particular bit of code because it's doing my head in.
Re: Rename only part of a file on certain conditions
Posted: 24 Apr 2022 10:49
by highend
Vague? I'm utterly precise.
small bits and code? Because the main code has already been posted and even the help file has
several examples how to loop over selected items^^
The shortest version is this:
Code: Select all
foreach($item, <get SelectedItemsPathNames>, <crlf>, "e") {
$base = (exists($item) == 1) ? gpc($item, "base") : gpc($item, "file");
$newName = regexreplace($base, "\.(?![0-9])", " ");
renameitem($newName, $item, 1);
}
Re: Rename only part of a file on certain conditions
Posted: 24 Apr 2022 11:01
by chumbo
I've been secretly watching in hope that the 'secret sauce' would finally be revealed (thx kiwichick for reviving this)! So thx highend for doing so because this is WAY above my head! I was naive to think I could tackle scripting something like this at my current level.
Works great!

Re: Rename only part of a file on certain conditions
Posted: 25 Apr 2022 01:52
by kiwichick
chumbo wrote: ↑24 Apr 2022 11:01
I've been secretly watching in hope that the 'secret sauce' would finally be revealed (thx kiwichick for reviving this)! So thx highend for doing so because this is WAY above my head! I was naive to think I could tackle scripting something like this at my current level.
Works great!
You're welcome

Re: Rename only part of a file on certain conditions
Posted: 25 Apr 2022 01:54
by kiwichick
highend wrote: ↑24 Apr 2022 10:49
I'm utterly precise.
Clearly your idea of being precise differs to that of some people. Thank you very much for supplying the code required.