by shoney » Sat Nov 17, 2007 11:15 am
I would like to add the comment field to Custom 1, but am having trouble getting it to work. I don't know much about writing and understanding scripts, so any help is appreciated. I looked at the ExtractFields code and I don't know how that will get the Comment field assigned to Custom 1. I tried modifying a script I found on this board to work with Comment, but when I run it, an error pops up saying that the program does not recognize the function File.Comment. Here is the script. Can someone tell me what I should put in place of File.Comment?
Sub SelectedFileComment
Dim mySongList : Set mySongList = SDB.CurrentSongList
If mySongList.Count = 0 Then
SDB.MessageBox "Nothing selected!", mtError, Array(mbOK)
Exit Sub
End If
Dim i, mySong
For i = 0 To mySongList.Count - 1
Set mySong = mySongList.Item(i)
mySong.Custom3 = GetFileComment(mySong.Path)
mySong.UpdateDB
Next
End Sub
Function GetFileComment(FilePath)
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
Dim File : Set File = FSO.GetFile(FilePath)
GetFileComment = File.Comment
End Function
I would like to add the comment field to Custom 1, but am having trouble getting it to work. I don't know much about writing and understanding scripts, so any help is appreciated. I looked at the ExtractFields code and I don't know how that will get the Comment field assigned to Custom 1. I tried modifying a script I found on this board to work with Comment, but when I run it, an error pops up saying that the program does not recognize the function File.Comment. Here is the script. Can someone tell me what I should put in place of File.Comment?
Sub SelectedFileComment
Dim mySongList : Set mySongList = SDB.CurrentSongList
If mySongList.Count = 0 Then
SDB.MessageBox "Nothing selected!", mtError, Array(mbOK)
Exit Sub
End If
Dim i, mySong
For i = 0 To mySongList.Count - 1
Set mySong = mySongList.Item(i)
mySong.Custom3 = GetFileComment(mySong.Path)
mySong.UpdateDB
Next
End Sub
Function GetFileComment(FilePath)
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
Dim File : Set File = FSO.GetFile(FilePath)
GetFileComment = File.Comment
End Function