Modify Capitalisation of Just Part of Filename

Hi. I would like to modify the capitalisation of just part of a filename (not the entire filename).

I know that, if I want to modify the capitalisation of the entire string, I can do that using the Modify Capitalization action check box (usually Capitalize All Words in my case).

I have created many presets using the rename dialog. Most of them use Regular Expression Mode to find and select sections of the filename which match a given pattern. They then replace (add and/or remove) text.

The filenames I am currently working with contain character patterns like " - " or " {{", to make parsing (and pattern matching) easier.
They all start with the same string too, represented here by "ABC DEF".
The extension does not need to be modified.

DESIRED OUTCOME
This is an example / test case of what I'd like to achieve.
Note that only the first matched expression has its capitalisation modified (highlighted in bold).

Before:
ABC DEF - gH JKm - N12 P34 - Qr {{Stu Vwx}}.ext

After:
ABC DEF - Gh Jkm - N12 P34 - Qr {{Stu Vwx}}.ext

PROPOSED SOLUTION
NB: "[Title Case(\1)]" is pseudo code for "Capitalise All Words of matched pattern #1". It needs correcting.

Find (RegEx):
ABC DEF - (.*) - (.*)\.(.*)

Replace (RegEx):
ABC DEF -[TITLE CASE(\1)]- \2.\3

As far as I remember, MusicBee can do this quite neatly.
Thanks in advance.

By the way, I have seen the script below (Dynamic Renamer), which may be an option, but:
(1) I'd prefer to use a RegEx pattern if the case modification option I'm seeking exists
(2) I'm not sure whether the script is still valid, as the last update to the post was in 2016, and the built in Rename Dialog has progressed so far since then

Making a small rename script for this is what I would do.

The script could apply your regex to split the filename into the desired parts, then uppercase the part(s) you want uppercased, then join them back together.

The regex could be hardcoded in the script, or it could come from the inputs in the rename dialog, depending on how complex/flexible you want things.


Dynamic Renamer should still work as well, but note that using it requires installing ActivePerl. (Perl isn't required for rename scripts in general, just that one.)

Hi Leo.

Thanks for your quick response. I couldn't reply back until now.

I'll see if I can teach myself how to do that.

Presumably the best places to start learning are here:
https://www.gpsoft.com.au/help/opus12/Documents/Scripting/Rename_Scripts1.htm
Here:
https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Scripting/Example_Rename_Script.htm
And here:

[?] Would you recommend VBScript for this relatively simple objective?

If I get it to work, I'll post the result back here.

Thanks for you time.

JScript may be a bit easier here than VBScript, unless you're already more familiar with VBScript. JScript has built-in support for regular expressions, which makes life a bit easier. It's also much more common in other places like on the web. (Javascript isn't quite the same as JScript, but the basics are almost identical.)

This is probably a good place to start, since it already deals with applying regex to files in rename scripts:

That has examples in both JScript and VBScript, so you can pick whichever you prefer.

Shout if you get stuck or find it too complicated. I haven't had much time spare today but if I do I might be able to help out in more detail if it's needed.

OK. Thanks a million Leo!
I'll give it a try tomorrow.

Hi again.

I've started working on it. I started with JScript, but I'm now using VBScript. I couldn't find much documentation on JScript and I found a good starter rename script to modify (written in VBScript). I guess I could go back if you strongly advise it. Although I'm not a programmer, I have used VBA a fair bit before, and, to a lesser extent Java and Javascript (plus other languages not related to the current scenario).

But it seems that VBScript only has 2 case conversion options (LCase or UCase), neither of which I want. I want the equivalent of the Rename Dialog's "Capitalise All Words" action. Even better would be one that recognised exceptions (like Irish and Scottish names).

I'm considering using something like this example, or one of the others on that page:
http://www.vbforums.com/showthread.php?386217-Proper-Case-In-VbScript&p=3596356&viewfull=1#post3596356

But, if I do so, it raises another question:
[?] Can a Dopus rename script contain more than one function?
[?] If so, then where should I place this secondary function / subroutine? Should it be below the main one?

[?] Alternatively, can I call Dopus's inbuilt functions somehow? And, if so, is the Rename Dialog's "Capitalise All Words" action available?

Ironically, my original problem (selective case conversion based on pattern) is becoming less of an issue now because I'm hoping to incorporate 12 mini rename functions into 1 script. And the rename functions which appended an upper case phrase can be moved to the end of the process, after the capitalise all words procedure.

I won't be working on it much more tonight but will do tomorrow, so if you've any advice in the meantime, that'd be great.

When Googling: ("dopus" rename script subroutine) I found this old (2007) topic. Might be useful. I'll read it tomorrow.

The TitleCase script on the forum is written in VB, so you could incorporate that into yours if you wanted the same functionality with your own extras.

Yes, you can define as many other functions as you want using the same syntax as is used to define the main GetNewName function. They can come before or after the GetNewName function; it doesn't matter. You can call them from within the main function as many times as you want.