Case conversion...

Interesting script. Is there a reason you recommend running the directory action first before the combined tag and filename actions? Why can't they be run as part of one overall action file?

In relation to the first word not being capitalised following a number, is there a way to avoid this occurring and to ensure the first word after a number does get capitalised?7

One of the problems I have been having with a script that functions in a similar way is getting it to behave by capitalising the first word after a round open bracket and including several exceptions to this capitalisation rule like not adding a capital if it includes the word 'feat., 'ft.' or 'features '.

[#0]
T=1
F=_TAG
1=1
2=

[#1]
T=4
F=_TAG
1=\b(A|An|The|And|But|Or|So|After|Before|Out|When|While|Since|Until|Although|Even If|Because|About|Above|Across|Against|Along|Alongside|As|At|Below|By|During|For|From|In|Into|Of|Off|On|Onto|Over|Than|Through|Till|To|Under|Up|With|Within|Without)\b
2=$lower($1)
3=0

[#2]
T=4
F=_TAG
1=^\s*(\w+)
2=$caps($1)
3=0

[#3]
T=4
F=_TAG
1=(\w+)\s*$
2=$caps($1)
3=0

[#4]
T=1
F=_FILENAME
1=1
2=

This is a script that I have slightly modified based on someone within these forums and I can't even pretend to understand how it works although I would appreciate enlightenment.

@sheepdisease
Do you really have to add your problem to multiple threads?
If someone understand what you need and has a solution, you will read it.
So please stop filling every other thread with the same question. Thanks.

I am not copying the original question to any other thread. When someone points me to another thread for reference I am looking and trying to understand how it works.

This is a rather comprehensive script which I have asked specific questions about and would appreciate a reply from the author or someone else who knows how it works with information relating to it and how it could be modified to deal with a change from square brackets to round brackets.

Referring to Grammartron:

This seems to work well on the title and other tags but the directory action does not seem to do anything with regards to removing full caps. Can anyone see what the problem is?

I think that for Filenames (and folder names) you actually have to change something like add an underscore and remove it afterwards so that Windows actually changes the case.

What I wonder: why do you go through such an ordeal of actions (which are hardly to maintain) instead of simply renaming the directory based on the tags? I mean: if the tags have the correct case, why not recycle that and simply transfer spelling and case to the filename and the folder name?

Thanks for the reply.

The formatting of the tags is all wrong, being uppercase so can't take any information from that and want to ensure all words are correctly capitalised.

I could have sworn this worked before, but can't see to get it to work now.

I tried introducing Replace with regular expression to _DIRECTORY as a test using '^' and then replace with '{'. Then the appropriate code. At the end I added Replace with regular expression to _DIRECTORY and inserted '{' replace with ''. It did not make a difference.

I really like this code, but it is not fixing capitalisation correctly and I don't know why.

Yet this does (but not quite how I want it to as doesn't have same extensive ruleset):

So what is the difference between the two actions and why does the second one impact upon case of the directory when the other doesn't?

The other interesting quirk is that the first action (when it works) manages to add a capital to the beginning of anything after opening brackets(except for .feat) but the second doesn't. Why is that?

Combining them works for the most part (any titles which contain 'a' after the track number stay in lower case though).



[#0]
T=1
F=_TAG
1=1
2=

[#1]
T=4
F=_TAG
1=\\\\b(A|An|The|And|But|Or|So|After|Before|Out|When|While|Since|Until|Although|Even If|Because|About|Above|Across|Against|Along|Alongside|As|At|Below|By|During|For|From|In|Into|Of|Off|On|Onto|Over|Than|Through|Till|To|Under|Up|With|Within|Without)\\\\b
2=$lower($1)
3=0

[#2]
T=4
F=_TAG
1=^\\\\s*(\\\\w+)
2=$caps($1)
3=0

[#3]
T=4
F=_TAG
1=(\\\\w+)\\\\s*$
2=$caps($1)
3=0

[#4]
T=1
F=_FILENAME
1=1
2=

[#5]
T=4
F=_FILENAME
1=\\\\b(A|An|The|And|But|Or|So|After|Before|Out|When|While|Since|Until|Although|Even If|Because|About|Above|Across|Against|Along|Alongside|As|At|Below|By|During|For|From|In|Into|Of|Off|On|Onto|Over|Than|Through|Till|To|Under|Up|With|Within|Without)\\\\b
2=$lower($1)
3=0

[#6]
T=4
F=_FILENAME
1=^\\\\s*(\\\\w+)
2=$caps($1)
3=0

[#7]
T=4
F=_FILENAME
1=(\\\\w+)\\\\s*$
2=$caps($1)
3=0

[#8]
T=1
F=_DIRECTORY
1=1
2=

[#9]
T=4
F=_DIRECTORY
1=\\\\b(A|An|The|And|But|Or|So|After|Before|Out|When|While|Since|Until|Although|Even If|Because|About|Above|Across|Against|Along|Alongside|As|At|Below|By|During|For|From|In|Into|Of|Off|On|Onto|Over|Than|Through|Till|To|Under|Up|With|Within|Without)\\\\b
2=$lower($1)
3=0

[#10]
T=4
F=_DIRECTORY
1=^\\\\s*(\\\\w+)
2=$caps($1)
3=0

[#11]
T=4
F=_DIRECTORY
1=(\\\\w+)\\\\s*$
2=$caps($1)
3=0

[#0]
T=4
! Trim Trailing, Preceding & Extra Spaces [1]=
F=_DIRECTORY
1=(\\s+$|^\\s+)
2=
3=0

[#1]
T=4
! Trim Trailing, Preceding & Extra Spaces [2]=
F=_DIRECTORY
1=\\s+
2= 
3=0

[#2]
T=4
! Enforce Correct Word Spacing [1]=
F=_DIRECTORY
1=([^\\s\\.;\\)\\]/])([&\\({\\[\\+])
2=$1 $2
3=0

[#3]
T=4
! Enforce Correct Word Spacing [2]=
F=_DIRECTORY
1=(&|\\)|\\}|\\]|;|(?<!\\d),|,(?!\\d{3})|\\+)([^\\s\\.;\\(\\[/])
2=$1 $2
3=0

[#4]
T=4
! Enforce Correct Word Spacing [3]=
F=_DIRECTORY
1=\\b([a-z])\\s(&)\\s([a-z])\\b
2=$1$2$3
3=0

[#5]
T=4
! Enforce Correct Word Spacing [4]=
F=_DIRECTORY
1=([\\(\\[])\\s
2=$1
3=0

[#6]
T=4
! Enforce Correct Word Spacing [5]=
F=_DIRECTORY
1=\\s(\\]|\\)|\\?|:|;|,|\\.(?!\\.\\.))
2=$1
3=0

[#7]
T=4
! Enforce Correct Word Spacing [6]=
F=_DIRECTORY
1=(".*?")([^\\s\\]\\)/\\}!\\-\u003d,.;])(?!$)
2=$1 $2
3=0

[#8]
T=4
! Enforce Correct Word Spacing [7]=
F=_DIRECTORY
1=([^\\s\\[\\(/\\{])(".*?")
2=$1 $2
3=0

[#9]
T=4
! Enforce Correct Word Spacing [8]=
F=_DIRECTORY
1=(\\.(?<!\\.\\.))(?![\\s\\.':;\\)\\]"])(?![\\l\\u](\\.|$| ))(?!$)(?!\\d)(?!(co|com|uk|net|org|gov|edu|mil|html?|php))
2=$0 
3=0

[#10]
T=4
! Enforce Correct Word Spacing [9]=
F=_DIRECTORY
1=ww.\\s
2=ww.
3=0

[#11]
T=4
! Enforce Correct Word Spacing [10]=
F=_DIRECTORY
1="\\s?(.*?)\\s?"
2="$1"
3=0

[#12]
T=4
! Add Apostrophe to "Are" Contractions=
F=_DIRECTORY
1=\\b(how|they|what|when|why|you)re\\b
2=$1're
3=0

[#13]
T=4
! Add Apostrophe to "Have" Contractions=
F=_DIRECTORY
1=\\b(could|how|i|might|must|should|we|what|where|would|you)ve\\b
2=$1've
3=0

[#14]
T=4
! Add Apostrophe to "Is" Contractions=
F=_DIRECTORY
1=\\b(he|here|how|she|that|there|two|what|when|where|who|why)s\\b
2=$1's
3=0

[#15]
T=4
! Add Apostrophe to "Not" Contractions=
F=_DIRECTORY
1=\\b(ain|aren|can|couldn|didn|doesn|don|hadn|hasn|haven|isn|mightn|mustn|shouldn|wasn|weren|won|wouldn)t\\b
2=$1't
3=0

[#16]
T=4
! Add Apostrophe to "Will" Contractions=
F=_DIRECTORY
1=\\b(how|it|that|there|they|what|when|where|who|you)ll\\b
2=$1'll
3=0

[#17]
T=4
! Title Case Conversion [1] (Convert Words to Mixed-Case, Ignoring Upper-Case Letters)=
F=_DIRECTORY
1=([-({\\[\\]}) _",.+&@;*])(\\l)
2=$1$upper($2)
3=1

[#18]
T=4
! Title Case Conversion [2] (Capitalise First Word)=
F=_DIRECTORY
1=^(\\l)
2=$upper($1)
3=1

[#19]
T=4
! Title Case Conversion [3] (Articles, Conjunctions & Short Prepositions to Lower-Case, Except Before or After Punctuation)=
F=_DIRECTORY
1=(?<!&|:|;|-|/|!|(?<![A-Z]\\.[A-Z])\\.|\\?|\\+)(\\s+\\b(A|An|And|As|At|But|By|De|Et|For|From|In|Into|Le|Nor|Of|Off|On|Onto|Or|So|Than|The|To|Upon|Von|With)(?\u003d\\s)(?!\\s[\\-\\(\\)\\[\\]{}]))
2=$lower($1)
3=1

[#20]
T=4
! Title Case Conversion [4]=
F=_DIRECTORY
1=(^|\\s|\\(|\\[|/)'(.{1})
2=$1'$upper($2)
3=0

[#21]
T=4
! Title Case Conversion [5] (Capitalise "to" Before Common Verbs)=
F=_DIRECTORY
1=(to\\s+)\\b(Ask|Be|Begin|Believe|Bring|Buy|Call|Care|Change|Cheat|Come|Cry|Dance|Die|Do|Dream|Fall|Feel|Find|Forget|Get|Give|Go|Hate|Have|Hear|Hide|Hold|Keep|Know|Laugh|Learn|Leave|Let|Lie|Listen|Live|Look|Lose|Love|Make|Mean|Miss|Move|Marry|Need|Play|Pretend|Promise|Put|Remember|Return|Ride|Run|Say|See|Sell|Send|Set|Show|Sing|Speak|Stand|Stay|Steal|Stop|Take|Talk|Tell|Thank|Think|Touch|Travel|Try|Use|Wait|Walk|Want|Win|Wish|Work|Write)\\b
2=$caps($1)$2
3=1

[#22]
T=4
! Forced Upper-Case for Named Abbreviations and Acronyms=
F=_DIRECTORY
1=\\b(ac|aka|ap|asap|atm|bbc|bc|bce|blt|btw|cbs|cc|cd|cia|dc|dj|doa|emi|ep|faq|fbi|fm|fr|gb|gi|imho|ira|irs|jc|kkk|lp|mc|mgm|nasa|nbc|npr|ny|nyc|ok|ost|pm|ps|qed|rca|rpm|sos|tba|tlc|tv|ufo|uk|usa|ussr|va|ymca)\\b
2=$upper($1)
3=0

[#23]
T=4
! CamelCase Irish Names Beginning with O'=
F=_DIRECTORY
1=\\b(O'[a-z]|O\\x{2019}[a-z])
2=$upper($1)
3=1

[#24]
T=4
! CamelCase Scottish Names Beginning with Mc=
F=_DIRECTORY
1=\\b(Mc)((?:[a-z]|-){3,})
2=$1$caps2($2,-)
3=1

[#25]
T=4
! CamelCase Common Scottish Names Beginning with Mac=
F=_DIRECTORY
1=\\b(Mac)(Alister|Arthur|Askill|Bain|Coll|Donald|Dougall|Dowell|Duff|Ewen|Farlane|Gregor|Intyre|Kenzie|Kinnon|Laren|Lean|Leod|Millan|Nab|Neil|Pherson|Rae)\\b
2=$1$caps2($2)
3=0

[#26]
T=4
! Roman Numerals to Upper-Case (Up to LXXIX, or 89)=
F=_DIRECTORY
1=\\b(?:L?X{0,3}|XL)(?:V?I{0,3}|I[VX])(?\u003d(\\.\\s|\\s|\\)|$))
2=$upper($0)
3=0

[#27]
T=4
! Common Latinisms and Miscellany to Lowercase=
F=_DIRECTORY
1=(\\b(?:E\\.G|et\\sAl|Etc|I\\.E|Versus|Vs|Feat\\.\\s|Ft\\.\\s|(?<\u003d')N(?\u003d'))\\b)
2=$lower($1)
3=1

[#0]
T=4
! Trim Trailing, Preceding & Extra Spaces [1]=
F=_TAG
1=(\\s+$|^\\s+)
2=
3=0

[#1]
T=4
! Trim Trailing, Preceding & Extra Spaces [2]=
F=_TAG
1=\\s+
2= 
3=0

[#2]
T=4
! Enforce Correct Word Spacing [1]=
F=_TAG
1=([^\\s\\.:;\\)\\]/])([&\\({\\[\\+])
2=$1 $2
3=0

[#3]
T=4
! Enforce Correct Word Spacing [2]=
F=_TAG
1=(&|\\)|\\}|\\]|;|(?<!\\d),|,(?!\\d{3})|\\+)([^\\s\\.:;\\(\\[/])
2=$1 $2
3=0

[#4]
T=4
! Enforce Correct Word Spacing [3]=
F=_TAG
1=\\b([a-z])\\s(&)\\s([a-z])\\b
2=$1$2$3
3=0

[#5]
T=4
! Enforce Correct Word Spacing [4]=
F=_TAG
1=([\\(\\[])\\s
2=$1
3=0

[#6]
T=4
! Enforce Correct Word Spacing [5]=
F=_TAG
1=\\s(\\]|\\)|\\?|:|;|,|\\.(?!\\.\\.))
2=$1
3=0

[#7]
T=4
! Enforce Correct Word Spacing [6]=
F=_TAG
1=(".*?")([^\\s\\]\\)/\\}!\\-\u003d,.;:])(?!$)
2=$1 $2
3=0

[#8]
T=4
! Enforce Correct Word Spacing [7]=
F=_TAG
1=([^\\s\\[\\(/\\{])(".*?")
2=$1 $2
3=0

[#9]
T=4
! Enforce Correct Word Spacing [8]=
F=_TAG
1=(\\.(?<!\\.\\.))(?![\\s\\.':;\\)\\]"])(?![\\l\\u](\\.|$| ))(?!$)(?!\\d)(?!(co|com|uk|net|org|gov|edu|mil|html?|php))
2=$0 
3=0

[#10]
T=4
! Enforce Correct Word Spacing [9]=
F=_TAG
1=ww.\\s
2=ww.
3=0

[#11]
T=4
! Enforce Correct Word Spacing [10]=
F=_TAG
1="\\s?(.*?)\\s?"
2="$1"
3=0

[#12]
T=4
! Add Apostrophe to "Are" Contractions=
F=_TAG
1=\\b(how|they|what|when|why|you)re\\b
2=$1're
3=0

[#13]
T=4
! Add Apostrophe to "Have" Contractions=
F=_TAG
1=\\b(could|how|i|might|must|should|we|what|where|would|you)ve\\b
2=$1've
3=0

[#14]
T=4
! Add Apostrophe to "Is" Contractions=
F=_TAG
1=\\b(he|here|how|she|that|there|two|what|when|where|who|why)s\\b
2=$1's
3=0

[#15]
T=4
! Add Apostrophe to "Not" Contractions=
F=_TAG
1=\\b(ain|aren|can|couldn|didn|doesn|don|hadn|hasn|haven|isn|mightn|mustn|shouldn|wasn|weren|won|wouldn)t\\b
2=$1't
3=0

[#16]
T=4
! Add Apostrophe to "Will" Contractions=
F=_TAG
1=\\b(how|it|that|there|they|what|when|where|who|you)ll\\b
2=$1'll
3=0

[#17]
T=4
! Title Case Conversion [1] (Convert Words to Mixed-Case, Ignoring Upper-Case Letters)=
F=_TAG
1=([-({\\[\\]}) _",./+&@:;*])(\\l)
2=$1$upper($2)
3=1

[#18]
T=4
! Title Case Conversion [2] (Capitalise First Word)=
F=_TAG
1=^(\\l)
2=$upper($1)
3=1

[#19]
T=4
! Title Case Conversion [3] (Articles, Conjunctions & Short Prepositions to Lower-Case, Except Before or After Punctuation)=
F=_TAG
1=(?<!&|:|;|-|/|!|(?<![A-Z]\\.[A-Z])\\.|\\?|\\+)(\\s+\\b(A|An|And|As|At|But|By|De|Et|For|From|In|Into|Le|Nor|Of|Off|On|Onto|Or|So|Than|The|To|Upon|Von|With)(?\u003d\\s)(?!\\s[\\-\\(\\)\\[\\]{}]))
2=$lower($1)
3=1

[#20]
T=4
! Title Case Conversion [4]=
F=_TAG
1=(^|\\s|\\(|\\[|/)'(.{1})
2=$1'$upper($2)
3=0

[#21]
T=4
! Title Case Conversion [5] (Capitalise "to" Before Common Verbs)=
F=_TAG
1=(to\\s+)\\b(Ask|Be|Begin|Believe|Bring|Buy|Call|Care|Change|Cheat|Come|Cry|Dance|Die|Do|Dream|Fall|Feel|Find|Forget|Get|Give|Go|Hate|Have|Hear|Hide|Hold|Keep|Know|Laugh|Learn|Leave|Let|Lie|Listen|Live|Look|Lose|Love|Make|Mean|Miss|Move|Marry|Need|Play|Pretend|Promise|Put|Remember|Return|Ride|Run|Say|See|Sell|Send|Set|Show|Sing|Speak|Stand|Stay|Steal|Stop|Take|Talk|Tell|Thank|Think|Touch|Travel|Try|Use|Wait|Walk|Want|Win|Wish|Work|Write)\\b
2=$caps($1)$2
3=1

[#22]
T=4
! Forced Upper-Case for Named Abbreviations and Acronyms=
F=_TAG
1=\\b(ac|aka|ap|asap|atm|bbc|bc|bce|blt|btw|cbs|cc|cd|cia|dc|dj|doa|emi|ep|faq|fbi|fm|fr|gb|gi|imho|ira|irs|jc|kkk|lp|mc|mgm|nasa|nbc|npr|ny|nyc|ok|ost|pm|ps|qed|rca|rpm|sos|tba|tlc|tv|ufo|uk|usa|ussr|va|ymca)\\b
2=$upper($1)
3=0

[#23]
T=4
! Replay Gain Correction [1]=
F=REPLAYGAIN_TRACK_GAIN
1=(\\+|-)?\\s?(\\d*\\.\\d*)\\sDB
2=$1$2 dB
3=0

[#24]
T=4
! Replay Gain Correction [2]=
F=REPLAYGAIN_ALBUM_GAIN
1=(\\+|-)?\\s?(\\d*\\.\\d*)\\sDB
2=$1$2 dB
3=0

[#25]
T=4
! CamelCase Irish Names Beginning with O'=
F=_TAG
1=\\b(O'[a-z]|O\\x{2019}[a-z])
2=$upper($1)
3=1

[#26]
T=4
! CamelCase Scottish Names Beginning with Mc=
F=_TAG
1=\\b(Mc)((?:[a-z]|-){3,})
2=$1$caps2($2,-)
3=1

[#27]
T=4
! CamelCase Common Scottish Names Beginning with Mac=
F=_TAG
1=\\b(Mac)(Alister|Arthur|Askill|Bain|Coll|Donald|Dougall|Dowell|Duff|Ewen|Farlane|Gregor|Intyre|Kenzie|Kinnon|Laren|Lean|Leod|Millan|Nab|Neil|Pherson|Rae)\\b
2=$1$caps2($2)
3=0

[#28]
T=4
! Roman Numerals to Upper-Case (Up to LXXIX, or 89)=
F=_TAG
1=\\b(?:L?X{0,3}|XL)(?:V?I{0,3}|I[VX])(?\u003d(\\.\\s|\\s|\\)|$))
2=$upper($0)
3=0

[#29]
T=4
! Common Latinisms and Miscellany to Lowercase=
F=_TAG
1=(\\b(?:E\\.G|et\\sAl|Etc|I\\.E|Versus|Vs|Feat\\.\\s|Ft\\.\\s|(?<\u003d')N(?\u003d'))\\b)
2=$lower($1)
3=1

[#30]
T=4
! Trim Trailing, Preceding & Extra Spaces [1]=
F=_FILENAME
1=(\\s+$|^\\s+)
2=
3=0

[#31]
T=4
! Trim Trailing, Preceding & Extra Spaces [2]=
F=_FILENAME
1=\\s+
2= 
3=0

[#32]
T=4
! Enforce Correct Word Spacing [1]=
F=_FILENAME
1=([^\\s\\.;\\)\\]/])([&\\({\\[\\+])
2=$1 $2
3=0

[#33]
T=4
! Enforce Correct Word Spacing [2]=
F=_FILENAME
1=(&|\\)|\\}|\\]|;|(?<!\\d),|,(?!\\d{3})|\\+)([^\\s\\.;\\(\\[/])
2=$1 $2
3=0

[#34]
T=4
! Enforce Correct Word Spacing [3]=
F=_FILENAME
1=\\b([a-z])\\s(&)\\s([a-z])\\b
2=$1$2$3
3=0

[#35]
T=4
! Enforce Correct Word Spacing [4]=
F=_FILENAME
1=([\\(\\[])\\s
2=$1
3=0

[#36]
T=4
! Enforce Correct Word Spacing [5]=
F=_FILENAME
1=\\s(\\]|\\)|\\?|:|;|,|\\.(?!\\.\\.))
2=$1
3=0

[#37]
T=4
! Enforce Correct Word Spacing [6]=
F=_FILENAME
1=(".*?")([^\\s\\]\\)/\\}!\\-\u003d,.;])(?!$)
2=$1 $2
3=0

[#38]
T=4
! Enforce Correct Word Spacing [7]=
F=_FILENAME
1=([^\\s\\[\\(/\\{])(".*?")
2=$1 $2
3=0

[#39]
T=5
! Enforce Correct Word Spacing [8]=
F=_FILENAME
1=$regexp(%_filename%,'(\\.(?<!\\.\\.))(?![\\s\\.'''';\\)\\]"])(?![\\l\\u](\\.|$| ))(?!$)(?!\\d)(?!(co|com|uk|net|org|gov|edu|mil|html?|php))',$0 )

[#40]
T=4
! Enforce Correct Word Spacing [9]=
F=_FILENAME
1=ww.\\s
2=ww.
3=0

[#41]
T=4
! Enforce Correct Word Spacing [10]=
F=_FILENAME
1="\\s?(.*?)\\s?"
2="$1"
3=0

[#42]
T=4
! Add Apostrophe to "Are" Contractions=
F=_FILENAME
1=\\b(how|they|what|when|why|you)re\\b
2=$1're
3=0

[#43]
T=4
! Add Apostrophe to "Have" Contractions=
F=_FILENAME
1=\\b(could|how|i|might|must|should|we|what|where|would|you)ve\\b
2=$1've
3=0

[#44]
T=4
! Add Apostrophe to "Is" Contractions=
F=_FILENAME
1=\\b(he|here|how|she|that|there|two|what|when|where|who|why)s\\b
2=$1's
3=0

[#45]
T=4
! Add Apostrophe to "Not" Contractions=
F=_FILENAME
1=\\b(ain|aren|can|couldn|didn|doesn|don|hadn|hasn|haven|isn|mightn|mustn|shouldn|wasn|weren|won|wouldn)t\\b
2=$1't
3=0

[#46]
T=4
! Add Apostrophe to "Will" Contractions=
F=_FILENAME
1=\\b(how|it|that|there|they|what|when|where|who|you)ll\\b
2=$1'll
3=0

[#47]
T=5
! Title Case Conversion [1] (Convert Words to Mixed-Case, Ignoring Upper-Case Letters)=
F=_FILENAME
1=$regexp(%_filename%,'([-({\\[\\]}) _",.+&@;*])(\\l)',$1\\u$2)

[#48]
T=4
! Title Case Conversion [2] (Capitalise First Word)=
F=_FILENAME
1=^(\\l)
2=$upper($1)
3=1

[#49]
T=4
! Title Case Conversion [3] (Articles, Conjunctions & Short Prepositions to Lower-Case, Except Before or After Punctuation)=
F=_FILENAME
1=(?<!&|:|;|-|/|!|(?<![A-Z]\\.[A-Z])\\.|\\?|\\+)(\\s+\\b(A|An|And|As|At|But|By|De|Et|For|From|In|Into|Le|Nor|Of|Off|On|Onto|Or|So|Than|The|To|Upon|Von|With)(?\u003d\\s)(?!\\s[\\-\\(\\)\\[\\]{}]))
2=$lower($1)
3=1

[#50]
T=4
! Title Case Conversion [4]=
F=_FILENAME
1=(^|\\s|\\(|\\[|/)'(.{1})
2=$1'$upper($2)
3=0

[#51]
T=4
! Title Case Conversion [5] (Capitalise "to" Before Common Verbs)=
F=_FILENAME
1=(to\\s+)\\b(Ask|Be|Begin|Believe|Bring|Buy|Call|Care|Change|Cheat|Come|Cry|Dance|Die|Do|Dream|Fall|Feel|Find|Forget|Get|Give|Go|Hate|Have|Hear|Hide|Hold|Keep|Know|Laugh|Learn|Leave|Let|Lie|Listen|Live|Look|Lose|Love|Make|Mean|Miss|Move|Marry|Need|Play|Pretend|Promise|Put|Remember|Return|Ride|Run|Say|See|Sell|Send|Set|Show|Sing|Speak|Stand|Stay|Steal|Stop|Take|Talk|Tell|Thank|Think|Touch|Travel|Try|Use|Wait|Walk|Want|Win|Wish|Work|Write)\\b
2=$caps($1)$2
3=1

[#52]
T=4
! Forced Upper-Case for Named Abbreviations and Acronyms=
F=_FILENAME
1=\\b(ac|aka|ap|asap|atm|bbc|bc|bce|blt|btw|cbs|cc|cd|cia|dc|dj|doa|emi|ep|faq|fbi|fm|fr|gb|gi|imho|ira|irs|jc|kkk|lp|mc|mgm|nasa|nbc|npr|ny|nyc|ok|ost|pm|ps|qed|rca|rpm|sos|tba|tlc|tv|ufo|uk|usa|ussr|va|ymca)\\b
2=$upper($1)
3=0

[#53]
T=4
! CamelCase Irish Names Beginning with O'=
F=_FILENAME
1=\\b(O'[a-z]|O\\x{2019}[a-z])
2=$upper($1)
3=1

[#54]
T=4
! CamelCase Scottish Names Beginning with Mc=
F=_FILENAME
1=\\b(Mc)((?:[a-z]|-){3,})
2=$1$caps2($2,-)
3=1

[#55]
T=4
! CamelCase Common Scottish Names Beginning with Mac=
F=_FILENAME
1=\\b(Mac)(Alister|Arthur|Askill|Bain|Coll|Donald|Dougall|Dowell|Duff|Ewen|Farlane|Gregor|Intyre|Kenzie|Kinnon|Laren|Lean|Leod|Millan|Nab|Neil|Pherson|Rae)\\b
2=$1$caps2($2)
3=0

[#56]
T=4
! Roman Numerals to Upper-Case (Up to LXXIX, or 89)=
F=_FILENAME
1=\\b(?:L?X{0,3}|XL)(?:V?I{0,3}|I[VX])(?\u003d(\\.\\s|\\s|\\)|$))
2=$upper($0)
3=0

[#57]
T=4
! Common Latinisms and Miscellany to Lowercase=
F=_FILENAME
1=(\\b(?:E\\.G|et\\sAl|Etc|I\\.E|Versus|Vs|Feat\\.\\s|Ft\\.\\s|(?<\u003d')N(?\u003d'))\\b)
2=$lower($1)
3=1

Then the first step would be to get the tags right and play around with the filenames.
Just a reminder: the only quality a filename has to have is to be unique.
Filenames have a number of restrictions in respect to allowed characters. So if you want to have information that is as close as possible to the original, use the tags that do not have these many restrictions.
Did you know: you can use the function Convert>Tag-Tag with its preview to evaluate the regular expressions. SO you can try if a regular expression fits and optimize it for your purpose.
I will not go through the list of 28 expressions from that screendump and discuss the details.
Is that taken from Grammatron?
If you find more cases that you want to have handled in a different way: write your own actions that lead to correct results.

After reviewing the coding for Grammartron, combining with the Capitalisation script, I added a modification to amend the discnumber and tweaked the whole lot to function correctly as I described previously.

Hope this helps someone else now that the original authors do not appear to be active.

[#0]
T=4
F=DISCNUMBER
1=^(\\d+)/\\d+
2=$1
3=0

[#1]
T=1
F=_TAG
1=1
2=

[#2]
T=4
F=_TAG
1=\\\\b(A|An|The|And|But|Or|So|After|Before|Out|When|While|Since|Until|Although|Even If|Because|About|Above|Across|Against|Along|Alongside|As|At|Below|By|During|For|From|In|Into|Of|Off|On|Onto|Over|Than|Through|Till|To|Under|Up|With|Within|Without)\\\\b
2=$lower($1)
3=0

[#3]
T=4
F=_TAG
1=^\\\\s*(\\\\w+)
2=$caps($1)
3=0

[#4]
T=4
F=_TAG
1=(\\\\w+)\\\\s*$
2=$caps($1)
3=0

[#7]
T=1
F=_DIRECTORY
1=1
2=

[#8]
T=4
F=_DIRECTORY
1=\\\\b(A|An|The|And|But|Or|So|After|Before|Out|When|While|Since|Until|Although|Even If|Because|About|Above|Across|Against|Along|Alongside|As|At|Below|By|During|For|From|In|Into|Of|Off|On|Onto|Over|Than|Through|Till|To|Under|Up|With|Within|Without)\\\\b
2=$lower($1)
3=0

[#9]
T=4
F=_DIRECTORY
1=^\\\\s*(\\\\w+)
2=$caps($1)
3=0

[#10]
T=4
F=_DIRECTORY
1=(\\\\w+)\\\\s*$
2=$caps($1)
3=0

[#11]
T=4
! Trim Trailing, Preceding & Extra Spaces [1]=
F=_DIRECTORY
1=(\\s+$|^\\s+)
2=
3=0

[#12]
T=4
! Trim Trailing, Preceding & Extra Spaces [2]=
F=_DIRECTORY
1=\\s+
2= 
3=0

[#13]
T=4
! Enforce Correct Word Spacing [1]=
F=_DIRECTORY
1=([^\\s\\.;\\)\\]/])([&\\({\\[\\+])
2=$1 $2
3=0

[#14]
T=4
! Enforce Correct Word Spacing [2]=
F=_DIRECTORY
1=(&|\\)|\\}|\\]|;|(?<!\\d),|,(?!\\d{3})|\\+)([^\\s\\.;\\(\\[/])
2=$1 $2
3=0

[#15]
T=4
! Enforce Correct Word Spacing [3]=
F=_DIRECTORY
1=\\b([a-z])\\s(&)\\s([a-z])\\b
2=$1$2$3
3=0

[#16]
T=4
! Enforce Correct Word Spacing [4]=
F=_DIRECTORY
1=([\\(\\[])\\s
2=$1
3=0

[#17]
T=4
! Enforce Correct Word Spacing [5]=
F=_DIRECTORY
1=\\s(\\]|\\)|\\?|:|;|,|\\.(?!\\.\\.))
2=$1
3=0

[#18]
T=4
! Enforce Correct Word Spacing [6]=
F=_DIRECTORY
1=(".*?")([^\\s\\]\\)/\\}!\\-\u003d,.;])(?!$)
2=$1 $2
3=0

[#19]
T=4
! Enforce Correct Word Spacing [7]=
F=_DIRECTORY
1=([^\\s\\[\\(/\\{])(".*?")
2=$1 $2
3=0

[#20]
T=4
! Enforce Correct Word Spacing [8]=
F=_DIRECTORY
1=(\\.(?<!\\.\\.))(?![\\s\\.':;\\)\\]"])(?![\\l\\u](\\.|$| ))(?!$)(?!\\d)(?!(co|com|uk|net|org|gov|edu|mil|html?|php))
2=$0 
3=0

[#21]
T=4
! Enforce Correct Word Spacing [9]=
F=_DIRECTORY
1=ww.\\s
2=ww.
3=0

[#22]
T=4
! Enforce Correct Word Spacing [10]=
F=_DIRECTORY
1="\\s?(.*?)\\s?"
2="$1"
3=0

[#23]
T=4
! Add Apostrophe to "Are" Contractions=
F=_DIRECTORY
1=\\b(how|they|what|when|why|you)re\\b
2=$1're
3=0

[#24]
T=4
! Add Apostrophe to "Have" Contractions=
F=_DIRECTORY
1=\\b(could|how|i|might|must|should|we|what|where|would|you)ve\\b
2=$1've
3=0

[#25]
T=4
! Add Apostrophe to "Is" Contractions=
F=_DIRECTORY
1=\\b(he|here|how|she|that|there|two|what|when|where|who|why)s\\b
2=$1's
3=0

[#26]
T=4
! Add Apostrophe to "Not" Contractions=
F=_DIRECTORY
1=\\b(ain|aren|can|couldn|didn|doesn|don|hadn|hasn|haven|isn|mightn|mustn|shouldn|wasn|weren|won|wouldn)t\\b
2=$1't
3=0

[#27]
T=4
! Add Apostrophe to "Will" Contractions=
F=_DIRECTORY
1=\\b(how|it|that|there|they|what|when|where|who|you)ll\\b
2=$1'll
3=0

[#28]
T=4
! Title Case Conversion [1] (Convert Words to Mixed-Case, Ignoring Upper-Case Letters)=
F=_DIRECTORY
1=([-({\\[\\]}) _",.+&@;*])(\\l)
2=$1$upper($2)
3=1

[#29]
T=4
! Title Case Conversion [2] (Capitalise First Word)=
F=_DIRECTORY
1=^(\\l)
2=$upper($1)
3=1

[#30]
T=4
! Title Case Conversion [3] (Articles, Conjunctions & Short Prepositions to Lower-Case, Except Before or After Punctuation)=
F=_DIRECTORY
1=(?<!&|:|;|-|/|!|(?<![A-Z]\\.[A-Z])\\.|\\?|\\+)(\\s+\\b(A|An|And|As|At|But|By|De|Et|For|From|In|Into|Le|Nor|Of|Off|On|Onto|Or|So|Than|The|To|Upon|Von|With)(?\u003d\\s)(?!\\s[\\-\\(\\)\\[\\]{}]))
2=$lower($1)
3=1

[#31]
T=4
! Title Case Conversion [4]=
F=_DIRECTORY
1=(^|\\s|\\(|\\[|/)'(.{1})
2=$1'$upper($2)
3=0

[#32]
T=4
! Title Case Conversion [5] (Capitalise "to" Before Common Verbs)=
F=_DIRECTORY
1=(to\\s+)\\b(Ask|Be|Begin|Believe|Bring|Buy|Call|Care|Change|Cheat|Come|Cry|Dance|Die|Do|Dream|Fall|Feel|Find|Forget|Get|Give|Go|Hate|Have|Hear|Hide|Hold|Keep|Know|Laugh|Learn|Leave|Let|Lie|Listen|Live|Look|Lose|Love|Make|Mean|Miss|Move|Marry|Need|Play|Pretend|Promise|Put|Remember|Return|Ride|Run|Say|See|Sell|Send|Set|Show|Sing|Speak|Stand|Stay|Steal|Stop|Take|Talk|Tell|Thank|Think|Touch|Travel|Try|Use|Wait|Walk|Want|Win|Wish|Work|Write)\\b
2=$caps($1)$2
3=1

[#33]
T=4
! Forced Upper-Case for Named Abbreviations and Acronyms=
F=_DIRECTORY
1=\\b(ac|aka|ap|asap|atm|bbc|bc|bce|blt|btw|cbs|cc|cd|cia|dc|dj|doa|emi|ep|faq|fbi|fm|fr|gb|gi|imho|ira|irs|jc|kkk|lp|mc|mgm|nasa|nbc|npr|ny|nyc|ok|ost|pm|ps|qed|rca|rpm|sos|tba|tlc|tv|ufo|uk|usa|ussr|va|ymca)\\b
2=$upper($1)
3=0

[#34]
T=4
! CamelCase Irish Names Beginning with O'=
F=_DIRECTORY
1=\\b(O'[a-z]|O\\x{2019}[a-z])
2=$upper($1)
3=1

[#35]
T=4
! CamelCase Scottish Names Beginning with Mc=
F=_DIRECTORY
1=\\b(Mc)((?:[a-z]|-){3,})
2=$1$caps2($2,-)
3=1

[#36]
T=4
! CamelCase Common Scottish Names Beginning with Mac=
F=_DIRECTORY
1=\\b(Mac)(Alister|Arthur|Askill|Bain|Coll|Donald|Dougall|Dowell|Duff|Ewen|Farlane|Gregor|Intyre|Kenzie|Kinnon|Laren|Lean|Leod|Millan|Nab|Neil|Pherson|Rae)\\b
2=$1$caps2($2)
3=0

[#37]
T=4
! Roman Numerals to Upper-Case (Up to LXXIX, or 89)=
F=_DIRECTORY
1=\\b(?:L?X{0,3}|XL)(?:V?I{0,3}|I[VX])(?\u003d(\\.\\s|\\s|\\)|$))
2=$upper($0)
3=0

[#38]
T=4
! Common Latinisms and Miscellany to Lowercase=
F=_DIRECTORY
1=(\\b(?:E\\.G|et\\sAl|Etc|I\\.E|Versus|Vs|Feat\\.\\s|Ft\\.\\s|(?<\u003d')N(?\u003d'))\\b)
2=$lower($1)
3=1

[#39]
T=4
! Trim Trailing, Preceding & Extra Spaces [1]=
F=_TAG
1=(\\s+$|^\\s+)
2=
3=0

[#40]
T=4
! Trim Trailing, Preceding & Extra Spaces [2]=
F=_TAG
1=\\s+
2= 
3=0

[#41]
T=4
! Enforce Correct Word Spacing [1]=
F=_TAG
1=([^\\s\\.:;\\)\\]/])([&\\({\\[\\+])
2=$1 $2
3=0

[#42]
T=4
! Enforce Correct Word Spacing [2]=
F=_TAG
1=(&|\\)|\\}|\\]|;|(?<!\\d),|,(?!\\d{3})|\\+)([^\\s\\.:;\\(\\[/])
2=$1 $2
3=0

[#43]
T=4
! Enforce Correct Word Spacing [3]=
F=_TAG
1=\\b([a-z])\\s(&)\\s([a-z])\\b
2=$1$2$3
3=0

[#44]
T=4
! Enforce Correct Word Spacing [4]=
F=_TAG
1=([\\(\\[])\\s
2=$1
3=0

[#45]
T=4
! Enforce Correct Word Spacing [5]=
F=_TAG
1=\\s(\\]|\\)|\\?|:|;|,|\\.(?!\\.\\.))
2=$1
3=0

[#46]
T=4
! Enforce Correct Word Spacing [6]=
F=_TAG
1=(".*?")([^\\s\\]\\)/\\}!\\-\u003d,.;:])(?!$)
2=$1 $2
3=0

[#47]
T=4
! Enforce Correct Word Spacing [7]=
F=_TAG
1=([^\\s\\[\\(/\\{])(".*?")
2=$1 $2
3=0

[#48]
T=4
! Enforce Correct Word Spacing [8]=
F=_TAG
1=(\\.(?<!\\.\\.))(?![\\s\\.':;\\)\\]"])(?![\\l\\u](\\.|$| ))(?!$)(?!\\d)(?!(co|com|uk|net|org|gov|edu|mil|html?|php))
2=$0 
3=0

[#49]
T=4
! Enforce Correct Word Spacing [9]=
F=_TAG
1=ww.\\s
2=ww.
3=0

[#50]
T=4
! Enforce Correct Word Spacing [10]=
F=_TAG
1="\\s?(.*?)\\s?"
2="$1"
3=0

[#51]
T=4
! Add Apostrophe to "Are" Contractions=
F=_TAG
1=\\b(how|they|what|when|why|you)re\\b
2=$1're
3=0

[#52]
T=4
! Add Apostrophe to "Have" Contractions=
F=_TAG
1=\\b(could|how|i|might|must|should|we|what|where|would|you)ve\\b
2=$1've
3=0

[#53]
T=4
! Add Apostrophe to "Is" Contractions=
F=_TAG
1=\\b(he|here|how|she|that|there|two|what|when|where|who|why)s\\b
2=$1's
3=0

[#54]
T=4
! Add Apostrophe to "Not" Contractions=
F=_TAG
1=\\b(ain|aren|can|couldn|didn|doesn|don|hadn|hasn|haven|isn|mightn|mustn|shouldn|wasn|weren|won|wouldn)t\\b
2=$1't
3=0

[#55]
T=4
! Add Apostrophe to "Will" Contractions=
F=_TAG
1=\\b(how|it|that|there|they|what|when|where|who|you)ll\\b
2=$1'll
3=0

[#56]
T=4
! Title Case Conversion [1] (Convert Words to Mixed-Case, Ignoring Upper-Case Letters)=
F=_TAG
1=([-({\\[\\]}) _",./+&@:;*])(\\l)
2=$1$upper($2)
3=1

[#57]
T=4
! Title Case Conversion [2] (Capitalise First Word)=
F=_TAG
1=^(\\l)
2=$upper($1)
3=1

[#58]
T=4
! Title Case Conversion [3] (Articles, Conjunctions & Short Prepositions to Lower-Case, Except Before or After Punctuation)=
F=_TAG
1=(?<!&|:|;|-|/|!|(?<![A-Z]\\.[A-Z])\\.|\\?|\\+)(\\s+\\b(A|An|And|As|At|But|By|De|Et|For|From|In|Into|Le|Nor|Of|Off|On|Onto|Or|So|Than|The|To|Upon|Von|With)(?\u003d\\s)(?!\\s[\\-\\(\\)\\[\\]{}]))
2=$lower($1)
3=1

[#59]
T=4
! Title Case Conversion [4]=
F=_TAG
1=(^|\\s|\\(|\\[|/)'(.{1})
2=$1'$upper($2)
3=0

[#60]
T=4
! Title Case Conversion [5] (Capitalise "to" Before Common Verbs)=
F=_TAG
1=(to\\s+)\\b(Ask|Be|Begin|Believe|Bring|Buy|Call|Care|Change|Cheat|Come|Cry|Dance|Die|Do|Dream|Fall|Feel|Find|Forget|Get|Give|Go|Hate|Have|Hear|Hide|Hold|Keep|Know|Laugh|Learn|Leave|Let|Lie|Listen|Live|Look|Lose|Love|Make|Mean|Miss|Move|Marry|Need|Play|Pretend|Promise|Put|Remember|Return|Ride|Run|Say|See|Sell|Send|Set|Show|Sing|Speak|Stand|Stay|Steal|Stop|Take|Talk|Tell|Thank|Think|Touch|Travel|Try|Use|Wait|Walk|Want|Win|Wish|Work|Write)\\b
2=$caps($1)$2
3=1

[#61]
T=4
! Forced Upper-Case for Named Abbreviations and Acronyms=
F=_TAG
1=\\b(ac|aka|ap|asap|atm|bbc|bc|bce|blt|btw|cbs|cc|cd|cia|dc|dj|doa|emi|ep|faq|fbi|fm|fr|gb|gi|imho|ira|irs|jc|kkk|lp|mc|mgm|nasa|nbc|npr|ny|nyc|ok|ost|pm|ps|qed|rca|rpm|sos|tba|tlc|tv|ufo|uk|usa|ussr|va|ymca)\\b
2=$upper($1)
3=0

[#62]
T=4
! Replay Gain Correction [1]=
F=REPLAYGAIN_TRACK_GAIN
1=(\\+|-)?\\s?(\\d*\\.\\d*)\\sDB
2=$1$2 dB
3=0

[#63]
T=4
! Replay Gain Correction [2]=
F=REPLAYGAIN_ALBUM_GAIN
1=(\\+|-)?\\s?(\\d*\\.\\d*)\\sDB
2=$1$2 dB
3=0

[#64]
T=4
! CamelCase Irish Names Beginning with O'=
F=_TAG
1=\\b(O'[a-z]|O\\x{2019}[a-z])
2=$upper($1)
3=1

[#65]
T=4
! CamelCase Scottish Names Beginning with Mc=
F=_TAG
1=\\b(Mc)((?:[a-z]|-){3,})
2=$1$caps2($2,-)
3=1

[#66]
T=4
! CamelCase Common Scottish Names Beginning with Mac=
F=_TAG
1=\\b(Mac)(Alister|Arthur|Askill|Bain|Coll|Donald|Dougall|Dowell|Duff|Ewen|Farlane|Gregor|Intyre|Kenzie|Kinnon|Laren|Lean|Leod|Millan|Nab|Neil|Pherson|Rae)\\b
2=$1$caps2($2)
3=0

[#67]
T=4
! Roman Numerals to Upper-Case (Up to LXXIX, or 89)=
F=_TAG
1=\\b(?:L?X{0,3}|XL)(?:V?I{0,3}|I[VX])(?\u003d(\\.\\s|\\s|\\)|$))
2=$upper($0)
3=0

[#68]
T=4
! Common Latinisms and Miscellany to Lowercase=
F=_TAG
1=(\\b(?:E\\.G|et\\sAl|Etc|I\\.E|Versus|Vs|Feat\\.\\s|Ft\\.\\s|(?<\u003d')N(?\u003d'))\\b)
2=$lower($1)
3=1

[#5]
T=1
F=_FILENAME
1=1
2=

[#6]
T=5
F=_FILENAME
1=%track% %title%

Amendment including changing square brackets to round in tags, filename and directory (you will need to adjust the directory path to your own preferences):

 [#0]
T=4
F=DISCNUMBER
1=^(\\d+)/\\d+
2=$1
3=0

[#1]
T=1
F=_TAG
1=1
2=

[#1]
T=5
F=TRACK
1=[$num(%track%,1)]

[#2]
T=4
F=_TAG
1=\\\\b(A|An|The|And|But|Or|So|After|Before|Out|When|While|Since|Until|Although|Even If|Because|About|Above|Across|Against|Along|Alongside|As|At|Below|By|During|For|From|In|Into|Of|Off|On|Onto|Over|Than|Through|Till|To|Under|Up|With|Within|Without)\\\\b
2=$lower($1)
3=0

[#3]
T=4
F=_TAG
1=^\\\\s*(\\\\w+)
2=$caps($1)
3=0

[#4]
T=4
F=_TAG
1=(\\\\w+)\\\\s*$
2=$caps($1)
3=0

[#7]
T=1
F=_DIRECTORY
1=1
2=

[#8]
T=4
F=_DIRECTORY
1=\\\\b(A|An|The|And|But|Or|So|After|Before|Out|When|While|Since|Until|Although|Even If|Because|About|Above|Across|Against|Along|Alongside|As|At|Below|By|During|For|From|In|Into|Of|Off|On|Onto|Over|Than|Through|Till|To|Under|Up|With|Within|Without)\\\\b
2=$lower($1)
3=0

[#9]
T=4
F=_DIRECTORY
1=^\\\\s*(\\\\w+)
2=$caps($1)
3=0

[#10]
T=4
F=_DIRECTORY
1=(\\\\w+)\\\\s*$
2=$caps($1)
3=0

[#11]
T=4
! Trim Trailing, Preceding & Extra Spaces [1]=
F=_DIRECTORY
1=(\\s+$|^\\s+)
2=
3=0

[#12]
T=4
! Trim Trailing, Preceding & Extra Spaces [2]=
F=_DIRECTORY
1=\\s+
2= 
3=0

[#13]
T=4
! Enforce Correct Word Spacing [1]=
F=_DIRECTORY
1=([^\\s\\.;\\)\\]/])([&\\({\\[\\+])
2=$1 $2
3=0

[#14]
T=4
! Enforce Correct Word Spacing [2]=
F=_DIRECTORY
1=(&|\\)|\\}|\\]|;|(?<!\\d),|,(?!\\d{3})|\\+)([^\\s\\.;\\(\\[/])
2=$1 $2
3=0

[#15]
T=4
! Enforce Correct Word Spacing [3]=
F=_DIRECTORY
1=\\b([a-z])\\s(&)\\s([a-z])\\b
2=$1$2$3
3=0

[#16]
T=4
! Enforce Correct Word Spacing [4]=
F=_DIRECTORY
1=([\\(\\[])\\s
2=$1
3=0

[#17]
T=4
! Enforce Correct Word Spacing [5]=
F=_DIRECTORY
1=\\s(\\]|\\)|\\?|:|;|,|\\.(?!\\.\\.))
2=$1
3=0

[#18]
T=4
! Enforce Correct Word Spacing [6]=
F=_DIRECTORY
1=(".*?")([^\\s\\]\\)/\\}!\\-\u003d,.;])(?!$)
2=$1 $2
3=0

[#19]
T=4
! Enforce Correct Word Spacing [7]=
F=_DIRECTORY
1=([^\\s\\[\\(/\\{])(".*?")
2=$1 $2
3=0

[#20]
T=4
! Enforce Correct Word Spacing [8]=
F=_DIRECTORY
1=(\\.(?<!\\.\\.))(?![\\s\\.':;\\)\\]"])(?![\\l\\u](\\.|$| ))(?!$)(?!\\d)(?!(co|com|uk|net|org|gov|edu|mil|html?|php))
2=$0 
3=0

[#21]
T=4
! Enforce Correct Word Spacing [9]=
F=_DIRECTORY
1=ww.\\s
2=ww.
3=0

[#22]
T=4
! Enforce Correct Word Spacing [10]=
F=_DIRECTORY
1="\\s?(.*?)\\s?"
2="$1"
3=0

[#23]
T=4
! Add Apostrophe to "Are" Contractions=
F=_DIRECTORY
1=\\b(how|they|what|when|why|you)re\\b
2=$1're
3=0

[#24]
T=4
! Add Apostrophe to "Have" Contractions=
F=_DIRECTORY
1=\\b(could|how|i|might|must|should|we|what|where|would|you)ve\\b
2=$1've
3=0

[#25]
T=4
! Add Apostrophe to "Is" Contractions=
F=_DIRECTORY
1=\\b(he|here|how|she|that|there|two|what|when|where|who|why)s\\b
2=$1's
3=0

[#26]
T=4
! Add Apostrophe to "Not" Contractions=
F=_DIRECTORY
1=\\b(ain|aren|can|couldn|didn|doesn|don|hadn|hasn|haven|isn|mightn|mustn|shouldn|wasn|weren|won|wouldn)t\\b
2=$1't
3=0

[#27]
T=4
! Add Apostrophe to "Will" Contractions=
F=_DIRECTORY
1=\\b(how|it|that|there|they|what|when|where|who|you)ll\\b
2=$1'll
3=0

[#28]
T=4
! Title Case Conversion [1] (Convert Words to Mixed-Case, Ignoring Upper-Case Letters)=
F=_DIRECTORY
1=([-({\\[\\]}) _",.+&@;*])(\\l)
2=$1$upper($2)
3=1

[#29]
T=4
! Title Case Conversion [2] (Capitalise First Word)=
F=_DIRECTORY
1=^(\\l)
2=$upper($1)
3=1

[#30]
T=4
! Title Case Conversion [3] (Articles, Conjunctions & Short Prepositions to Lower-Case, Except Before or After Punctuation)=
F=_DIRECTORY
1=(?<!&|:|;|-|/|!|(?<![A-Z]\\.[A-Z])\\.|\\?|\\+)(\\s+\\b(A|An|And|As|At|But|By|De|Et|For|From|In|Into|Le|Nor|Of|Off|On|Onto|Or|So|Than|The|To|Upon|Von|With)(?\u003d\\s)(?!\\s[\\-\\(\\)\\[\\]{}]))
2=$lower($1)
3=1

[#31]
T=4
! Title Case Conversion [4]=
F=_DIRECTORY
1=(^|\\s|\\(|\\[|/)'(.{1})
2=$1'$upper($2)
3=0

[#32]
T=4
! Title Case Conversion [5] (Capitalise "to" Before Common Verbs)=
F=_DIRECTORY
1=(to\\s+)\\b(Ask|Be|Begin|Believe|Bring|Buy|Call|Care|Change|Cheat|Come|Cry|Dance|Die|Do|Dream|Fall|Feel|Find|Forget|Get|Give|Go|Hate|Have|Hear|Hide|Hold|Keep|Know|Laugh|Learn|Leave|Let|Lie|Listen|Live|Look|Lose|Love|Make|Mean|Miss|Move|Marry|Need|Play|Pretend|Promise|Put|Remember|Return|Ride|Run|Say|See|Sell|Send|Set|Show|Sing|Speak|Stand|Stay|Steal|Stop|Take|Talk|Tell|Thank|Think|Touch|Travel|Try|Use|Wait|Walk|Want|Win|Wish|Work|Write)\\b
2=$caps($1)$2
3=1

[#33]
T=4
! Forced Upper-Case for Named Abbreviations and Acronyms=
F=_DIRECTORY
1=\\b(ac|aka|ap|asap|atm|bbc|bc|bce|blt|btw|cbs|cc|cd|cia|dc|dj|doa|emi|ep|faq|fbi|fm|fr|gb|gi|imho|ira|irs|jc|kkk|lp|mc|mgm|mtv||nasa|nbc|npr|ny|nyc|ok|ost|pm|ps|qed|rca|rpm|sos|tba|tlc|tv|ufo|uk|usa|ussr|va|ymca)\\b
2=$upper($1)
3=0

[#34]
T=4
! CamelCase Irish Names Beginning with O'=
F=_DIRECTORY
1=\\b(O'[a-z]|O\\x{2019}[a-z])
2=$upper($1)
3=1

[#35]
T=4
! CamelCase Scottish Names Beginning with Mc=
F=_DIRECTORY
1=\\b(Mc)((?:[a-z]|-){3,})
2=$1$caps2($2,-)
3=1

[#36]
T=4
! CamelCase Common Scottish Names Beginning with Mac=
F=_DIRECTORY
1=\\b(Mac)(Alister|Arthur|Askill|Bain|Coll|Donald|Dougall|Dowell|Duff|Ewen|Farlane|Gregor|Intyre|Kenzie|Kinnon|Laren|Lean|Leod|Millan|Nab|Neil|Pherson|Rae)\\b
2=$1$caps2($2)
3=0

[#37]
T=4
! Roman Numerals to Upper-Case (Up to LXXIX, or 89)=
F=_DIRECTORY
1=\\b(?:L?X{0,3}|XL)(?:V?I{0,3}|I[VX])(?\u003d(\\.\\s|\\s|\\)|$))
2=$upper($0)
3=0

[#38]
T=4
! Common Latinisms and Miscellany to Lowercase=
F=_DIRECTORY
1=(\\b(?:E\\.G|et\\sAl|Etc|I\\.E|Versus|Vs|Feat\\.\\s|Ft\\.\\s|(?<\u003d')N(?\u003d'))\\b)
2=$lower($1)
3=1

[#39]
T=4
! Trim Trailing, Preceding & Extra Spaces [1]=
F=_TAG
1=(\\s+$|^\\s+)
2=
3=0

[#40]
T=4
! Trim Trailing, Preceding & Extra Spaces [2]=
F=_TAG
1=\\s+
2= 
3=0

[#41]
T=4
! Enforce Correct Word Spacing [1]=
F=_TAG
1=([^\\s\\.:;\\)\\]/])([&\\({\\[\\+])
2=$1 $2
3=0

[#42]
T=4
! Enforce Correct Word Spacing [2]=
F=_TAG
1=(&|\\)|\\}|\\]|;|(?<!\\d),|,(?!\\d{3})|\\+)([^\\s\\.:;\\(\\[/])
2=$1 $2
3=0

[#43]
T=4
! Enforce Correct Word Spacing [3]=
F=_TAG
1=\\b([a-z])\\s(&)\\s([a-z])\\b
2=$1$2$3
3=0

[#44]
T=4
! Enforce Correct Word Spacing [4]=
F=_TAG
1=([\\(\\[])\\s
2=$1
3=0

[#45]
T=4
! Enforce Correct Word Spacing [5]=
F=_TAG
1=\\s(\\]|\\)|\\?|:|;|,|\\.(?!\\.\\.))
2=$1
3=0

[#46]
T=4
! Enforce Correct Word Spacing [6]=
F=_TAG
1=(".*?")([^\\s\\]\\)/\\}!\\-\u003d,.;:])(?!$)
2=$1 $2
3=0

[#47]
T=4
! Enforce Correct Word Spacing [7]=
F=_TAG
1=([^\\s\\[\\(/\\{])(".*?")
2=$1 $2
3=0

[#48]
T=4
! Enforce Correct Word Spacing [8]=
F=_TAG
1=(\\.(?<!\\.\\.))(?![\\s\\.':;\\)\\]"])(?![\\l\\u](\\.|$| ))(?!$)(?!\\d)(?!(co|com|uk|net|org|gov|edu|mil|html?|php))
2=$0 
3=0

[#49]
T=4
! Enforce Correct Word Spacing [9]=
F=_TAG
1=ww.\\s
2=ww.
3=0

[#50]
T=4
! Enforce Correct Word Spacing [10]=
F=_TAG
1="\\s?(.*?)\\s?"
2="$1"
3=0

[#51]
T=4
! Add Apostrophe to "Are" Contractions=
F=_TAG
1=\\b(how|they|what|when|why|you)re\\b
2=$1're
3=0

[#52]
T=4
! Add Apostrophe to "Have" Contractions=
F=_TAG
1=\\b(could|how|i|might|must|should|we|what|where|would|you)ve\\b
2=$1've
3=0

[#53]
T=4
! Add Apostrophe to "Is" Contractions=
F=_TAG
1=\\b(he|here|how|she|that|there|two|what|when|where|who|why)s\\b
2=$1's
3=0

[#54]
T=4
! Add Apostrophe to "Not" Contractions=
F=_TAG
1=\\b(ain|aren|can|couldn|didn|doesn|don|hadn|hasn|haven|isn|mightn|mustn|shouldn|wasn|weren|won|wouldn)t\\b
2=$1't
3=0

[#55]
T=4
! Add Apostrophe to "Will" Contractions=
F=_TAG
1=\\b(how|it|that|there|they|what|when|where|who|you)ll\\b
2=$1'll
3=0

[#56]
T=4
! Title Case Conversion [1] (Convert Words to Mixed-Case, Ignoring Upper-Case Letters)=
F=_TAG
1=([-({\\[\\]}) _",./+&@:;*])(\\l)
2=$1$upper($2)
3=1

[#57]
T=4
! Title Case Conversion [2] (Capitalise First Word)=
F=_TAG
1=^(\\l)
2=$upper($1)
3=1

[#58]
T=4
! Title Case Conversion [3] (Articles, Conjunctions & Short Prepositions to Lower-Case, Except Before or After Punctuation)=
F=_TAG
1=(?<!&|:|;|-|/|!|(?<![A-Z]\\.[A-Z])\\.|\\?|\\+)(\\s+\\b(A|An|And|As|At|But|By|De|Et|For|From|In|Into|Le|Nor|Of|Off|On|Onto|Or|So|Than|The|To|Upon|Von|With)(?\u003d\\s)(?!\\s[\\-\\(\\)\\[\\]{}]))
2=$lower($1)
3=1

[#59]
T=4
! Title Case Conversion [4]=
F=_TAG
1=(^|\\s|\\(|\\[|/)'(.{1})
2=$1'$upper($2)
3=0

[#60]
T=4
! Title Case Conversion [5] (Capitalise "to" Before Common Verbs)=
F=_TAG
1=(to\\s+)\\b(Ask|Be|Begin|Believe|Bring|Buy|Call|Care|Change|Cheat|Come|Cry|Dance|Die|Do|Dream|Fall|Feel|Find|Forget|Get|Give|Go|Hate|Have|Hear|Hide|Hold|Keep|Know|Laugh|Learn|Leave|Let|Lie|Listen|Live|Look|Lose|Love|Make|Mean|Miss|Move|Marry|Need|Play|Pretend|Promise|Put|Remember|Return|Ride|Run|Say|See|Sell|Send|Set|Show|Sing|Speak|Stand|Stay|Steal|Stop|Take|Talk|Tell|Thank|Think|Touch|Travel|Try|Use|Wait|Walk|Want|Win|Wish|Work|Write)\\b
2=$caps($1)$2
3=1

[#61]
T=4
! Forced Upper-Case for Named Abbreviations and Acronyms=
F=_TAG
1=\\b(ac|aka|ap|asap|atm|bbc|bc|bce|blt|btw|cbs|cc|cd|cia|dc|dj|doa|emi|ep|faq|fbi|fm|fr|gb|gi|imho|ira|irs|jc|kkk|lp|mc|mgm|mtv|nasa|nbc|npr|ny|nyc|ok|ost|pm|ps|qed|rca|rpm|sos|tba|tlc|tv|ufo|uk|usa|ussr|va|ymca)\\b
2=$upper($1)
3=0

[#62]
T=4
! Replay Gain Correction [1]=
F=REPLAYGAIN_TRACK_GAIN
1=(\\+|-)?\\s?(\\d*\\.\\d*)\\sDB
2=$1$2 dB
3=0

[#63]
T=4
! Replay Gain Correction [2]=
F=REPLAYGAIN_ALBUM_GAIN
1=(\\+|-)?\\s?(\\d*\\.\\d*)\\sDB
2=$1$2 dB
3=0

[#64]
T=4
! CamelCase Irish Names Beginning with O'=
F=_TAG
1=\\b(O'[a-z]|O\\x{2019}[a-z])
2=$upper($1)
3=1

[#65]
T=4
! CamelCase Scottish Names Beginning with Mc=
F=_TAG
1=\\b(Mc)((?:[a-z]|-){3,})
2=$1$caps2($2,-)
3=1

[#66]
T=4
! CamelCase Common Scottish Names Beginning with Mac=
F=_TAG
1=\\b(Mac)(Alister|Arthur|Askill|Bain|Coll|Donald|Dougall|Dowell|Duff|Ewen|Farlane|Gregor|Intyre|Kenzie|Kinnon|Laren|Lean|Leod|Millan|Nab|Neil|Pherson|Rae)\\b
2=$1$caps2($2)
3=0

[#67]
T=4
! Roman Numerals to Upper-Case (Up to LXXIX, or 89)=
F=_TAG
1=\\b(?:L?X{0,3}|XL)(?:V?I{0,3}|I[VX])(?\u003d(\\.\\s|\\s|\\)|$))
2=$upper($0)
3=0

[#68]
T=4
! Common Latinisms and Miscellany to Lowercase=
F=_TAG
1=(\\b(?:E\\.G|et\\sAl|Etc|I\\.E|Versus|Vs|Feat\\.\\s|Ft\\.\\s|(?<\u003d')N(?\u003d'))\\b)
2=$lower($1)
3=1

[#5]
T=1
F=_FILENAME
1=1
2=

[#6]
T=5
F=_FILENAME
1=$replace(%TRACK% %TITLE%,'[','(',']',')')

[#0]
T=5
F=ALBUM
1=$replace(%ALBUM%,'[','(',']',')')

[#1]
T=5
F=TITLE
1=$replace(%TITLE%,'[','(',']',')')

[#3]
T=5
F=_DIRECTORY
1=$replace(A:\\Music\\Record\\%artist%\\%album%,'[','(',']',')')

Further tests confirm this works well on almost all files. One exception I have come across is where it comes across names which are deliberately in full caps.

For example, '(feat. LOLO)' is converted to '(feat. Lolo)'. Please tell me how can I add an exception which tells the code not to change case if the text is preceded by '(feat. '? The complication with this is that everything else outside the brackets would still need to be processed as usual.

I copied the content second part of your post "Amendment including changing square brackets to round in tags, filename and directory" to a .mta file under the ...\data\actions directory of the mp3tag installation. However, it doesn't show up under the 'Actions' or Actions -> Group menus even after restarting the application. How do I get your code in action?

Thanks for sharing and cheers.

This thread shows a list of possible locations for the data folder:

I've copied the .mta file to data\actions directory under the main installated path itself, where the Case conversion, CD-R and Standard.mta files that come with the installation reside. I guess the customized mta file should also be picked up from this directory as well. Or does the above mentioned directory have any exclusivity to not pick up custom scripts?

-- Update --

I copied it under the roaming profile directory, and it worked! So it does look like mp3tag refuses to add custom scripts that were copied to data\actions under the main installation directory.

For others getting to the same issue, I confirm this has solved the problem. Thanks for the tip.

Did you check the locations mentioned in the linked thread?
The program installation path is only valid if you have a portable installation.
Otherwise it should be in the %APPDATA% folder.
See the linked thread for the exact name.

I do not have a portable installation, but as mentioned in my previous post, copying the mta file under the romaing profile directory for mp3tag worked.

Thanks again to your quick answer. The mta file is now picked up.

This is stripping whitespace characters in between words (!) and squishing all text fields in the tag with all text resulting in the CamelHump notation! Just messed up a lot of audio files. Can you again check the result of the code you posted above?

-- Update --
I figured why the code is squishing words stripping them of all whitespace inbetween. The offending section is below. Once I commented #40, it doesn't strip all whitespace in between words and retains word boundaries. While it may retain redundant whitespace, at least it preserves the integrity of words.

! [#40]
! T=4
! Trim Trailing, Preceding & Extra Spaces [2]=
! F=_TAG
! 1=\s+
! 2=
! 3=0

The same goes for directory names as well, by commenting section 12, as below:

! [#12]
! T=4
! Trim Trailing, Preceding & Extra Spaces [2]=
! F=_DIRECTORY
! 1=\s+
! 2=
! 3=0

Also, the code you posted seems to be disrupting the track numbering as well. Example: 01/72 becomes 1! The 01/72 numbering is intentional to indicate the current track in a total. I don't have the time to figure a fix for this yet, but if someone else can chip in before my fix, it would be beneficial for others.

Thanks for this. It is great. The only thing it does that I do not want is include a space after } or before ].

Basically I used brackets and curly brackets to divide information in my albums. I cannot figure out how to remove the brackets and curly brackets for the word spacing component. I would like to keep the proper spacing after other characters like colon, semi-colon, commas, periods (But also not changing multiple periods such as "...." etc.

Can you explain how I would remove this? I have tried removing certain parts to no avail.

Another thing I would like to tweak is the capitalization of The in a sequence where I have two entities, so it is not the end of the line. For example, let's say I have two composers: The Grateful Dead And Robert Hunter. If I have "Grateful Dead, The / Hunter, Robert" as the value in Composer, this script would change this to "Grateful Dead, the / Hunter Robert." I would prefer it kept as I originally had it.

I guess all these instances would have a " / " between them and maybe that would make this possible, but hopefully the script will not require this condition.

Thanks!

So I figured out how to accomplish my second question: Preventing "The" from being converted to lower case if after a comma. And I thought I would report bacv in case this helps anyone.

Since I also have cases where I use the Greater Than Sign (">") to signify that a song is seguing into another, and I also sometimes use Forward Slashes ("/") to separate terms, I also wanted these characters to represent punctuation.

So I changed a line in Gammartron to include these characters (in bold):

T=4
! Title Case Conversion [3] (Articles, Conjunctions & Short Prepositions to Lower-Case, Except Before or After Punctuation)=
F=_TAG
1=(?<!&|:|;|-|/|!|,|>|/|(?<![A-Z]\.[A-Z])\.|\?|\+)(\s+\b(A|An|And|As|At|But|By|De|Et|For|From|In|Into|Le|Nor|Of|Off|On|Onto|Or|So|Than|The|To|Upon|Von|With)(?\u003d\s)(?!\s[\-\(\)\[\]{}]))
2=$lower($1)
3=1

Now "The" is not converted to lower case when following a comma, greater than sign, or forward slash.

I would still like to figure out how to include the spacing portion of the script, which I have removed in order to not create spaces between curly brackets and brackets.

I think that if you have such a text in your fields, then it does not comply with typing rules as there should be a space character following the punctuation if further text follows.

I don't know where this comes from.
But: To remove or add spaces after specific characters, use a simple "Replace" where you replace the character-space text constant with just the character.

I don't know how I did not see this before, but thanks again. I was able to address the capitalization issue with by adding the comma as a punctuation (6th entry) (which I modified from grammatron):
replace with regular expression
Field: _Tag

Regular Expression: (?<!&|:|;|-|/|!|,|>|/|(?<![A-Z].[A-Z]).|?|+)(\s+\b(A|An|And|As|At|But|By|De|Et|For|From|In|Into|Le|Nor|Of|Off|On|Onto|Or|So|Than|The|To|Upon|Von|With)(?=\s)(?!\s[-()[]{}]))

Replace with:
$lower($1)

Now, for some reason, I cannot get the first word of a tag to capitalize. I tried to use $caps2(string) using a format value action, but for some reason it is not working. It is weird but _TAG is not one of the options for the Field. I can do it with each individual field but it would be great if I could just use tag. I did try typing _TAG and %_TAG%, but to no avail.

Any idea why _Tag is missing, or cannot be used?

Don't ask me about %_tag% or %_all% as I never use them.
An uncontrolled capitalization would be an absolute horror for me.
AFAIK both global pseudo variables are only available for very few actions and they appear in the list of fields. If they don't show up, they are not allowed

1 Like