ScriptDateTimeInsert

From 40tude Dialog Wiki

This little script will add an actual timestamp to your article. It will scan the last 4 lines of the article for %datetime% and replace it with the actual date & time (for example "23.09.2004 23:26:09"). If you like, you can create an signature containing %datetime%, so the script will add the actual date\time automaticly.

program OnBeforeSendingMessage;

function OnBeforeSendingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean):boolean;
var s:string;
    i,j:integer;
begin
result:=true;
//check the last 4 lines for %datetime% and replace it with the current date time
for i:=message.count-4 to message.count-1 do
   begin
   if (i<0) then continue;
   s:=message.strings[i];
   j:=pos('%datetime%',s);
   if j>0 then
   	begin
	delete(s,j,length('%datetime%'));
	insert(datetimetostr(now),s,j);
   	message.strings[i]:=s;
   	break;
   	end;
   end;
end;

begin
end.