PAL Script - Randomly populate the Queue with tracks from a Specified Category

This PAL script starts by ensuring there is at least 1 track in the queue and if not, it adds a track from the Music (All) category but you can change this to whatever category you use to store your required tracks.

The first time it runs, if the queue was empty then the queue will have one track added and then the second part of the script will add random tracks from the same category until there are 3 tracks in the queue. When the queue contains only 1 track, additional tracks are added to ensure there are 3 tracks. You can adjust this limit if you want.

//Adds Random Tracks from a Specified Directory to the Queue

PAL.loop := True; //Loop the Script

//Checks for an empty queue and adds 1 track to start with
If Queue.Count < 1 then
Cat['Music (All)'].QueueBottom(smRandom, NoRules);

PAL.WaitForQueue(1); //Wait until there is only 1 track in the Queue

//When there is only 1 track in the Queue, keep 3 random tracks queued
//from a specified directory
while Queue.Count < 3 do
Cat['Music (All)'].QueueBottom(smRandom, NoRules);


Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request