I'm now trying to add a "Sort Playlist: Randomize by Sets" function to my script, but I can't get InsertPlaylistItems() to work.
The function gets the content of the current playlist in a IFbMetadbHandleList, then reorder that list by sets, empties the current playlist, and use InsertPlaylistItems() to replace the items of the IFbMetadbHandleList in the playlist. The first part works as expected, but when I use InsertPlaylistItems(), I have always a type mismatch error.
What are exactly the types of the arguments of InsertPlaylistItems(playlistIndex, base, handles, select = false) ?
I assume this:
UINT playlistIndex
UINT base
IFbMetadbHandleList handles
bool select
The comment about InsertPlaylistItems() in the doc says "Inserts new items into specified playlist, at specified position.", so I assume that base is the "specified position".
You can check the problem with this simplified code, that should duplicate all elements of the active playlist, but crashes:
var pl = plman.ActivePlaylist;
var all_handles = plman.GetPlaylistItems(pl);
plman.InsertPlaylistItems(pl, 0, all_handles);
Error message:
[13:51:37] Error: WSH Panel Mod ({8B5414E5-92F3-4BE8-BBB3-A7CF680847A7}): Microsoft JScript runtime error:
Type mismatch
Ln: 3, Col: 1
<source text only available at compile time>
What am I doing wrong?