I looked at the script and figured out the problem. WMP marks the album art with the Hidden AND System attributes.
Your script only clears the Hidden attribute. That is why it can't overwrite the file.
I've modified the script to first clear all attributes (saving the current attributes to a variable), then after writing out the image, I restore the original attributes.
Here's the sections I changed:
In getalbumart()
Code: Select all
Else
loc = "#ff0000" 'red
If Overwrite = 1 Then
chk = True
Artwork.Item(gettrackart) = "done"
If boo Then
Dim oldAttributes
oldAttributes = SetNormal(gettrackart)
Set out = SDB.Tools.FileSystem.CreateTextFile(gettrackart,True)
If Not (out Is Nothing) Then
Call out.WriteData(jpg.ImageData,jpg.ImageDataLen)
out.Close
Call RestoreAttributes(gettrackart, oldAttributes)
Else
MsgBox "Error: File '"&gettrackart&"' could not be created."
End If
End If
End If
End If
Changed and added these functions
Code: Select all
Function SetNormal(pFilePath)
Dim f : Set f = fso.GetFile(pFilePath)
SetNormal = f.Attributes ' Return original attributes
f.Attributes = 0
End Function
Function RestoreAttributes(pFilePath, pAttributes)
Dim f : Set f = fso.GetFile(pFilePath)
f.Attributes = pAttributes
RestoreAttributes = True
End Function
I looked at the script and figured out the problem. WMP marks the album art with the Hidden AND System attributes.
Your script only clears the Hidden attribute. That is why it can't overwrite the file.
I've modified the script to first clear all attributes (saving the current attributes to a variable), then after writing out the image, I restore the original attributes.
Here's the sections I changed:
In getalbumart()
[code]
Else
loc = "#ff0000" 'red
If Overwrite = 1 Then
chk = True
Artwork.Item(gettrackart) = "done"
If boo Then
Dim oldAttributes
oldAttributes = SetNormal(gettrackart)
Set out = SDB.Tools.FileSystem.CreateTextFile(gettrackart,True)
If Not (out Is Nothing) Then
Call out.WriteData(jpg.ImageData,jpg.ImageDataLen)
out.Close
Call RestoreAttributes(gettrackart, oldAttributes)
Else
MsgBox "Error: File '"&gettrackart&"' could not be created."
End If
End If
End If
End If
[/code]
Changed and added these functions
[code]
Function SetNormal(pFilePath)
Dim f : Set f = fso.GetFile(pFilePath)
SetNormal = f.Attributes ' Return original attributes
f.Attributes = 0
End Function
Function RestoreAttributes(pFilePath, pAttributes)
Dim f : Set f = fso.GetFile(pFilePath)
f.Attributes = pAttributes
RestoreAttributes = True
End Function
[/code]