Torben
May 20, 2008, 8:52pm
41
There’s a Pascal Script plugin named “uPSR_dateutils”, provinding the following functions (excerpt from the PS source code):
S.RegisterDelphiFunction(@EncodeDate, 'ENCODEDATE', cdRegister);
S.RegisterDelphiFunction(@EncodeTime, 'ENCODETIME', cdRegister);
S.RegisterDelphiFunction(@TryEncodeDate, 'TRYENCODEDATE', cdRegister);
S.RegisterDelphiFunction(@TryEncodeTime, 'TRYENCODETIME', cdRegister);
S.RegisterDelphiFunction(@DecodeDate, 'DECODEDATE', cdRegister);
S.RegisterDelphiFunction(@DecodeTime, 'DECODETIME', cdRegister);
S.RegisterDelphiFunction(@DayOfWeek, 'DAYOFWEEK', cdRegister);
S.RegisterDelphiFunction(@Date, 'DATE', cdRegister);
S.RegisterDelphiFunction(@Time, 'TIME', cdRegister);
S.RegisterDelphiFunction(@Now, 'NOW', cdRegister);
S.RegisterDelphiFunction(@DateTimeToUnix, 'DATETIMETOUNIX', cdRegister);
S.RegisterDelphiFunction(@UnixToDateTime, 'UNIXTODATETIME', cdRegister);
S.RegisterDelphiFunction(@DateToStr, 'DATETOSTR', cdRegister);
S.RegisterDelphiFunction(@FormatDateTime, 'FORMATDATETIME', cdRegister);
S.RegisterDelphiFunction(@StrToDate, 'STRTODATE', cdRegister);
Would that be ok?
Torben
May 20, 2008, 8:56pm
42
Hm, looks like this plugin is already activated. So the functions mentioned in the post above should work.
Let’s see what I can do about the other functions you mentioned.
[quote=“Cad, post:40, topic:4993”]I hope that both Vincent and Tony approve of the ‘new! improved!’ v2.2.
Enjoy!
BFN
CAD[/quote]
Hello Cad, this is very impressive!
After changing some paths/filenames and putting the mp3’s in the right directory it all works great and I couldn’t find any ‘non working’ issues Thanks for the changes and your work!
This script makes it all a lot easier!
I’m looking forward to other improvements (if any)!
Regards,
Vincent.
Cad
May 23, 2008, 3:05pm
44
Sorry, Herr Doktor, but no they don’t. My test harness script for the functions I’d like to see is:
var
i: integer;
s: string;
dt: TDateTime;
wYear, wMonth, wDay, wHour, wMin, wSec, wMilli : Word;
begin
// DECODEDATETIME
DecodeDateTime(Now, wYear, wMonth, wDay, wHour, wMin, wSec, wMilli);
Systemlog('Year = '+IntToStr(wYear));
Systemlog('Month = '+IntToStr(wMonth));
Systemlog('Day = '+IntToStr(wDay));
Systemlog('Hour = '+IntToStr(wHour));
Systemlog('Minute = '+IntToStr(wMin));
Systemlog('Second = '+IntToStr(wSec));
Systemlog('MilliSec = '+IntToStr(wMilli));
// ENCODEDATETIME
dt := EncodeDateTime(2008, 5, 20, 12, 34, 56, 789);
Systemlog('Encoded date/time is '
+ FormatDateTime('yyyy-mm-dd hh:nn:ss.nn', dt));
// INCDAY, INCMINUTE, ...
dt := Now;
dt := IncDay(dt);
dt := IncMinute(dt);
dt := IncMonth(dt);
dt := IncSecond(dt);
dt := IncYear(dt);
SystemLog(FormatDateTime('yyyy-mm-dd hh:nn:ss', dt));
// INPUTBOX
repeat
s := InputBox('Hello!', 'Type whatever you like below:', 'nonsense');
until s <> '';
SystemLog('You typed >' + s + '<.');
// ISLEAPYEAR
if IsLeapYear(2000) then
SystemLog('2000 is a leap year.');
// MESSAGEDLG
i := MessageDlg(
'Which will you press? YES or NO?',
mtQuestion,
[mbYes, mbNo],
0);
if i = mrYes then
SystemLog('You pressed YES.')
else
SystemLog('You pressed NO.');
// STRTODATETIME
dt := StrToDateTime('23/05/2008 12:13:14');
SystemLog(FormatDateTime(dt));
end.
Cad
May 23, 2008, 3:08pm
45
[quote=“Vincent Volmer, post:43, topic:4993”]Hello Cad, this is very impressive!
Thanks for the changes and your work!
This script makes it all a lot easier!
I’m looking forward to other improvements (if any)![/quote]
I’m already adapting this script to ‘inject’ ad breaks at (‘soft’ fixed) times during the hour. Ideally, this would require GetStartTime to be working properly, which it seems not to be at the moment.
BFN
CAD
Hi Tony,
I was reading on this topic that you tried to pick a random file inside a folder.
Did you manage to do that ?
Thanks,
Alexis.
Hi Alex, sorry not as yet.
Resorted to either Station Playlist Creator or Amazing Clockwheel to generate playlists (or better depending on the stations budget).
Kind regards Tony
Thanks,
I’ll give a shot by trying to script it tomorrow.
Cheers,
Alexis.