Code:
if (hh = 0) then hh := 12;
if (hh > 12) then hh := (hh-12);
This can be shortened using the modulo operator if you want:
Code:
hh := hh mod 12;
But overall there's 200 lines or so that are completely unused in the first script except for printing on the console of the PAL Editor:
Code:
DecodeTime(Now,hh,mm,ss,ms);
if (hh = 0) then hh := 12;
if (hh > 12) then hh := (hh-12);
if (mm <= 9) then
WriteLn('The Time Is '+IntToStr(hh)+':'+'0'+IntToStr(mm));
if (mm >= 10) then
WriteLn('The Time Is '+IntToStr(hh)+':'+IntToStr(mm));
var E : DateTime = Queue.ETA;
DecodeTime(E,hh,mm,ss,ms);
if (hh = 0) then hh := 12;
if (hh > 12) then hh := (hh-12);
if (hh >0) then
fnamehh := IntToStr(hh)+'.mp3'; //get the right file name
WriteLn(fnamehh);
if (mm <= 9) then
fnamemm := '0'+IntToStr(mm)+'.mp3' //get the right file name
else
fnamemm := IntToStr(mm)+'.mp3'; //get the right file name
WriteLn(fnamemm);
if (mm <= 9) then
WriteLn('Will SayTime at '+IntToStr(hh)+':'+'0'+IntToStr(mm));
if (mm >= 10) then
WriteLn('Will SayTime at '+IntToStr(hh)+':'+IntToStr(mm));
// Just checking
This is the last time that either mm, hh or fnamemm or fnamehh are used. After that you only use the Queue.ETA formatted Date string.
Why do you add semicolons to the beginning of the lines following the statement that should be terminated by semicolon?
And what use does the 00 wait have? ( PAL.WaitForTime(T['+00:00:00']); )
In the second script you never reassign Player2 and Player3, they're just alias names for Aux1 and Aux2, so you could leave those variables away and just use Aux1 and Aux2 respectively. You only need a variable to store the ActivePlayer as that could be either DeckA or DeckB at any given time.
This snippet will never go in the first branch of your if as you never set countQueue to any value:
Code:
if (countQueue > 0) then
begin
end
else
begin
Queue.AddFile(fileMin, ipTop);
Queue.AddFile(fileHour, ipTop);
end
That means you can simplify it and leave the if out and just add the two files to the queue.
Last but not least: Your i variable is completely useless as you never change the volume. You record what volume the Active Deck is set to, keep it at that volume and never change the volume and then reset it to the number it has been on all the time.
The good part: I didn't know about the FormatDate function. That's a clever way to get around the 12/24 and leading zero mess. Congratulations on finding that.