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.
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
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.
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.
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 [b]last[/b] track in SelectedSongList receives the artwork. Artwork in all tracks before the last track remain unchanged.
[code]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]
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 [b]first[/b] track receives the new artwork and all subsequent tracks are unchanged.
[code]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
[/code]
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.