Article View: news.software.readers
Article #155227Re: 40tude Dialog Beta 36 - script problem
From: Jo'Asia
Date: Sun, 05 Sep 2004 19:16
Date: Sun, 05 Sep 2004 19:16
132 lines
5164 bytes
5164 bytes
Marcus Mรถnnig wrote:
> * You will need to recompile all your scripts.
>
> * There were some scripts in Wiki and in the
> groups that used "NULL" incorrectly. While
> previous versions of Dialog tolerated this, the
> new version does not. The scripts will compile,
> but raise an error when executed. In the scripts
> where NULL is used, it usually needs to be replaced
> with either 0 or an empty string ''. Please visit
> http://www.40tude.com/dialog/wiki/index.php?title=ScriptUpdateNotesToBeta36
> for further scripting update notes.
Something is wrong with my script under Beta36 - doesn't seem to work.
It compiles with no errors, gives no error messages but does nothing at
all... It's supposed to:
a) load a signature from file chosen by a signal string placed there (it's
to prevent Dialog from wrapping the signature lines)
b) add a counter to message headers.
Here it goes:
program OnBeforeSendingMessage;
function OnBeforeSendingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean):boolean;
var i:integer;
s, xcounter, file1, file2: string;
sl:TStringlist;
begin
result:=true;
if (message.count<3000) then begin
s:=message.text;
i:=pos('signature-1',s);
if i>0 then begin
delete(s,i,length('signature-1'));
sl:=Tstringlist.create;
try
sl.loadfromfile('file1.txt');
insert(sl.text,s,i);
finally
sl.free;
end;
end
else begin
i:=pos('signature-2',s);
if i>0 then begin
delete(s,i,length('signature-2'));
sl:=Tstringlist.create;
try
sl.loadfromfile('file2.txt');
insert(sl.text,s,i);
finally
sl.free;
end;
end
else begin
i:=pos('signature-3',s);
if i>0 then begin
delete(s,i,length('signature-3'));
sl:=Tstringlist.create;
try
sl.loadfromfile('file3.txt');
insert(sl.text,s,i);
finally
sl.free;
end;
end;
end;
end;
message.text:=s;
end;
file1:='patch';
file2:='global-counter.txt';
xcounter:='X-Count: ';
//do not count emails
if IsEmail then exit;
//what group?
for i:=0 to Message.count-1 do
if pos('Newsgroups: ',Message.strings[i]) > 0 then
break;
if i=Message.count-1 then exit;
file1:=file1 + Copy(Message.strings[i],length('Newsgroups:')+1,length(Message.strings[i])) + '.txt';
sl := TStringList.Create;
try
if FileExists(file1) then
sl.LoadFromFile(file1)
else
sl.text:='0';
sl.strings[0] := IntToStr (StrToInt(sl.strings[0]) + 1);
xcounter:=xcounter + sl.strings[0];
sl.SaveToFile(file1);
if FileExists(file2) then
sl.LoadFromFile(file2)
else
sl.text:='0';
sl.strings[0] := IntToStr (StrToInt(sl.strings[0]) + 1);
xcounter:=xcounter + '/' + sl.strings[0];
sl.SaveToFile(file2);
for i:=0 to Message.count-1 do
if Message.strings[i] = '' then
begin
Message.Insert(i,xlicznik);
break;
end;
finally
sl.free;
end;
end;
begin
end.
Jo'Asia
--
signature out of order :(
Technical Details
Message-ID:
<14pjpd404uy16$.dlg@dustpuppy.sloth.hell.pl>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!t-online.de!news.task.gda.pl!newsfeed.pionier.net.pl!news.nask.pl!news.cyf-kr.edu.pl!agh.edu.pl!news.agh.edu.pl!dustpuppy.sloth.hell.pl!not-for-mailReferences:
<13jszx3om13qk.xfuvmn9gv3fd$.dlg@40tude.net>Show Full Headers
Complete Article Headers
Message-ID: <14pjpd404uy16$.dlg@dustpuppy.sloth.hell.pl>
Subject: Re: 40tude Dialog Beta 36 - script problem
Date: Sun, 5 Sep 2004 21:16:08 +0200
From: Jo'Asia <joasia@hel.pl>
References: <13jszx3om13qk.xfuvmn9gv3fd$.dlg@40tude.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!t-online.de!news.task.gda.pl!newsfeed.pionier.net.pl!news.nask.pl!news.cyf-kr.edu.pl!agh.edu.pl!news.agh.edu.pl!dustpuppy.sloth.hell.pl!not-for-mail
Newsgroups: news.software.readers
Organization: KF Rassun - SF Framling
Lines: 132
NNTP-Posting-Host: chello062179072161.chello.pl
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: galaxy.uci.agh.edu.pl 1094411807 12345 62.179.72.161 (5 Sep 2004
X-Complaints-To: usenet@uci.agh.edu.pl
NNTP-Posting-Date: Sun, 5 Sep 2004 19:16:47 +0000 (UTC)
X-Face: e<j{nB#syJ9{:i>28Jn%^Mv>1D`^*<V2; Gb0G;
CQH>0ah'%4l!JjUC[oja$%Y.%~E5RM.*- `d6V|l>mR]@On_"; '6R&eHG]1(JP:'^;
~Is|>|h7FQks}f=2-/)/+XGFO#2; 4hi[m:PcuC-=r@M08( V~[p|-8:~p7wRE`hB.i(%!M;
eX,ccgf_r_z%%)V'Ws
User-Agent: 40tude_Dialog/2.0.13.1 (a9dbf334.371.352) Hamster/2.0.1.3