Can't get hourly playlists to load, using script


I’m trying to use this script to load my playlists each hour

CurrentPlaylist.Append(‘C:\Playlists’ + FormatDateTime(‘ddmmyy-hh’, now + 0.04166) + ‘.m3u’);

However when I try to run it, I just get this error at the bottom of the screen:

“Unknown Identifier APPEND”

Any ideas?

Hi Libra28, I tried exactly the same without success.

You were almost right though.

This code works for me.

// Append Playlist
//Tony Wilding
CurrentPlayList.Appendplaylist(Factory.CreatePlayListFromFile(‘C:\playlists’ + FormatDateTime(‘ddd hh’,now + 0.04166) + ‘.m3u’));


Hth Tony

[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. :wink:


Cheers guys, that got it working! :smiley: