#1 2022-07-03 05:56

visusys
Member
Registered: 2021-10-16
Posts: 20

Selective Camel Case Conversion (From "Clean Up" Rule) and More

Hi all,

I am trying to convert from camel case to proper / title case, but with exceptions. I.E: Only insert the space before the capital letter if the word doesn't match a dictionary term. Kind of similar to Force Case Fragments, but for the Clean Up rule.

Use-case for selective camel case conversion:

VeraCrypt InfoDocument.svg
VibrantLinux FileOneTwo.svg
VBox InstallerFile.exe

Becomes:

VeraCrypt Info Document.svg
VibrantLinux File One Two.svg
VBox Installer File.exe

With "VeraCrypt, "VibrantLinux", and "VBox" in my dictionary.

I am also trying to do the same thing with the "Replace these characters with spaces" option in the Clean Up rule. See below for an example:

Use-case for selective symbol replacement

CPU-Z Desktop-Installer.exe
GPU-Z Portable-Installer.exe
Harley-Davidson Motorcycle-Magazine.pdf

Becomes:

CPU-Z Desktop Installer.exe
GPU-Z Portable Installer.exe
Harley-Davidson Motorcycle Magazine.pdf

With "Replace these characters with spaces" set to hyphen, and "CPU-Z", "GPU-Z", and "Harley-Davidson" in my dictionary.

Can someone elaborate if this is possible? If it isn't, I'd really like to submit this as a feature enhancement request. It would be a good way to make renaming rules more intelligent with the ability to detect "signatures" to leave alone.

Another minor request. I'd like the ability to specify an additional layer of logic with the CamelCase conversion option in the Clean Up rule. Specifically:

If the character before the capital letter is a digit - don't insert the space.
Or
If the character before the capital letter is a hyphen - don't insert the space.
Or
If the character before the capital letter is a period - don't insert the space.

Etc.

I've managed to solve the final question above with a regular expression:

Expression: ([^\A\-\s\d\.])([A-Z])
Replace: $1 $2

But having logic like this exposed in the GUI would be much cleaner.

Any help at all on my first two requests would be greatly appreciated.

Thanks so much for creating this great piece of software.

Offline

#2 2022-07-06 16:19

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: Selective Camel Case Conversion (From "Clean Up" Rule) and More

You could apply the camel case and/or symbol replacement conversion to the full name and then use the Replace rule to selectively undo adjustments to the selected phrases, e.g. replace "Vera Crypt" with "VeraCrypt", replace "CPU Z" with "CPU-Z", etc.

There is also a plan to add a special rule (a.k.a. "Select" rule) which would allow selecting a part of the filename, so that subsequent rules would only be applied to the selected parts rather then the whole filename. However, I am not sure that it will help with your use cases, because they are based on a dictionary rather than a common pattern.

Regarding the suggested options for the camel case conversion. Adding too many customization options to existing rules can make them quite cumbersome and hard to comprehend for novice users (Bulk Rename Utility comes to mind here). On the other hand, Regular Expressions and Pascal Script rules are well suited for handling more complex renaming patterns, but are quite difficult to use for novice users.

Offline

Board footer

Powered by FluxBB