[quote=“tony wilding, post:2, topic:5075”]You were almost right though.
This code works for me.[/quote]
Yes. To create any object, like a new Playlist or PlaylistItem, note that you now have to use Factory.Create … and not the older versions (Create …).
If you want to place your Playlist somewhere specific in the current Playlist, you use InsertPlaylist instead, like so:
begin
// Sample: Inserts an M3U Playlist into current Playlist, after the current top (first) item
// (first item Index = 0, => second item Index = 1).
CurrentPlaylist.InsertPlaylist(1, Factory.CreatePlaylistFromFile('C:\playlists\'
+ FormatDateTime('ddmmyy-hh', now + 0.04166)
+ '.m3u'));
end.
The number in InsertPlaylist means ‘insert the new Playlist before this Item number;’ and PlaylistItems, like Playlists and Cartwall Players, are internally numbered starting from zero (not from one!).
The reason for formatting even a one-liner script as shown above is that it’s much easier to read and edit later.