was also in my forced Cap. list...
Here is my list from original case.vbs with a few things modded (only ft and vs are lowercase in my collection) and more Artist names added in fforced caps:
Because I'd like to be able to keep my filenames as they are and eventually blank out album artist.
Code: Select all
Sub TitleCase(o)
Dim UI, Form, Foot, Top, BtnOk, BtnCancel, Edt, WB, HTML,ini
Dim trackList
Dim writeChanges
Dim DlgWidth
Set ini = SDB.IniFile
Set trackList = SDB.CurrentSongList
If trackList.count=0 Then
res = SDB.MessageBox("Select tracks to be updated", mtError, Array(mbOk))
Exit Sub
End If
Set UI = SDB.UI
DlgWidth = 700
' Create the window to be shown
Set Form = UI.NewForm
Form.Common.SetRect 50, 50, DlgWidth, 400
Form.Common.MinWidth = 585
Form.Common.MinHeight = 150
Form.FormPosition = mmFormScreenCenter
Form.Caption = SDB.Localize("Case Checker")
Form.StayOnTop = True
' Create a panel at the bottom of the window
Set Foot = UI.NewPanel(Form)
Foot.Common.Align = 2 'mmAlignBottom
Foot.Common.Height = 55
' Create a web browser component
Set WB = UI.NewActiveX(Form, "Shell.Explorer")
WB.Common.Align = mmAlignClient ' Fill all client rectangle
WB.Common.ControlName = "WB"
' Create a button that saves the report
Set BtnOk = UI.NewButton(Foot)
BtnOk.Caption = SDB.Localize("&Ok")
BtnOk.Common.SetRect DlgWidth - 208, 25, 85, 25
BtnOk.Common.Anchors = mmAnchorRight + mmAnchorBottom
BtnOk.UseScript = Script.Scriptpath
BtnOk.OnClickFunc = "OnOK"
BtnOk.Default = True
BtnOk.Common.enabled = False
' Create a button that closes the window
Set BtnCancel = UI.NewButton(Foot)
BtnCancel.Caption = SDB.Localize("&Cancel")
BtnCancel.Common.SetRect DlgWidth - 108, 25, 85, 25
BtnCancel.Common.Anchors = mmAnchorRight + mmAnchorBottom
BtnCancel.UseScript = Script.Scriptpath
BtnCancel.OnClickFunc = "OnCancel"
BtnCancel.Cancel = True
BtnCancel.common.enabled = false
'-------------------------------------------------------------------
CreateNewEdit Foot, 5, 5, 80,20,"","LittleWord","To add a word, that always should be in lowercase,"& vbNewLine &_
"enter it into this box and press Add!"
CreateButton Foot, 88, 4, 75,23,"--> Add -->","","AddLittleWord","",True
CreateDropDown Foot,166, 5,120,20,"DDLittleWords", 0,"LittleWords",LittleWords,""
CreateButton Foot,289, 4, 75,23,"<-- Delete","RemLittleWord","RemLittleWord","To delete a 'Little word', select it in"&_
vbNewLine & "the dropdown-list and press Delete",True
CreateNewEdit Foot, 5, 28, 80,20,"","ForceCaseWord","To add a word, that always should be as entered,"&_
vbNewLine & "enter it into this box and press Add!"
CreateButton Foot, 88, 27, 75,23,"--> Add -->","","AddForceCaseWord","",True
CreateDropDown Foot,166, 28,120,20,"DDForceCaseWords", 0,"ForceCaseWords",ForceCaseWords,""
CreateButton Foot,289, 27, 75,23,"<-- Delete","RemForceCaseWord","RemForceCaseWord","To delete a 'Forced Case Word', select it in"& vbNewLine &_
"the dropdown-list and press Delete",True
CreateButton Foot,375, 4,100,47,"Refresh","","RefreshTitleCase","",True
Form.SavePositionName = "CaseWindow"
'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
HTML = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & vbcrlf
HTML = HTML & "<html>" & vbcrlf
HTML = HTML & " <head>" & vbcrlf
HTML = HTML & " <title>" & SDB.Localize("Case Checker") & "</title>" & vbcrlf
HTML = HTML & " </head>" & vbcrlf
HTML = HTML & "<STYLE TYPE=text/css>" & vbcrlf
HTML = HTML & "body{font-family:'Verdana',sans-serif; background-color:#FFFFFF; font-size:9pt; color:#000000;}" & vbcrlf
HTML = HTML & "H1{font-family:'Verdana',sans-serif; font-size:13pt; font-weight:bold; color:#AAAAAA; text-align:left}" & vbcrlf
HTML = HTML & "P{font-family:'Verdana',sans-serif; font-size:8pt; color:#000000;}" & vbcrlf
HTML = HTML & "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
HTML = HTML & "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
HTML = HTML & "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
HTML = HTML & "TR.dark{background-color:#EEEEEE}" & VbCrLf
HTML = HTML & "TR.aleft TH{text-align:left}" & vbcrlf
HTML = HTML & "</STYLE>" & vbcrlf
HTML = HTML & " <body>" & vbcrlf
HTML = HTML & " <H1>" & SDB.Localize("Recommended changes to capitalization:") & "</H1>" & vbcrlf
HTML = HTML & " <table border=""0"" cellspacing=""0"" cellpadding=""4"" width=""100%"">" & vbcrlf
HTML = HTML & " <tr class=""aleft"">" & vbcrlf
If ini.BoolValue("CaseModify","CbxDiscnr") Then HTML = HTML & " <th>" & SDB.Localize("Disc #") & "</th>" & vbcrlf
If ini.BoolValue("CaseModify","CbxTracknr") Then HTML = HTML & " <th>" & SDB.Localize("Track #") & "</th>" & vbcrlf
If ini.BoolValue("CaseModify","CbxArtist") Then HTML = HTML & " <th>" & SDB.Localize("Artist") & "</th>" & vbcrlf
If ini.BoolValue("CaseModify","CbxTitle") Then HTML = HTML & " <th>" & SDB.Localize("Title") & "</th>" & vbcrlf
If ini.BoolValue("CaseModify","CbxAlbum") Then HTML = HTML & " <th>" & SDB.Localize("Album") & "</th>" & vbcrlf
If ini.BoolValue("CaseModify","CbxAlbumArtist") Then HTML = HTML & " <th>" & SDB.Localize("Album Artist") & "</th>" & VbCrLf
If ini.BoolValue("CaseModify","CbxComposer") Then HTML = HTML & " <th>" & SDB.Localize("Composer") & "</th>" & VbCrLf
If ini.BoolValue("CaseModify","CbxConductor") Then HTML = HTML & " <th>" & SDB.Localize("Conductor") & "</th>" & VbCrLf
If ini.BoolValue("CaseModify","CbxLyricist") Then HTML = HTML & " <th>" & SDB.Localize("Lyricist") & "</th>" & VbCrLf
If ini.BoolValue("CaseModify","CbxFileName") Then HTML = HTML & " <th>" & SDB.Localize("Filename") & "</th>" & VbCrLf
HTML = HTML & " </tr>" & vbcrlf
Call CreateDropDownItems("LittleWords")
Call CreateDropDownItems("ForceCaseWords")
Dim i, itm, dispHTML, disp, SkipCount
Dim Discnr, Tracknr, artist, album, title, albumArtist, Composer, Conductor, Lyricist, FileName, RealFileName
SkipCount=0
InitBar 0,trackList.count-1
For i=0 to trackList.count-1
BarText "Case modify: Checking file "& i &" of "& trackList.count-1,i
disp = 0
dispHTML = " <tr" & Style() & ">" & vbcrlf
Set itm = trackList.Item(i)
If ini.BoolValue("CaseModify","CbxDiscnr") Then
Discnr = GetFixLeadZero("Discnr",itm.DiscNumberStr)
dispHTML = dispHTML & outField(Discnr, itm.DiscNumberStr)
If Discnr <> itm.DiscNumberStr Then disp = disp+1
If Discnr <> "" And Discnr <> itm.DiscNumberStr Then
holdDiscnr.add itm, Discnr
End If
End If
If ini.BoolValue("CaseModify","CbxTracknr") Then
Tracknr = GetFixLeadZero("Tracknr",itm.TrackOrderStr)
dispHTML = dispHTML & outField(Tracknr, itm.TrackOrderStr)
If Tracknr <> itm.TrackOrderStr Then disp = disp+1
If Tracknr <> "" And Tracknr <> itm.TrackOrderStr Then
holdTracknr.add itm, Tracknr
End If
End If
If ini.BoolValue("CaseModify","CbxArtist") Then
artist = GetFixCase("Artist",itm.artistName)
dispHTML = dispHTML & outField(artist, itm.artistName)
If artist <> itm.artistName Then disp = disp+1
If artist <> "" And artist <> itm.artistName Then
holdArtist.add itm, artist
End If
End If
If ini.BoolValue("CaseModify","CbxTitle") Then
title = GetFixCase("Title",itm.title)
dispHTML = dispHTML & outField(title, itm.title)
If title <> itm.title Then disp = disp+1
If title <> "" And title <> itm.title Then
holdTitle.add itm, title
End If
End If
If ini.BoolValue("CaseModify","CbxAlbum") Then
album = GetFixCase("Album",itm.albumName)
dispHTML = dispHTML & outField(album, itm.albumName)
If album <> itm.albumName Then disp = disp+1
If album <> "" And album <> itm.albumName Then
holdAlbum.add itm, album
End If
End If
If ini.BoolValue("CaseModify","CbxAlbumArtist") Then
albumArtist = GetFixCase("AlbumArtist",itm.albumArtistName)
dispHTML = dispHTML & outField(albumArtist, itm.albumArtistName)
If albumArtist <> itm.albumArtistName Then disp = disp+1
If albumArtist <> "" And albumArtist <> itm.albumArtistName Then
holdAlbumArtist.add itm, albumArtist
End If
End If
If ini.BoolValue("CaseModify","CbxComposer") Then
Composer = GetFixCase("Composer",itm.Author)
dispHTML = dispHTML & outField(Composer, itm.Author)
If Composer <> itm.Author Then disp = disp+1
If Composer <> "" And Composer <> itm.Author Then
holdComposer.add itm, Composer
End If
End If
If ini.BoolValue("CaseModify","CbxConductor") Then
Conductor = GetFixCase("Conductor",itm.Conductor)
dispHTML = dispHTML & outField(Conductor, itm.Conductor)
If Conductor <> itm.Conductor Then disp = disp+1
If Conductor <> "" And Conductor <> itm.Conductor Then
holdConductor.add itm, Conductor
End If
End If
If ini.BoolValue("CaseModify","CbxLyricist") Then
Lyricist = GetFixCase("Lyricist",itm.Lyricist)
dispHTML = dispHTML & outField(Lyricist, itm.Lyricist)
If Lyricist <> itm.Lyricist Then disp = disp+1
If Lyricist <> "" And Lyricist <> itm.Lyricist Then
holdLyricist.add itm, Lyricist
End If
End If
If ini.BoolValue ("CaseModify","CbxFileName") Then
RealFileName = Mid(itm.path,(InStrRev(itm.path,"")+1))
FileName = GetFixCase("FileName",(Mid(itm.path,InStrRev(itm.path,"")+1,InStrRev(itm.path,".")-InStrRev(itm.path,"")-1))) &_
GetFixCase("Extension",Mid(itm.path,InStrRev(itm.path,".")))
dispHTML = dispHTML & outField(FileName, RealFileName)
If FileName <> RealFileName Then disp = disp+1
If FileName <> "" And FileName <> RealFileName Then
holdFileName.add itm, FileName
End If
End If
dispHTML = dispHTML & " </tr>" & vbcrlf
If ini.BoolValue("CaseModify","CbxDispOnlyDiff") And disp=0 Then
dispHTML = ""
SkipCount=SkipCount+1
End If
HTML = HTML & dispHTML
SDB.ProcessMessages
Next
If SkipCount = trackList.count Then HTML = HTML & "<td>Nothing To Change</td>"
HTML = HTML & " </table>" & vbcrlf
HTML = HTML & " </body>" & vbcrlf
HTML = HTML & "</html>" & vbcrlf
WB.SetHTMLDocument( HTML)
SDB.Objects("holdDiscnr") = holdDiscnr
SDB.Objects("holdTracknr") = holdTracknr
SDB.Objects("holdArtist") = holdArtist
SDB.Objects("holdAlbumArtist") = holdAlbumArtist
SDB.Objects("holdAlbum") = holdAlbum
SDB.Objects("holdTitle") = holdTitle
SDB.Objects("holdComposer") = holdComposer
SDB.Objects("holdConductor") = holdConductor
SDB.Objects("holdLyricist") = holdLyricist
SDB.Objects("holdFileName") = holdFileName
Form.Common.Visible = True ' Only show the form, don't wait for user input
BtnCancel.common.enabled = True
BtnOk.common.enabled = True
killBar
End Sub