TitleCase.vbs

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

MCSmarties
Posts: 251
Joined: Tue Dec 06, 2005 8:01 pm

An idea on how to greatly expand this script

Post by MCSmarties »

Warning, my suggestion would cause a lot of work! *grin*

Here's the deal: I have files in several foreign languages in my collection.
The TitleCase script works great for English and it could of course be individually customized for a different language.
But why not make it more general so that it can be used for ANY language?

What I am suggesting is that whenever the user selects a bunch of files and starts the script,
a dialog box would appear asking which language to use (with a drop-down menu for the different available options).
Based on user input, the script would then capitalize the fields using a different set of capitalization rules.

A great summary of capitalization rules in many different languages (and you'll see, for a lot of them they are very similar)
can be found here: http://wiki.musicbrainz.org/CapitalizationStandard

Does anybody feel up to the challenge? :wink:

Hey, if this is still not challenging enough the script could be modified to automatically detect the correct language (or offer a guess which the user can confirm)...

Important note: the user should be able to verify and individually correct results before the changes are applied!
onkel_enno
Posts: 2153
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno »

@MCSmarties
That would be really cool, but it's not as simple as you think.
I had a look at you link for the german capitalization rules and as I thought, it's not possible to do that without any kind of dictionary because in German all nouns are capitalized, but how to determine if it's a noun or not?
MCSmarties
Posts: 251
Joined: Tue Dec 06, 2005 8:01 pm

Post by MCSmarties »

Onkel_enno

Thanks for the answer. You are right about German, I knew this was going to be a major problem...

The only way out I can think of would be to use a wordlist.
Question is, how large can/should that list be?

The script could be only limited at first, with a relatively short list of words that will be changed, while an unrecognized word is ignored
(or maybe asks the user for input and adds the answer to the respective "uppercase" or "lowercase" list?)

After all, I think that *in general* the vocabulary used in an album name or track name should not be that immense.
I'm not talking about case-checking lyrics! (Although come to think of it...! ;) )

There are free word lists available on the web (use google). A VERY extensive one (over 100'000 words!) can be found here:
http://wftp.tu-chemnitz.de/pub/Local/urz/ding/de-en/
Unfortunately it also contains english translations, so it would have to be cleaned first. Besides, it's definitely too large! (7MB)

And what about the Rechtsschreibreform?

Yeah, I guess German would be difficult. Fortunately, most other languages only capitalize proper nouns!

Übrigens, ich spreche auch Deutsch.
onkel_enno
Posts: 2153
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno »

MCSmarties wrote: And what about the Rechtsschreibreform?
F**k the Rechtsschreibreform? I write the old-school-way :lol:
Guest

Re: TitleCase.vbs

Post by Guest »

Risser wrote:A script that updates artist, album, album artist and song title to Title Case. It outputs the proposed changes in a window so you can decide whether or not to continue and make the changes.

If you decide to change Artist, Album Artist or Album, that change is made to the DB, so all other items in the library refering to that thing will be updated (but their tags may not be updated, so watch out if one of these things changes).

It's pretty smart about the location of punctuation, non-english letters, roman numerals, non-english contractions (d', l', etc.), initials, cardinal numbers (1st, 40th), years (1950s, 1960's) and words with no vowels, but it's not perfect.

There are two pipe-separated (|) lists of words at the start of the file. One is a "little" words list, like "the", "an", "a", "of" etc. If there's a word you'd like treated like a little word (maybe "on" or "by", or other words if your tags aren't english), add it to the list.

The second list is a list of "forced-case" words. If the parser sees this word in any case, it replaces it with the word in the list, making it exactly that case. This is good for acronyms with vowels (BTO, REM, ELO; CCR and CSN have no vowels, so they are auto-uppercased), things that need to stay lower case, or abbreviations with no vowels that should be uppercase, like Dr, Mr, Mrs, St, etc. Feel free to change these lists to match your collection.

It treats apostrophes as a letter, so these can be included in a word. For example, for "James Brown and the JB's", I have "JB's" and "JBs" in my forced case list.

Also, on the forced case list, you can specify a final piece of punctuation. Thus, I have "w/", which will lowercase "w/", but leave "W" alone to be uppercase. Also, I have "silence]" which will force that configuration to be lowercase (for tracks that are all silence), but will treat "Silence" normally.

Anyway, here's the script. Post any suggestions, changes or bugs.
And as always, thanks to the many authors whose code I cribbed.

Thanks!
Peter

Code: Select all

' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
'
'                "TitleCase.vbs", March-22-2004, v1.0
'         VBScript for MediaMonkey 2.3.1 (or above), written by Risser
'
' Purpose:
' - To update case on Artist, Album Artist, Album and Song Title fields.
'
' Notes:
' - This script writes tags then immediately updates the DB.  There is no
'   impact on the DB for tracks that are not part of the library (particularly, 
'   the tracks are not auto-added to the library)
' - If you update an Artist name or an Album name, it updates the name in the 
'   database and this change is reflected for all instances of that name, even 
'   if it wasn't one of the selected tracks.
' - It's pretty smart about the location of punctuation, roman numerals, foreign contractions 
'   (d', l', etc.), initials, cardinal numbers (1st, 40th), years (1950s, 1960's) and words with 
'   no vowels, but it's not perfect.
' - There are also two pipe-separated (|) lists of words.  One is a "little" words list, like "the", 
'   "an", "a", "of" etc.  If there's a word you'd like treated like a little word (maybe "on" or 
'   "by", or other words if your tags aren't english), add it to the list.
' - The second list is a list of "forced-case" words.  If the parser sees this word in any case, it 
'   replaces it with the word in the list, making it exactly that case.  This is good for acronyms 
'   with vowels (BTO, REM, ELO; CCR and CSN have no vowels, so they are auto-uppercased), things that 
'   need to stay lower case, or abbreviations with no vowels that should be uppercase, like Dr, Mr, 
'   Mrs, St, etc.  Feel free to change these lists to match your collection.
' - It treats apostrophes as a letter, so these can be included in a word.  For example, for "James 
'   Brown and the JB's", I have "JB's" and "JBs" in my forced case list.  
' - Also, on the forced case list, you can specify a final piece of punctuation.  Thus, I have "w/", 
'   which will lowercase "w/", but leave "W" alone to be uppercase.  Also, I have "silence]" which 
'   will force that configuration to be lowercase (for tracks that are all silence), but will treat 
'   "Silence" normally.
' - Only tested with MP3s
' - Although this script should be safe, USE AT YOUR OWN RISK
'
' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----

Option Explicit

Dim littleWordString
littleWordString = "a|an|and|at|de|del|di|du|e|el|en|et|for|from|la|le|in" & _
				   "|'n|n'|'n'|o'|'o'|of|or|por|the|to|un|une|und|with|y"
Dim forceCapString
forceCapString = "EBN|OZN|MCs|MC's|DJs|DJ's|JBs|JB's|10cc|Mr|Mrs|Dr|Jr|Sr|Pt|St.|St"& _ 
			     "|vs|ft|feat|aka|vol|w/|ABC|AC/|ASCII|ASCIII|ATV|BTO|ELO|ELP|EMI" & _
	             "|FYC|INXS|MacArthur|OMC|OMD|OMPS|PSI|PTA|REM|REO|Sgt|UB40|UK|USA|USMC|UTFO|" & _
	             "silence]|T's"

Dim res
Dim alphaNum, whiteSpace, isMc, vowels, romanNumerals, cardinal, isForeignPref
Set alphaNum = new regExp
Set whiteSpace = new regExp
Set isMc = new regExp
Set vowels = new regExp
Set romanNumerals = new RegExp
Set cardinal = new RegExp
Set isForeignPref = new RegExp
alphaNum.ignoreCase = True
alphaNum.pattern = "['`A-Za-z0-9¼½¾À-ËÎ-ÖØ-ßà-öø-ÿ]" 'if I've missed any, put them here.
whiteSpace.pattern = "^[\s,&]+$"  'include comma, ampersand, because we don't want to cap after these
isMc.ignoreCase = True
isMc.pattern = "^(O['`]|MC)"  ' handle O'Brien and McHenry
isForeignPref.ignoreCase = True
isForeignPref.pattern = "^([dl]|dell)['`]"  ' handle l', d' and dell'
vowels.ignoreCase = True
vowels.pattern = "[AEIOUYÀ-ÆÈ-ËÎÏÒ-ÖØ-Ýà-æè-ïò-öø-ýÿ]"
romanNumerals.ignoreCase = True
romanNumerals.pattern = "^M*(C(M|D)|D?C{0,3})(X(C|L)|L?X{0,3})(I(X|V)|V?I{0,3})$"
cardinal.ignoreCase = True
cardinal.pattern = "^\d*(0th|1st|2nd|3rd|[4-9]th|[0-9]['`]?s)$" 'also handles years, like 1950s
Dim littleWordList
littleWordList = Split(littleWordString,"|")
Dim forceCapList
forceCapList = Split(forceCapString,"|")
Public holdArtist, holdAlbum, holdTitle, holdAlbumArtist
Set holdArtist = CreateObject("Scripting.Dictionary")
Set holdAlbum = CreateObject("Scripting.Dictionary")
Set holdTitle = CreateObject("Scripting.Dictionary")
Set holdAlbumArtist = CreateObject("Scripting.Dictionary")

Const mmAnchorRight = 4
Const mmAnchorBottom = 8
Const mmAlignTop = 1
Const mmAlignBottom = 2
Const mmAlignClient = 5
Const mmListDropdown = 2
Const mmFormScreenCenter = 4
Public styleOn

Function Style()
  styleOn = Not styleOn
  If styleOn Then
    Style = ""
  Else
    Style = " class=""Dark"""
  End If
End Function

Function rdQS(UnquotedString)
  rdQS = "'" & Replace(UnquotedString, "'", "''") & "'"
End Function

Function uppercase(s)
	If Left(s,1) = "'" And Len(s) > 1 Then
		uppercase = Left(s,1)&UCase(Mid(s,2,1))&LCase(Mid(s,3))
	Else
		uppercase = UCase(Mid(s,1,1))&LCase(Mid(s,2))
	End If
End Function

Function fixUp(s, prevChars, nextChar)
	Dim forceIndex, littleIndex, i
	Dim capMe, allCaps, foreignPref
	Dim upcased, littleUpped, forceUpped
	forceIndex = -1
	littleIndex = -1
	capMe = false
	allCaps = false
	upcased = UCase(s)
	foreignPref = isForeignPref.test(s)
	
	For i = 0 to UBound(forceCapList)
		forceUpped = UCase(forceCapList(i))
		If UCase(forceCapList(i)) = upcased Or forceUpped = upcased & nextChar Then
			forceIndex = i
			Exit For
		End If
	Next 'i
	For i = 0 to UBound(littleWordList)
		littleUpped = UCase(littleWordList(i))
		If littleUpped = upcased Or littleUpped = upcased & nextChar Then
			littleIndex = i
			Exit For
		End If
	Next 'i
	If forceIndex >= 0 Then
		s = forceCapList(forceIndex)
	Else
		If Len(s) = 1 And nextChar = "." Then
		' if it's a single character followed by a period (an initial), caps it
			allCaps = True
		ElseIf Not vowels.test(s) And Not cardinal.test(s) Then
		' if it's all consonants, no vowels, and not a cardinal number, caps it
			allCaps = True
		ElseIf romanNumerals.test(s) And UCase(s) <> "MIX" And UCase(s) <> "DI" Then
		' if it's roman numerals (and not 'mix' or 'di' which are valid roman numerals), caps it
			allCaps = True
		ElseIf prevChars = "" Or (nextChar = "" And Not foreignPref) Then
		'if it's the first or last word, cap it
			capMe = True
		ElseIf Not whiteSpace.test(prevChars) Or (nextChar <> "" And InStr(")}]",nextChar)) Then
		' if it follows a punctuation mark (with or without spaces) or if it's before a close-bracket, cap it
			capMe = True
		ElseIf littleIndex < 0 And Not foreignPref Then
		' if it's not on the 'little word' list, cap it
			capMe = True
		End If
		If allCaps Then
			s = UCase(s)
		ElseIf capMe Then
			s = uppercase(s)
		Else
			s = LCase(s)
		End If
		If isMc.Test(s) And Len(s) > 2 Then
		' if it's Mc or O', cap the 3rd character (this assumes no names like McA)
			s = Mid(s,1,2)&UCase(Mid(s,3,1))&LCase(Mid(s,4))
		End If
		If foreignPref Then
		' if it's l', d' or dell', lowercase the first letter and uppercase the first letter after the apostrophe
			Dim pos
			pos = InStr(s,"'")
			If pos < 1 Then
				pos = InStr(s,"`")
			End If
			If pos > 0 And pos < Len(s) Then
				s = Mid(s,1,pos)&UCase(Mid(s,pos+1,1))&LCase(Mid(s,pos+2))
			End If
		End If
	End If
	fixUp = s
End Function

Function updateCase(s)
	Dim currentWord, result, fixed, theChar, lastNonWordChars
	Dim forceIndex
	Dim i
	currentWord = ""
	result = ""
	lastNonWordChars = ""
	
	For i = 1 to Len(s)
		theChar = Mid(s,i,1)
		If alphaNum.test(theChar) Then
			currentWord = currentWord & theChar
		Else
			If currentWord <> "" Then
				fixed = fixUp(currentWord,lastNonWordChars,theChar)
				If Right(fixed,1) = theChar Then 'handle stuff like w/
					fixed = Left(fixed,Len(fixed)-1)
					lastNonWordChars = ""
				Else
					lastNonWordChars = theChar
				End If
				result = result & fixed
				currentWord = ""
			Else
				lastNonWordChars = lastNonWordChars & theChar
			End If
			result = result & theChar
		End If
	Next 'i
	If Len(currentWord) > 0 Then
		result = result & fixUp(currentWord,lastNonWordChars,"")
	End If
	updateCase = result
End Function

Sub CloseDown
	Set holdAlbum = nothing
	Set holdAlbumArtist = nothing
	Set holdArtist = nothing
	Set holdTitle = nothing
	SDB.Objects("CaseThingy") = Nothing
	SDB.Objects("holdArtist") = Nothing
	SDB.Objects("holdAlbumArtist") = Nothing
	SDB.Objects("holdAlbum") = Nothing
	SDB.Objects("holdTitle") = Nothing
End Sub

Sub OnCancel(Btn)
	CloseDown
End Sub

Sub OnOK(Btn)
	Set holdAlbum = SDB.Objects("holdAlbum")
	Set holdAlbumArtist = SDB.Objects("holdAlbumArtist")
	Set holdArtist = SDB.Objects("holdArtist")
	Set holdTitle = SDB.Objects("holdTitle")

	Dim itm, str, sql
	Dim items, albumNames, artistNames
	Set items = CreateObject("Scripting.Dictionary")
	Set albumNames = CreateObject("Scripting.Dictionary")
	Set artistNames = CreateObject("Scripting.Dictionary")

	For Each itm In holdArtist
		str = holdArtist.item(itm)
		If Not items.exists(itm) Then
			items.add itm, itm
		End If
		itm.artistName = str
		If Not artistNames.exists(str) Then
			sql = "UPDATE Artists SET Artists.Artist = " & rdQS(str) & " WHERE Artists.Artist= " & rdQS(Itm.ArtistName)
			SDB.database.execSQL(sql)
			' This will affect ALL instances of this artist, including album artist, and on other tracks.
			artistNames.add str, str
		End If
	Next 'itm
	
	For Each itm In holdAlbumArtist
		str = holdAlbumArtist.item(itm)
		If Not items.exists(itm) Then
			items.add itm, itm
		End If
		itm.albumArtistName = str
		If Not artistNames.exists(str) Then
			sql = "UPDATE Artists SET Artists.Artist = " & rdQS(str) & " WHERE Artists.Artist= " & rdQS(Itm.ArtistName)
			SDB.database.execSQL(sql)
			artistNames.add str, str
		End If
	Next 'itm
	
	For Each itm In holdAlbum
		str = holdAlbum.item(itm)
		If Not items.exists(itm) Then
			items.add itm, itm
		End If
		itm.albumName = str
		If Not albumNames.exists(str) Then
			sql = "UPDATE Albums SET Albums.Album = " & rdQS(str) & " WHERE Albums.Album= " & rdQS(Itm.AlbumName)
			SDB.database.execSQL(sql)
			' This will affect ALL instances of this album, including other tracks.
			albumNames.add str, str
		End If
	Next 'itm
	
	For Each itm In holdTitle
		str = holdTitle.item(itm)
		If Not items.exists(itm) Then
			items.add itm, itm
		End If
		itm.title = str
	Next 'itm
	
	For Each itm In items
		If itm.ID>-1 Then
			itm.UpdateDB
		End If
		itm.WriteTags
	Next 'itm	
	
	Set items = nothing
	CloseDown
End Sub

Function MapXML(original)
	Dim hold
	hold = Replace(original, "&", "&")
	hold = Replace(hold, "  ", "&nbsp; ")
	hold = Replace(hold, "<", "<")
	hold = Replace(hold, ">", ">")
	Dim i
	i=1
	While i<=Len(hold)
		If (AscW(Mid(hold, i, 1))>127) Then
			hold = Mid(hold, 1, i-1)+"&#"+CStr(AscW(Mid(hold, i, 1)))+";"+Mid(hold, i+1)
		End If
		i=i+1
	WEnd
	MapXML = hold
End Function

Function outField (fixed, normal)
	If fixed = normal Then
		outField = "<td>" & MapXML(normal) & "</td>" & vbcrlf
	Else
		outField = "<td class=""highlight"">" & MapXML(fixed) & "</td>" & vbcrlf
	End If
End Function


Sub TitleCase
	Dim UI, Form, Foot, Btn, Btn2, WB, doc
	
	Dim trackList
	Dim writeChanges

	Set trackList = SDB.SelectedSongList
	If trackList.count=0 Then
		Set trackList = SDB.AllVisibleSongList
	End If

	If trackList.count=0 Then
		res = SDB.MessageBox("Select tracks to be updated", mtError, Array(mbOk))
		Exit Sub
	End If


	Set UI = SDB.UI

	' Create the window to be shown
	Set Form = UI.NewForm
	Form.Common.SetRect 50, 50, 500, 400
	Form.Common.MinWidth = 200
	Form.Common.MinHeight = 150
	Form.FormPosition = mmFormScreenCenter
	Form.SavePositionName = "CaseWindow"
	Form.Caption = SDB.Localize("Changes to Case")
	Form.StayOnTop = True

	' Create a panel at the bottom of the window
	Set Foot = UI.NewPanel(Form)
	Foot.Common.Align = mmAlignBottom
	Foot.Common.Height = 35

	' Create a button that closes the window
	Set Btn = UI.NewButton(Foot)
	Btn.Caption = SDB.Localize("&Cancel")
	Btn.Common.SetRect (Foot.Common.Width - 180)/2+95, 9, 85, 24
'	Btn.Common.SetRect Foot.Common.Width - 90, 9, 85, 24
	'Btn.Common.Hint = SDB.Localize("Close this report")
	Btn.Common.Anchors = mmAnchorRight + mmAnchorBottom
	Btn.UseScript = Script.ScriptPath
	Btn.OnClickFunc = "OnCancel"

	' Create a button that saves the report
	Set Btn2 = UI.NewButton(Foot)
	Btn2.Caption = SDB.Localize("&OK")
'	Btn2.Common.SetRect Foot.Common.Width - 90 - 5 - btn.common.width - 5, 9, 85, 24
	Btn2.Common.SetRect (Foot.Common.Width - 180)/2, 9, 85, 24
	'Btn2.Common.Hint = SDB.Localize("Save this report")
	Btn2.Common.Anchors = mmAnchorRight + mmAnchorBottom
	Btn2.UseScript = Script.ScriptPath
	Btn2.OnClickFunc = "OnOK"

	' Create a web browser component
	Set WB = UI.NewActiveX(Form, "Shell.Explorer")
	WB.Common.Align = mmAlignClient      ' Fill all client rectangle
	WB.Common.ControlName = "WB"
	WB.Interf.Navigate "about:"          ' A trick to make sure document exists
	Set doc = WB.Interf.Document

	Form.Common.Visible = True                ' Only show the form, don't wait for user input
	SDB.Objects("CaseThingy") = Form  ' Save reference to the form somewhere, otherwise it would simply disappear


	doc.write "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & vbcrlf
	doc.write "<html>" & vbcrlf
	doc.write "  <head>" & vbcrlf
	doc.write "    <title>" & SDB.Localize("Changes to Case") & "</title>" & vbcrlf
	doc.write "  </head>" & vbcrlf

	doc.write "<STYLE TYPE=text/css>" & vbcrlf
	doc.write "body{font-family:'Verdana',sans-serif; background-color:#FFFFFF; font-size:9pt; color:#000000;}" & vbcrlf
	doc.write "H1{font-family:'Verdana',sans-serif; font-size:13pt; font-weight:bold; color:#AAAAAA; text-align:left}" & vbcrlf
	doc.write "P{font-family:'Verdana',sans-serif; font-size:8pt; color:#000000;}" & vbcrlf
	doc.write "TH{font-family:'Verdana',sans-serif; font-size:9pt; font-weight:bold; color:#000000; border-color:#000000; border-style: solid; border-left-width:0px; border-right-width:0px; border-top-width:0px; border-bottom-width:3px;}" & vbcrlf
	doc.write "TD{font-family:'Verdana',sans-serif; font-size:8pt; color:#000000; border-color:#000000; border-style: solid; border-left-width:0px; border-right-width:0px; border-top-width:0px; border-bottom-width:1px;}" & vbcrlf
	doc.write "TD.highlight{font-family:'Verdana',sans-serif; font-size:8pt; background-color:#FFFF77; color:#000000; border-color:#000000; border-style: solid; border-left-width:0px; border-right-width:0px; border-top-width:0px; border-bottom-width:1px;}" & vbcrlf
	doc.write "TR.dark{background-color:#EEEEEE}" & vbcrlf
	doc.write "TR.aleft TH{text-align:left}" & vbcrlf
	doc.write "</STYLE>" & vbcrlf

	doc.write "  <body>" & vbcrlf
	doc.write "    <H1>" & SDB.Localize("Changes to Case:") & "</H1>" & vbcrlf
	doc.write "    <table border=""0"" cellspacing=""0"" cellpadding=""4"" width=""100%"">" & vbcrlf
'	doc.write "          <tr><th colspan=""4"">" & SDB.Localize(title) & "</th></tr>" & vbcrlf
	doc.write "      <tr class=""aleft"">" & vbcrlf
	doc.write "        <th>" & SDB.Localize("Artist") & "</th>" & vbcrlf
	doc.write "        <th>" & SDB.Localize("Title") & "</th>" & vbcrlf
	doc.write "        <th>" & SDB.Localize("Album") & "</th>" & vbcrlf
	doc.write "        <th>" & SDB.Localize("Album Artist") & "</th>" & vbcrlf
	doc.write "      </tr>" & vbcrlf

	Dim i, itm
	Dim artist, album, title, albumArtist
	for i=0 to trackList.count-1
		doc.write "      <tr" & Style() & ">" & vbcrlf

		Set itm = trackList.Item(i)
		artist = updateCase(itm.artistName)
		title = updateCase(itm.title)
		album = updateCase(itm.albumName)
		albumArtist = updateCase(itm.albumArtistName)
		
		doc.write outField(artist, itm.artistName)
		doc.write outField(title, itm.title)
		doc.write outField(album, itm.albumName)
		doc.write outField(albumArtist, itm.albumArtistName)
		If artist <> "" And artist <> itm.artistName Then
			holdArtist.add itm, artist
		End If
		If albumArtist <> "" And albumArtist <> itm.albumArtistName Then
			holdAlbumArtist.add itm, albumArtist
		End If
		If title <> "" And title <> itm.title Then
			holdTitle.add itm, title
		End If
		If album <> "" And album <> itm.albumName Then
			holdAlbum.add itm, album
		End If
		doc.write "      </tr>" & vbcrlf
		
	next 'i
	
	doc.write "    </table>" & vbcrlf
	doc.write "  </body>" & vbcrlf
	doc.write "</html>" & vbcrlf
	doc.close
	SDB.Objects("holdArtist") = holdArtist
	SDB.Objects("holdAlbumArtist") = holdAlbumArtist
	SDB.Objects("holdAlbum") = holdAlbum
	SDB.Objects("holdTitle") = holdTitle
End Sub
dreadlyone
Posts: 48
Joined: Mon Jan 07, 2008 2:06 pm

Post by dreadlyone »

Is this script compatible with version 3?
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Not this particular script in this post but the script is converted and shipped with MM. You find it in Tools->Scripts->Case Checker.

You can also try this modified version:
http://www.mediamonkey.com/forum/viewtopic.php?t=14822
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Deliverance
Posts: 2
Joined: Wed Oct 06, 2010 3:21 pm

Re: TitleCase.vbs

Post by Deliverance »

Hi ! I had just a simple request... how can i do to have the first letter of each word (every words) in caps ?

Thank you and more important... thank you for your script ! =)
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: TitleCase.vbs

Post by Lowlander »

Tools > Scripts > Case Checker
Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Re: TitleCase.vbs

Post by Dreadlau »

Deliverance wrote:Hi ! I had just a simple request... how can i do to have the first letter of each word (every words) in caps ?
Hello I haven't tried this script.
But it's possible if you use this one: http://www.mediamonkey.com/forum/viewto ... ading+zero
You can configure which words are ignored. Meaning you can set it to ignore none.
Seven Ultimate X64 SP1 / Sansa Clip 2go (with RockBox)
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: TitleCase.vbs

Post by Lowlander »

Ah yes, I missed the every word part. For that you'll need to edit the script.

You'll need to modify the littleWordString to littleWordString ="" in Program Files/MediaMonkey/Scripts/Case.vbs Unfortunately with each update of MediaMonkey you would need to do so again.
Deliverance
Posts: 2
Joined: Wed Oct 06, 2010 3:21 pm

Re: TitleCase.vbs

Post by Deliverance »

Succeeded to do that !

I don't understand how to proceed to put the little first letters in caps but i'll find it... ^^

Thank you nevertheless ! =)

Edit : Allright !!! It was easy in fact ! Thank you very very much ! =)
riggo
Posts: 1
Joined: Sun Oct 31, 2010 9:50 am

Re: TitleCase.vbs

Post by riggo »

Hi guys,

I successfully managed to integrate the Script according to the method from Bex (many thanks at this point), but the popping "Changes to Case" dialog remains completely blank. Yet it works converting the Cases on selecting files when clicking on "OK", probably executing the default routine.

Anyone got an idea?

Thanks and great respect to Risser for the nice work,

Riggo
sasdadasd
Posts: 1
Joined: Sun Nov 13, 2011 8:09 pm

Re: TitleCase.vbs

Post by sasdadasd »

Hello! This is my first post on this forum.. I hope someone will read this!
First of all, thanks for this awesome script, it really works and it's fully editable! Seriously, thanks a lot guys!
I'd like to ask you a question about it..
Would it be possible to enter a PHRASE in the forced cap string? I mean, two or more words separated by a space?
For example, i have set |VU| to be always uppercase, but i want "|Deja vu|" to be written just with the capital D.
I tried to put |Deja vu| in the forcecapstring but it didn't work..
Can somebody please help me figuring this out?
Thanks in advance and sorry for my poor english i'm german
Eyal
Posts: 3116
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec

Re: TitleCase.vbs

Post by Eyal »

Welcome to MediaMonkey community, sasdadasd :)

sasdadasd wrote:For example, i have set |VU| to be always uppercase, but i want "|Deja vu|" to be written just with the capital D.
It's not working because this script only works on one word at a time.
In other words, you are talking about an exception, based on previous word.

Keep your "VU" word in forceCapString variable and add the following exception before last line of updateCase function:

Replace (line 214):

Code: Select all

  updateCase = result
With:

Code: Select all

  If Instr(result,"Deja VU") Then result=Replace(result,"Deja VU", "Deja vu")
  updateCase = result
Cheers!
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].
Post Reply