SDBAlbumArtList.AddNew only adds one artwork per script run
Posted: Tue Dec 27, 2016 11:29 am
I'm trying to write a script which adds artwork to multiple tracks but I have found that only one artwork can be added per script call.
The following code runs successfully on multiple tracks but only the last track in SelectedSongList receives the artwork. Artwork in all tracks before the last track remain unchanged.
If I move the location of the instruction to update the database into the For loop then the result is slightly different. In the following code the first track receives the new artwork and all subsequent tracks are unchanged.
This is a very simplified version of the code. In the full code every track should receive a unique artwork instead of all receiving the same file, but the result is the same. Is there something that I'm doing wrong?
MMW 1821 running on Windows 10.
The following code runs successfully on multiple tracks but only the last track in SelectedSongList receives the artwork. Artwork in all tracks before the last track remain unchanged.
Code: Select all
Set tracklist = SDB.SelectedSongList
For i = 0 To tracklist.Count - 1
Set NewArt = tracklist.Item(i).AlbumArt.AddNew
NewArt.ItemStorage = 1
NewArt.PicturePath = "C:\testart.jpg"
Next 'i
tracklist.UpdateAll
Code: Select all
Set tracklist = SDB.SelectedSongList
For i = 0 To tracklist.Count - 1
Set NewArt = tracklist.Item(i).AlbumArt.AddNew
NewArt.ItemStorage = 1
NewArt.PicturePath = "C:\testart.jpg"
tracklist.Item(i).UpdateDB
Next 'i
This is a very simplified version of the code. In the full code every track should receive a unique artwork instead of all receiving the same file, but the result is the same. Is there something that I'm doing wrong?
MMW 1821 running on Windows 10.