Na lange tijd toch maar weer eens met SAM gaan stoeien.
PAL script is voor mij nog Abra-cadabra.
Dacht ff simpel te beginnen met een scriptje voor de uurmelder, heb het een en ander van het forum bij elkaar geschraapt en iets van gemaakt.
Script werkt op zicht wel maar als ik bijv. SAM om 13:45 start dan speelt hij eerst alle tijdmeldingen t/m 13 uur, start dan de muziek en geeft vervolgens keurig netjes elk uur de correcte tijdmelding.
Wat kan ik er nog aan doen om te voorkomen dat hij bij het starten van SAM alle verstreken uren eerst afspeelt?
Code: Selecteer alles
PAL.Loop:=True;
// 01 uur `s nachts
while (Now >= T['00:59:15']) and (Now <= T['00:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['00:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\01.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 02 uur `s nachts
while (Now >= T['01:59:15']) and (Now <= T['01:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['01:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\02.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 03 uur `s nachts
while (Now >= T['02:59:15']) and (Now <= T['02:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['02:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\03.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 04 uur `s nachts
while (Now >= T['03:59:15']) and (Now <= T['03:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['03:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\04.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 05 uur `s nachts
while (Now >= T['04:59:15']) and (Now <= T['04:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['04:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\05.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 06 uur `s nachts
while (Now >= T['05:59:15']) and (Now <= T['00:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['05:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\06.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 07 uur `s ochtends
while (Now >= T['06:59:15']) and (Now <= T['06:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['06:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\07.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 08 uur `s ochtends
while (Now >= T['07:59:15']) and (Now <= T['07:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['07:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\08.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 09 uur `s ochtends
while (Now >= T['08:59:15']) and (Now <= T['08:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['08:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\09.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 10 uur `s ochtends
while (Now >= T['09:59:15']) and (Now <= T['09:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['09:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\10.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 11 uur `s ochtends
while (Now >= T['10:59:15']) and (Now <= T['10:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['10:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\11.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 12 uur `s middags
while (Now >= T['11:59:15']) and (Now <= T['11:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['11:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\12.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 13 uur `s middags
while (Now >= T['12:59:15']) and (Now <= T['12:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['12:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\13.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 14 uur `s middags
while (Now >= T['13:59:15']) and (Now <= T['13:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['13:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\14.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 15 uur `s middags
while (Now >= T['14:59:15']) and (Now <= T['14:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['14:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\15.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 16 uur `s middags
while (Now >= T['15:59:15']) and (Now <= T['15:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['15:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\16.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 17 uur `s middags
while (Now >= T['16:59:15']) and (Now <= T['16:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['16:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\17.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 18 uur `s avonds
while (Now >= T['17:59:15']) and (Now <= T['17:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['17:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\18.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 19 uur `s avonds
while (Now >= T['18:59:15']) and (Now <= T['18:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['18:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\19.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 20 uur `s avonds
while (Now >= T['19:59:15']) and (Now <= T['19:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['19:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\20.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 21 uur `s avonds
while (Now >= T['20:59:15']) and (Now <= T['20:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['20:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\21.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 22 uur `s avonds
while (Now >= T['21:59:15']) and (Now <= T['21:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['21:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\22.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 23 uur `s avonds
while (Now >= T['22:59:15']) and (Now <= T['22:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['22:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\23.mp3',ipTop);
ActivePlayer.FadeToNext;
end;
// 12 uur middernacht
while (Now >= T['23:59:15']) and (Now <= T['23:59:25']) do
PAL.UnLockExecution;
begin
PAL.WaitForTime(T['23:59:55']);
Queue.Clear;
Queue.AddFile('c:\tijd\24.mp3',ipTop);
ActivePlayer.FadeToNext;
end;