by AlanB » Fri Nov 14, 2003 3:19 am
Well I dug out my script, but I see that jiri has beaten me to it. I have to say I like the idea of keeping certain words in lower case. Mine was a much simple approach, i.e. anything at the start or following space, comma or ( was uppercase, the rest lower...
Function CapCase(in_string)
Dim index
Dim shift_next
Dim char
Dim out_string
shift_next = True
For index = 1 To Len(in_string)
char = Mid(in_string, index, 1)
If shift_next Then
char = UCase(char)
else
char = LCase(char)
End If
shift_next = (char = " ") Or (char = "(") Or (char = ",")
out_string = out_string + char
Next
CapCase = out_string
End Function
Sub CapCaseTitle
' Define variables
Dim list, itm, i, tmp, tmp1
' Get list of selected tracks from MediaMonkey
Set list = SDB.SelectedSongList
If list.count=0 Then
Set list = SDB.AllVisibleSongList
End If
' Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)
tmp = itm.Title
tmp1 = CapCase(tmp)
if tmp <> tmp1 then
itm.Title = tmp1
itm.UpdateDb
end if
Next
End Sub
With a script.ini insert like
[CapCaseTitle]
FileName=MyScripts.vbs
ProcName=CapCaseTitle
Order=2
DisplayName=CapCase &Title
Description=CapCase Title field
Language=VBScript
ScriptType=0
Obviously it is straght forward to modify for fields other than Title, or to do several fields at a time.
Alan
Well I dug out my script, but I see that jiri has beaten me to it. I have to say I like the idea of keeping certain words in lower case. Mine was a much simple approach, i.e. anything at the start or following space, comma or ( was uppercase, the rest lower...
Function CapCase(in_string)
Dim index
Dim shift_next
Dim char
Dim out_string
shift_next = True
For index = 1 To Len(in_string)
char = Mid(in_string, index, 1)
If shift_next Then
char = UCase(char)
else
char = LCase(char)
End If
shift_next = (char = " ") Or (char = "(") Or (char = ",")
out_string = out_string + char
Next
CapCase = out_string
End Function
Sub CapCaseTitle
' Define variables
Dim list, itm, i, tmp, tmp1
' Get list of selected tracks from MediaMonkey
Set list = SDB.SelectedSongList
If list.count=0 Then
Set list = SDB.AllVisibleSongList
End If
' Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)
tmp = itm.Title
tmp1 = CapCase(tmp)
if tmp <> tmp1 then
itm.Title = tmp1
itm.UpdateDb
end if
Next
End Sub
With a script.ini insert like
[CapCaseTitle]
FileName=MyScripts.vbs
ProcName=CapCaseTitle
Order=2
DisplayName=CapCase &Title
Description=CapCase Title field
Language=VBScript
ScriptType=0
Obviously it is straght forward to modify for fields other than Title, or to do several fields at a time.
Alan