Page 1 of 1

Need script to set extension to lower case

Posted: 08 Apr 2008 21:51
by admin
Is that possible with RegExp, or do I have to add a new script command tolowercase or lcase?

Re: Need script to set extension to lower case

Posted: 08 Apr 2008 22:11
by jacky
admin wrote:Is that possible with RegExp, or do I have to add a new script command tolowercase or lcase?
Can't be done with regexp no, it doesn't change case.

Now that the bug found today about Batch Rename and same case has been fixed, I think this little script should work, but obviously it only works with one item selected. (That's of course until we get a way to loop though them all ;))

Code: Select all

set $base, <curbase>;
 // lowercase
 #127;
 set $ext, <curext>;
 rename , "$base.$ext/e";
BTW tolowercase or lcase are very bad names if it only affects the extension, as they could easily be confused for #127; (File / Rename Special / aaa aa.aaa) I'd recommend to add it there, or add a parameter : f|b|e for full filename, base only, extension only (unless of course that was your plan all along, which may very well be the case. Probably so. So yeah just add your lowercase & uppercase commands already then ;))

Re: Need script to set extension to lower case

Posted: 08 Apr 2008 22:32
by TheQwerty
jacky wrote:
admin wrote:Is that possible with RegExp, or do I have to add a new script command tolowercase or lcase?
Can't be done with regexp no, it doesn't change case.
Quite a few implementations do support the use of \u \U \l and \L in the replacement pattern to change case.

That said, the one used by XY doesn't seem to be one of them.

Re: Need script to set extension to lower case

Posted: 08 Apr 2008 22:35
by admin
jacky wrote:
admin wrote:Is that possible with RegExp, or do I have to add a new script command tolowercase or lcase?
Can't be done with regexp no, it doesn't change case.

Now that the bug found today about Batch Rename and same case has been fixed, I think this little script should work, but obviously it only works with one item selected. (That's of course until we get a way to loop though them all ;))

Code: Select all

set $base, <curbase>;
 // lowercase
 #127;
 set $ext, <curext>;
 rename , "$base.$ext/e";
BTW tolowercase or lcase are very bad names if it only affects the extension, as they could easily be confused for #127; (File / Rename Special / aaa aa.aaa) I'd recommend to add it there, or add a parameter : f|b|e for full filename, base only, extension only (unless of course that was your plan all along, which may very well be the case. Probably so. So yeah just add your lowercase & uppercase commands already then ;))
Script works! Merci! :D

Of course, tolowercase or lcase were meant as general string functions!

Re: Need script to set extension to lower case

Posted: 09 Apr 2008 07:33
by admin
jacky wrote:

Code: Select all

set $base, <curbase>;
 // lowercase
 #127;
 set $ext, <curext>;
 rename , "$base.$ext/e";
This seems to do the same job, but shorter:

Code: Select all

set $base, <curbase>; 
 // lowercase 
 #127; 
 rename , $base;

Posted: 09 Apr 2008 12:45
by jacky
Oh yeah, nice, yes it does, silly me!