TitleCase.vbs
Got it. Still It Does not work but reports OLE error. I'll see what is wrong.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Its a beautiful script indeed..i have one question though...i have all the Artists in UPPER CASE...yes..no exceptions: McCartney is MCCARTNEY and the like...i edited the script so it wouldnt update the artist (i put a ' in where it makes artist=editedArtist
is it hard to modify the script so it turns the artist to uppercase? if it isnt, can someone please help me with that?
thank you...you guys rock!
is it hard to modify the script so it turns the artist to uppercase? if it isnt, can someone please help me with that?
thank you...you guys rock!
Here you go!judas wrote:i have been looking for the UPPER CASE script but havent been able to find it
...mmm..anyway...if someone can help me here i would really appreciate it.
thanks...
http://www.mediamonkey.com/forum/viewtopic.php?t=949
Ok, i thought that the option "Start all words in Upper-case" was what you were looking for. But I see now that it isnt.judas wrote:bex, thanx a lot for that man but..i had seen that...it capitalizes the first letter of a word...as in title case...i need to convert the entire artist name to uppercase..maybe its just changing a word in the script or something.
shouldnt be hard to implement though...
thanx,
Addition to otherwise excellent script
Greeting all,
I've seen numerous posts on requests for updating case in various fields.
I myself, because of the MP3 player I have in my car, like all information (title, artist, album title) in lowercase, 'cause I find this easier on the eyes. Plus it resolves all 'And', 'By' etc. matters.
But that's just personal.
Anyways, I've added to the above script two functions that either changes ALL information (the same as in the original script: title, artist, album title, album artist) in lowercase or in UPPERCASE. The original function to change only the first letters in Capitals is also kept.
Place the following code AT THE VERY END of the TitleCase.vbs script (these are two functions that will be added in the menu of MM)
Then, to make them visible in MM, edit the Scripts.ini file in "..\MediaMonkey\Scripts" by adding:
[TitleCaseL]
FileName=TitleCase.vbs
ProcName=TitleCaseLower
Order=19
DisplayName=Artist, Title, Album, Album Artist all lowercase
Description=Lowercase Artist, Title, Album, Album Artist
Language=VBScript
ScriptType=0
[TitleCaseU]
FileName=TitleCase.vbs
ProcName=TitleCaseUpper
Order=20
DisplayName=Artist, Title, Album, Album Artist all UPPERCASE
Description=UPPERCASE Artist, Title, Album, Album Artist
Language=VBScript
ScriptType=0
.. and save. Restart MM and enjoy.
No credits whatsoever, as all coding was originally done by Risser. The add-on was just to accomodate myself, but I thought maybe someone liked this function as well.
Regards,
Gerard - MrData
The Netherlands
I've seen numerous posts on requests for updating case in various fields.
I myself, because of the MP3 player I have in my car, like all information (title, artist, album title) in lowercase, 'cause I find this easier on the eyes. Plus it resolves all 'And', 'By' etc. matters.
But that's just personal.
Anyways, I've added to the above script two functions that either changes ALL information (the same as in the original script: title, artist, album title, album artist) in lowercase or in UPPERCASE. The original function to change only the first letters in Capitals is also kept.
Place the following code AT THE VERY END of the TitleCase.vbs script (these are two functions that will be added in the menu of MM)
Code: Select all
Sub TitleCaseLower()
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 = LCase(itm.artistName)
title = LCase(itm.title)
album = LCase(itm.albumName)
albumArtist = LCase(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
Sub TitleCaseUpper()
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)
artist = UCase(itm.artistName)
title = UCase(itm.title)
album = UCase(itm.albumName)
albumArtist = UCase(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
[TitleCaseL]
FileName=TitleCase.vbs
ProcName=TitleCaseLower
Order=19
DisplayName=Artist, Title, Album, Album Artist all lowercase
Description=Lowercase Artist, Title, Album, Album Artist
Language=VBScript
ScriptType=0
[TitleCaseU]
FileName=TitleCase.vbs
ProcName=TitleCaseUpper
Order=20
DisplayName=Artist, Title, Album, Album Artist all UPPERCASE
Description=UPPERCASE Artist, Title, Album, Album Artist
Language=VBScript
ScriptType=0
.. and save. Restart MM and enjoy.
No credits whatsoever, as all coding was originally done by Risser. The add-on was just to accomodate myself, but I thought maybe someone liked this function as well.
Regards,
Gerard - MrData
The Netherlands
Thanks a lot MrData....I first put all in uppercase and then change the title and album fields to titlecase...i will see how to modify all that to addapt it to my needs problem is that i have no idea of VB
at first i got some errors in the code due to it breaking in different lines...i now fixed it and its working perfectly.
here's the updated code: (hope copy and pasting now works!!)
at first i got some errors in the code due to it breaking in different lines...i now fixed it and its working perfectly.
here's the updated code: (hope copy and pasting now works!!)
Code: Select all
Sub TitleCaseLower()
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 = LCase(itm.artistName)
title = LCase(itm.title)
album = LCase(itm.albumName)
albumArtist = LCase(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
Sub TitleCaseUpper()
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)
artist = UCase(itm.artistName)
title = UCase(itm.title)
album = UCase(itm.albumName)
albumArtist = UCase(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
Now I Got What I Need
i just did this in the UPPERCASE script:
Originally it was:
and now i have:
so there it is...now i get ARTIST and ALBUM ARTIST in UPPERCASE and Album and Title in, well...Title Case
thanks a lot for that post MrData...i was needing this for so long.
i just did this in the UPPERCASE script:
Originally it was:
Code: Select all
Set itm = trackList.Item(i)
'artist = updateCase(itm.artistName)
'title = updateCase(itm.title)
'album = updateCase(itm.albumName)
'albumArtist = updateCase(itm.albumArtistName)
artist = UCase(itm.artistName)
title = UCase(itm.title)
album = UCase(itm.albumName)
albumArtist = UCase(itm.albumArtistName)
Code: Select all
Set itm = trackList.Item(i)
'artist = updateCase(itm.artistName)
title = updateCase(itm.title)
album = updateCase(itm.albumName)
'albumArtist = updateCase(itm.albumArtistName)
artist = UCase(itm.artistName)
'title = UCase(itm.title)
'album = UCase(itm.albumName)
albumArtist = UCase(itm.albumArtistName)
thanks a lot for that post MrData...i was needing this for so long.
this might be what you're looking for...puts those words last...check it out.
http://www.mediamonkey.com/forum/viewtopic.php?t=1478
http://www.mediamonkey.com/forum/viewtopic.php?t=1478
requesting some help
Nice job Risser! I dig your script.
I'm just wondering if there is a way to add a checkbox to the accept or cancel modifications page, so that one could optionally select files to modify?
Thanks.
I'm just wondering if there is a way to add a checkbox to the accept or cancel modifications page, so that one could optionally select files to modify?
Thanks.