Put Playlists Into The Queue.PAL

PAL script for putting Music 1 SE playlists into the que at 23:55 (11:55PM)
based on the naming scheme of Music 1

You will need to change the constants to meet your needs.
The load time can be changed as well as clearing que or waiting for 1 song play clear queue and add.
This is a basic script - a starting place to extend to meet your own needs.

PAL.Loop := True;
//make sure to change the Playlistpath variable to point to where the playlist files are located
const PlaylistPath = 'c:\music 1 se\SAM Playlists\'; // location your Music 1 playlists are saved
const Fileextension = '.m3u'  ; // the playlist extension

var Present: DateTime;
var Year, Month, Day, Hour, Min, Sec, MSec,DayLength,MonthLength : Integer;
var HoldYear,TheYear,TheMonth, TheDay,Playlist :String;
var LessThan : Boolean;

  Present:= Now + 1;  // since we are loading a few minutes before the next day we want the next days list
  DecodeDate(Present, Year, Month, Day);
  HoldYear :=  IntToStr(Year);
  TheYear := Copy(HoldYear,3,2); // copy the last 2 digits of the year 2007 would copy the 07
  TheMonth :=  IntToStr(Month);
  TheDay := IntToStr(Day);
  MonthLength := length(TheMonth) ;
  DayLength := length(TheDay);
  LessThan := MonthLength < 2;
  If (LessThan)  Then
    TheMonth := '0'+ TheMonth; // if a single digit add 0 to front

  LessThan := DayLength < 2;
  If (LessThan)  Then
     TheDay := '0'+ TheDay; // if a single digit add 0 to front

Playlist := PlayListPath + TheYear+TheMonth+TheDay+Fileextension;
writeln ('Waiting to load playlist:');
writeln (Playlist);

PAL.WaitforTime(T['23:55:00']);  // wait for 11:55pm
   Queue.AddList(Playlist,ipBottom); // add playlist to bottom of the queue
   WriteLn('Loaded: '+Playlist);

PAL.WaitforTime(T['23:59:59']); // wait for midnight before restarting process
if ActivePlayer <> nil then ActivePlayer.FadeToNext;