Thread View: news.software.readers
20 messages
20 total messages
Started by Alain GUERIN
Wed, 02 Jul 2003 19:40
[Dialog] Customising Posts
Author: Alain GUERIN
Date: Wed, 02 Jul 2003 19:40
Date: Wed, 02 Jul 2003 19:40
180 lines
7062 bytes
7062 bytes
Hello,
In a precedent discussion I told how I tried to modified the editing window
with postkey, in order to have the hello message in the language of the
news group.
I failed as there was no way to open by program the newsgroup
list and detect the newsgroup.
>From the script made by matija and the advises from Juergen Haible, I try
by another way and now I have it.
This new script is working for new posts and for following posts.
It add a line at the beginning of the post depending on the newsgroup.
I sent a first buggy version in a post (now canceled) without Dialog in the
subject. (That will be the next modification: add the Dialog tag when
sending a new post in the newsmanager groups).
So this version seems to work better and has one more feature : adaptation
to the day time.
The bug was caused by the way I calculated the place to insert the prompt in
the first line of the message, after all the headers. There are cases, when
acute letters are in the subject for example, where one header can be in two
strings of the message.strings list. As I was testing the ":" to find the
first line after the header, in that case, it was wrong.
I now search for the agent name that seems to be the last header before
sending the message in a newsgroup. But it is not an absolute secure way.
;-/
program OnBeforeSendingMessage;
type
TLanguage = (LFrench, LEnglish, LGerman);
TDayTime = (DTMorning, DTDay, DTAfternoon, DTEvening, DTNight);
function FindLanguage(VAR List : TStringList; LanguageFileName: string;
NewsHeader : string): boolean;
begin
list.LoadFromFile(LanguageFileName);
Result := list.indexof(NewsHeader) > -1
(* where each line is a newsgroup in the language tested:
Newsgroups: news.software.readers
Newsgroups: carlokok.public.pascalscript
This function could be modify to avoy to have 'Newsgroups: ' in each line of
the text file by deleting it from Newsheader *)
end;
function SelectLanguage(NewsHeader : String):TLanguage;
var
list: TStringList;
begin
Result := LFrench;
list := TStringList.Create();
IF FindLanguage(List,'C:\Mes documents\English groups.txt',NewsHeader)
THEN
Result := LEnglish
ELSE
IF FindLanguage(List,'C:\Mes documents\German groups.txt',NewsHeader)
THEN
Result := LGerman;
list.free;
(* or in code option:
IF (POS('news.software.readers', NewsHeader) > 0)
OR (POS('carlokok.public.pascalscript', NewsHeader) > 0) THEN
Result := LEnglish;
but it is case sensitive in this way ;-)
*)
end;
function SelectTime(NewsHeader : String): TDayTime;
VAR
hour : BYTE;
begin
delete(NewsHeader,1,pos(':',NewsHeader));
delete(NewsHeader,1,pos(':',NewsHeader)-3);
delete(NewsHeader,pos(':',NewsHeader),Length(NewsHeader)-2);
hour := strtoint(NewsHeader);
case hour of
5: result := DTMorning;
6: result := DTMorning;
7: result := DTMorning;
8: result := DTDay;
9: result := DTDay;
10: result := DTDay;
11: result := DTDay;
12: result := DTDay;
13: result := DTDay;
14: result := DTAfternoon;
15: result := DTAfternoon;
16: result := DTAfternoon;
17: result := DTAfternoon;
18: result := DTEvening;
19: result := DTEvening;
20: result := DTEvening;
21: result := DTEvening;
22: result := DTEvening;
else
result := DTNight
end;
end;
function OnBeforeSendingMessage(var Message: TStringlist; Servername:
string; IsEmail: boolean):boolean;
var
HeaderCount : INTEGER;
InsertionPlace : INTEGER;
InsertionContent : String;
Language : TLanguage;
TimePeriod : TDayTime;
begin
//Your code goes here
//Return false to prevent sending the passed message
IF NOT IsEMail THEN
BEGIN
HeaderCount := 0;
WHILE (HeaderCount < Message.count) AND (pos('Newsgroups:',
Message.Strings[HeaderCount]) <> 1) DO
HeaderCount:=HeaderCount+1;
IF HeaderCount < Message.count THEN
BEGIN
Language := SelectLanguage(Message.Strings[HeaderCount]);
HeaderCount := 0;
TimePeriod := DTDay;
WHILE (HeaderCount < Message.count) AND (pos('User-Agent:
40tude_Dialog', Message.Strings[HeaderCount]) <> 1) DO
BEGIN
IF pos('Date:', Message.Strings[HeaderCount]) = 1 THEN
TimePeriod := SelectTime(Message.Strings[HeaderCount]);
HeaderCount:=HeaderCount+1;
END;
IF HeaderCount < Message.count THEN
InsertionPlace:=HeaderCount + 2;
InsertionContent :='';
case Language of
LFrench :
case TimePeriod of
DTMorning :
InsertionContent :='Bon Matin,';
DTDay :
InsertionContent :='Bonjour,';
DTAfternoon :
InsertionContent :='Bon(ne) après-midi,';
DTEvening :
InsertionContent :='Bonsoir,';
DTNight :
InsertionContent :='Bonne nuit,';
end;
LEnglish:
InsertionContent :='Hello,';
LGerman:
InsertionContent :='Guten Tag,';
end;
IF (InsertionPlace > 0) AND (InsertionPlace < Message.Count) AND
(InsertionContent <>'') THEN
message.insert (InsertionPlace, InsertionContent);
END;
result:=true;
end;
begin
end.
It is always a beta version so your tests and critics are welcome.
--
A.G.
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Wed, 02 Jul 2003 19:50
Date: Wed, 02 Jul 2003 19:50
39 lines
2342 bytes
2342 bytes
Hello,
On Wed, 2 Jul 2003 21:40:37 +0200, Alain GUERIN wrote:
Oups ! bad version.
>
>
> function OnBeforeSendingMessage(var Message: TStringlist; Servername:
> string; IsEmail: boolean):boolean;
>
> var
> HeaderCount : INTEGER;
> InsertionPlace : INTEGER;
> InsertionContent : String;
> Language : TLanguage;
> TimePeriod : TDayTime;
>
> begin
> //Your code goes here
> //Return false to prevent sending the passed message
> IF NOT IsEMail THEN
> BEGIN
> HeaderCount := 0;
> WHILE (HeaderCount < Message.count) AND (pos('Newsgroups:',
> Message.Strings[HeaderCount]) <> 1) DO
> HeaderCount:=HeaderCount+1;
> IF HeaderCount < Message.count THEN
this line with begin must be deleted
> BEGIN
> Language := SelectLanguage(Message.Strings[HeaderCount]);
> HeaderCount := 0;
Sorry
--
A.G.
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Wed, 02 Jul 2003 21:01
Date: Wed, 02 Jul 2003 21:01
16 lines
1760 bytes
1760 bytes
Hello, On Wed, 2 Jul 2003 21:40:37 +0200, Alain GUERIN wrote: > > (That will be the next modification: add the Dialog tag when > sending a new post in the newsmanager groups). > Version with automatic addition of a [Dialog] tag in a new post is done and under final test. If anybody is interested, I will post the new version. -- A.G.
Re: [Dialog] Customising Posts
Author: Jarrod Cifer
Date: Thu, 03 Jul 2003 04:11
Date: Thu, 03 Jul 2003 04:11
14 lines
2063 bytes
2063 bytes
Alain GUERIN, upon reaching Nirvana, postulated: > Version with automatic addition of a [Dialog] tag in a new post is done and > under final test. > If anybody is interested, I will post the new version. I'm *always* interested in new scripts for Dialog. When you're done testing, could you post it on the Wiki script page (http://40tude.com/dialog/wiki/index.php/General%20scripts) as well as in this group, please? Nice script, BTW. Would you like to try your hand at making one for box quotes? -- J. Cifer
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Thu, 03 Jul 2003 05:33
Date: Thu, 03 Jul 2003 05:33
25 lines
2266 bytes
2266 bytes
Hello, On Thu, 3 Jul 2003 06:11:49 +0200, Jarrod Cifer wrote: > Alain GUERIN, upon reaching Nirvana, postulated: > >> Version with automatic addition of a [Dialog] tag in a new post is done and >> under final test. > >> If anybody is interested, I will post the new version. > > I'm *always* interested in new scripts for Dialog. When you're done > testing, could you post it on the Wiki script page > (http://40tude.com/dialog/wiki/index.php/General%20scripts) as well as in > this group, please? I tried once but with no success. I need to find a manual on Wiki script file (may be in French ;-) > Would you like to try your hand at making one for box quotes? What do you mean by "box quotes" ? -- A.G.
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Thu, 03 Jul 2003 06:47
Date: Thu, 03 Jul 2003 06:47
13 lines
1907 bytes
1907 bytes
Hello, On Thu, 3 Jul 2003 07:33:15 +0200, Alain GUERIN wrote: > I tried once but with no success. I need to find a manual on Wiki script > file (may be in French ;-) > Eventually, I did it. I don't understand while I failed the first time. Maybe because the very first version of the script was buggy :-) -- A.G.
Re: [Dialog] Customising Posts
Author: Jarrod Cifer
Date: Thu, 03 Jul 2003 08:19
Date: Thu, 03 Jul 2003 08:19
26 lines
2610 bytes
2610 bytes
Alain GUERIN, upon reaching Nirvana, postulated: > I tried once but with no success. I need to find a manual on Wiki script > file (may be in French ;-) It seems you were able to solve the problems with Wiki. ;-) >> Would you like to try your hand at making one for box quotes? > What do you mean by "box quotes" ? A box quote looks like this: /=============== [ Sorting/Scoring ] ===============\ | Mark articles read if score is smaller than [Num] | | If you want Dialog to automatically mark messages | | read that are below a certain score, set the | | minimum score here. | \===================================================/ Ideally you would mark the text in question, hit a key and the script would automagically insert a box quote with the marked contents. Maybe asking for a title first, so that something analog to the 'Sorting/Scoring' part in the example above would be inserted with it. -- J. Cifer
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Fri, 04 Jul 2003 10:20
Date: Fri, 04 Jul 2003 10:20
114 lines
6049 bytes
6049 bytes
Hello,
On Thu, 3 Jul 2003 10:19:12 +0200, Jarrod Cifer wrote:
> Ideally you would mark the text in question, hit a key and the script would
> automagically insert a box quote with the marked contents. Maybe asking for
> a title first, so that something analog to the 'Sorting/Scoring' part in
> the example above would be inserted with it.
OK, just a try: I first put the tittle before the future quoted box.
Then I select the text, title included, I delete it and I paste it with the
paste as custom quote option, with, "|" as custom quote character.
In the OnBeforeSendingMessage script, I detect the custom quote character
and I build the box with the following procedure.
procedure Buildquotedbox(VAR MessageQB : TStringlist);
var
firstline : integer;
lastline : integer;
LineIndex : integer;
BoxIndex : integer;
linelength : integer;
maxlength : integer;
spaces : integer;
newline : string;
CenterCustomQuoteChar : CHAR;
HorizontalborderChar : CHAR;
VerticalBorderChar : CHAR;
LeftTopBottomRightChar : CHAR;
RightTopBottomLeftChar : CHAR;
Proceed : boolean;
BEGIN
LineIndex:=0;
CenterCustomQuoteChar := '|';
HorizontalborderChar := '-';
VerticalBorderChar := '|';
LeftTopBottomRightChar := '/';
RightTopBottomLeftChar := '\';
WHILE LineIndex < MessageQB.count DO
BEGIN
IF pos(CenterCustomQuoteChar, MessageQB.Strings[LineIndex])=1 THEN
BEGIN
firstline:=LineIndex;
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(CenterCustomQuoteChar, MessageQB.Strings[LineIndex])=1);
WHILE Proceed DO
BEGIN
IF length(MessageQB.Strings[LineIndex]) > maxlength THEN
maxlength :=length(MessageQB.Strings[LineIndex]);
writeln(inttostr(maxlength));
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(CenterCustomQuoteChar, MessageQB.Strings[LineIndex])=1)
END;
lastline := LineIndex-1;
spaces := (maxlength+1) div 2;
{proceed title}
newline := MessageQB.Strings[firstline];
{delete custom char}
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline := LeftTopBottomRightChar+StringOfChar(HorizontalborderChar, (maxlength-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar, ((maxlength-length(newline))DIV 2) +1)+RightTopBottomLeftChar
ELSE
newline := LeftTopBottomRightChar+StringOfChar(HorizontalborderChar, (maxlength-length(newline)DIV 2))+
newline+StringOfChar(HorizontalborderChar, (maxlength-length(newline))DIV 2)+RightTopBottomLeftChar;
MessageQB.delete(firstline);
MessageQB.insert(firstline,newline);
{procrrd box}
FOR BoxIndex := firstline+1 to lastline DO
BEGIN
newline := MessageQB.Strings[BoxIndex];
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline := padr(newline,linelength+(spaces-(linelength div 2)-1))
ELSE
newline := padr(newline,linelength+spaces-(linelength div 2));
newline := VerticalBorderChar+padl(newline, spaces-(linelength div 2))+VerticalBorderChar;
MessageQB.delete(BoxIndex);
MessageQB.insert(BoxIndex,newline);
END;
{proceed last box line}
IF Odd(maxlength) THEN
newline := RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+1)+LeftTopBottomRightChar
ELSE
newline := RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength)+LeftTopBottomRightChar;
MessageQB.insert(lastline+1,newline);
END;
LineIndex := LineIndex+1;
END;
END;
Does it fit your requirement ?
As I am not on my ADSL line, I did not tested it on line in the
OnBeforeSendingMessage event procedure.
I put variables for the box delimiter characters as I prefer a '*' if I use
it for me ;-)
--
A.G.
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Fri, 04 Jul 2003 10:30
Date: Fri, 04 Jul 2003 10:30
128 lines
6120 bytes
6120 bytes
Hello,
On Thu, 3 Jul 2003 10:19:12 +0200, Jarrod Cifer wrote:
> Ideally you would mark the text in question, hit a key and the script would
> automagically insert a box quote with the marked contents. Maybe asking for
> a title first, so that something analog to the 'Sorting/Scoring' part in
> the example above would be inserted with it.
OK, just a try: I first put the tittle before the future quoted box.
Then I select the text, title included, I delete it and I paste it with the
paste as custom quote option, with, "|" as custom quote character.
In the OnBeforeSendingMessage script, I detect the custom quote character
and I build the box with the following procedure.
procedure Buildquotedbox(VAR MessageQB : TStringlist);
var
firstline : integer;
lastline : integer;
LineIndex : integer;
BoxIndex : integer;
linelength : integer;
maxlength : integer;
spaces : integer;
newline : string;
CenterCustomQuoteChar : CHAR;
HorizontalborderChar : CHAR;
VerticalBorderChar : CHAR;
LeftTopBottomRightChar : CHAR;
RightTopBottomLeftChar : CHAR;
Proceed : boolean;
BEGIN
LineIndex:=0;
CenterCustomQuoteChar := '|';
HorizontalborderChar := '-';
VerticalBorderChar := '|';
LeftTopBottomRightChar := '/';
RightTopBottomLeftChar := '\';
WHILE LineIndex < MessageQB.count DO
BEGIN
IF pos(CenterCustomQuoteChar, MessageQB.Strings[LineIndex])=1 THEN
BEGIN
firstline:=LineIndex;
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(CenterCustomQuoteChar,
MessageQB.Strings[LineIndex])=1);
WHILE Proceed DO
BEGIN
IF length(MessageQB.Strings[LineIndex]) > maxlength THEN
maxlength :=length(MessageQB.Strings[LineIndex]);
writeln(inttostr(maxlength));
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(CenterCustomQuoteChar,
MessageQB.Strings[LineIndex])=1)
END;
lastline := LineIndex-1;
spaces := (maxlength+1) div 2;
{proceed title}
newline := MessageQB.Strings[firstline];
{delete custom char}
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(maxlength-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
((maxlength-length(newline))DIV 2) +1)+RightTopBottomLeftChar
ELSE
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(maxlength-length(newline)DIV 2))+
newline+StringOfChar(HorizontalborderChar,
(maxlength-length(newline))DIV 2)+RightTopBottomLeftChar;
MessageQB.delete(firstline);
MessageQB.insert(firstline,newline);
{procrrd box}
FOR BoxIndex := firstline+1 to lastline DO
BEGIN
newline := MessageQB.Strings[BoxIndex];
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline := padr(newline,linelength+(spaces-(linelength div
2)-1))
ELSE
newline := padr(newline,linelength+spaces-(linelength div 2));
newline := VerticalBorderChar+padl(newline, spaces-(linelength
div 2))+VerticalBorderChar;
MessageQB.delete(BoxIndex);
MessageQB.insert(BoxIndex,newline);
END;
{proceed last box line}
IF Odd(maxlength) THEN
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+1)+LeftTo
pBottomRightChar
ELSE
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength)+LeftTopB
ottomRightChar;
MessageQB.insert(lastline+1,newline);
END;
LineIndex := LineIndex+1;
END;
END;
Does it fit your requirement ?
As I am not on my ADSL line, I did not test it on line in the
OnBeforeSendingMessage event procedure.
I put variables for the box delimiter characters as I prefer a '*' if I use
it for me ;-)
--
A.G.
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Fri, 04 Jul 2003 14:01
Date: Fri, 04 Jul 2003 14:01
187 lines
8377 bytes
8377 bytes
Hello,
On Fri, 4 Jul 2003 12:30:16 +0200, Alain GUERIN wrote:
> Hello,
>
OK, as usual (for me ;) there where at least two bugs in the procedure.
Here is the corrected one, and, as a compensation for those who tried the
false version, the new one add left justified box to the center justified
box already proposed.
To left justify, put a '[' in place of a '|' as custom quote charcacter.
procedure Buildquotedbox(VAR MessageQB : TStringlist);
var
firstline : integer;
lastline : integer;
LineIndex : integer;
BoxIndex : integer;
linelength : integer;
maxlength : integer;
spaces : integer;
newline : string;
CenterCustomQuoteChar : CHAR;
LeftAlignCustomQuoteChar : CHAR;
HorizontalborderChar : CHAR;
VerticalBorderChar : CHAR;
LeftTopBottomRightChar : CHAR;
RightTopBottomLeftChar : CHAR;
Proceed : boolean;
BEGIN
LineIndex:=0;
CenterCustomQuoteChar := '|';
HorizontalborderChar := '*';
VerticalBorderChar := '*';
LeftTopBottomRightChar := '*';
RightTopBottomLeftChar := '*';
WHILE LineIndex < MessageQB.count DO
BEGIN
IF pos(CenterCustomQuoteChar, MessageQB.Strings[LineIndex])=1 THEN
BEGIN
firstline:=LineIndex;
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(CenterCustomQuoteChar,
MessageQB.Strings[LineIndex])=1);
WHILE Proceed DO
BEGIN
IF length(MessageQB.Strings[LineIndex]) > maxlength THEN
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(CenterCustomQuoteChar,
MessageQB.Strings[LineIndex])=1)
END;
lastline := LineIndex-1;
spaces := (maxlength+1) div 2;
{proceed title}
newline := MessageQB.Strings[firstline];
{delete custom char}
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2 +2)+RightTopBottomLeftChar
ELSE
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2+1)+RightTopBottomLeftChar;
MessageQB.delete(firstline);
MessageQB.insert(firstline,newline);
{procrrd box}
FOR BoxIndex := firstline+1 to lastline DO
BEGIN
newline := MessageQB.Strings[BoxIndex];
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline := padr(newline,linelength+(spaces-(linelength div
2)))
ELSE
newline := padr(newline,linelength+spaces-(linelength div
2)+1);
newline := VerticalBorderChar+padl(newline, spaces-(linelength
div 2))+VerticalBorderChar;
MessageQB.delete(BoxIndex);
MessageQB.insert(BoxIndex,newline);
END;
{proceed last box line}
IF Odd(maxlength) THEN
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+2)+LeftTo
pBottomRightChar
ELSE
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+1)+LeftTo
pBottomRightChar;
MessageQB.insert(lastline+1,newline);
END;
LineIndex := LineIndex+1;
END;
LeftAlignCustomQuoteChar := '[';
LineIndex:=0;
WHILE LineIndex < MessageQB.count DO
BEGIN
IF pos(LeftAlignCustomQuoteChar, MessageQB.Strings[LineIndex])=1 THEN
BEGIN
firstline:=LineIndex;
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(LeftAlignCustomQuoteChar,
MessageQB.Strings[LineIndex])=1);
WHILE Proceed DO
BEGIN
IF length(MessageQB.Strings[LineIndex]) > maxlength THEN
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(LeftAlignCustomQuoteChar,
MessageQB.Strings[LineIndex])=1)
END;
lastline := LineIndex-1;
{proceed title}
newline := MessageQB.Strings[firstline];
{delete custom char}
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+RightTopBottomLeftChar
ELSE
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2-1)+RightTopBottomLeftChar;
MessageQB.delete(firstline);
MessageQB.insert(firstline,newline);
{procrrd box}
FOR BoxIndex := firstline+1 to lastline DO
BEGIN
newline := MessageQB.Strings[BoxIndex];
delete(newline,1,1);
linelength := length(newline);
newline :=
VerticalBorderChar+padr(newline,linelength+spaces*2-linelength-1)+VerticalBo
rderChar;
MessageQB.delete(BoxIndex);
MessageQB.insert(BoxIndex,newline);
END;
{proceed last box line}
IF Odd(maxlength) THEN
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength)+LeftTopB
ottomRightChar
ELSE
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+1)+LeftTo
pBottomRightChar;
MessageQB.insert(lastline+1,newline);
END;
LineIndex := LineIndex+1;
END;
END;
I hope I do no more error or I will have to build the rigth justified boxes
;-)
--
A.G.
Re: [Dialog] Customising Posts
Author: Jarrod Cifer
Date: Fri, 04 Jul 2003 20:58
Date: Fri, 04 Jul 2003 20:58
8 lines
1910 bytes
1910 bytes
Alain GUERIN, upon reaching Nirvana, postulated: > I hope I do no more error or I will have to build the rigth justified boxes > ;-) That would be fine with me. :-) -- J. Cifer
Re: [Dialog] Customising Posts
Author: Jarrod Cifer
Date: Fri, 04 Jul 2003 21:08
Date: Fri, 04 Jul 2003 21:08
15 lines
2168 bytes
2168 bytes
Alain GUERIN, upon reaching Nirvana, postulated: > Does it fit your requirement ? > As I am not on my ADSL line, I did not test it on line in the > OnBeforeSendingMessage event procedure. > I put variables for the box delimiter characters as I prefer a '*' if I use > it for me ;-) Thank you very much! I haven't tried it yet, but I'll be doing some intensive testing using Hamster tomorrow. BTW Wiki patiently awaits your newest creation.:-) -- J. Cifer
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Sat, 05 Jul 2003 07:52
Date: Sat, 05 Jul 2003 07:52
16 lines
2199 bytes
2199 bytes
Hello, On Fri, 4 Jul 2003 23:08:14 +0200, Jarrod Cifer wrote: > Alain GUERIN, upon reaching Nirvana, postulated: > I haven't tried it yet, but I'll be doing some intensive testing using > Hamster tomorrow. BTW Wiki patiently awaits your newest creation.:-) I believed only you is asking for it :-) But, as buggy scripts are, perhaps, more difficult to copy into Wiki (after my own experience), I prefer wait a bit, just to be sure there is no big bug. -- A.G.
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Sat, 05 Jul 2003 07:59
Date: Sat, 05 Jul 2003 07:59
16 lines
2215 bytes
2215 bytes
Hello, On Fri, 4 Jul 2003 23:08:14 +0200, Jarrod Cifer wrote: > Alain GUERIN, upon reaching Nirvana, postulated: > I haven't tried it yet, but I'll be doing some intensive testing using > Hamster tomorrow. BTW Wiki patiently awaits your newest creation.:-) I believed only you is asking for it :-) But, as buggy scripts are, perhaps, more difficult to copy into Wiki (after my own experience), I prefer wait a bit, just to be sure there is no big bug. ;-) -- A.G.
Re: [Dialog] Customising Posts
Author: Gandalf il Grigio
Date: Mon, 07 Jul 2003 18:04
Date: Mon, 07 Jul 2003 18:04
20 lines
2090 bytes
2090 bytes
news.software.readers ~ 3/7/2003 ~ Jarrod Cifer: > /=============== [ Sorting/Scoring ] ===============\ >| Mark articles read if score is smaller than [Num] | >| If you want Dialog to automatically mark messages | >| read that are below a certain score, set the | >| minimum score here. | > \===================================================/ May I suggest this? :) ,----------------------------------. | This is a box quote stealed from | | a message by Alessio 'Sleepers' | `----------------------------------' -- Farewell, G ICQ# 16553733 ~ 40tude Dialog: http://snurl.com/dialog «"G for Grand!" they shouted, and the old man smiled.»
Re: [Dialog] Customising Posts
Author: Jarrod Cifer
Date: Mon, 07 Jul 2003 20:56
Date: Mon, 07 Jul 2003 20:56
14 lines
2125 bytes
2125 bytes
Gandalf il Grigio, upon reaching Nirvana, postulated: > May I suggest this? :) > ,----------------------------------. >| This is a box quote stealed from | >| a message by Alessio 'Sleepers' | > `----------------------------------' Yes, I also read the beta test group, but I requested it here before it was posted there. ;-) -- J. Cifer
Re: [Dialog] Customising Posts
Author: Jarrod Cifer
Date: Mon, 07 Jul 2003 21:08
Date: Mon, 07 Jul 2003 21:08
19 lines
2299 bytes
2299 bytes
Gandalf il Grigio, upon reaching Nirvana, postulated: > May I suggest this? :) > ,----------------------------------. >| This is a box quote stealed from | >| a message by Alessio 'Sleepers' | > `----------------------------------' BTW /---- [Correction] ----------------------\ | It was actually a boxquote stolen from | | Mathias Wrede | | MID <x4j8vt1iwpwh.dlg@wrede.myfqdn.de> | \----------------------------------------/ -- J. Cifer
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Mon, 07 Jul 2003 22:03
Date: Mon, 07 Jul 2003 22:03
28 lines
2456 bytes
2456 bytes
Hello, On Mon, 7 Jul 2003 20:04:43 +0200, Gandalf il Grigio wrote: > news.software.readers ~ 3/7/2003 ~ Jarrod Cifer: > >> /=============== [ Sorting/Scoring ] ===============\ >>| Mark articles read if score is smaller than [Num] | >>| If you want Dialog to automatically mark messages | >>| read that are below a certain score, set the | >>| minimum score here. | >> \===================================================/ > > May I suggest this? :) > > ,----------------------------------. >| This is a box quote stealed from | >| a message by Alessio 'Sleepers' | > `----------------------------------' It's up to you, but, if it is easy to adapt my script to various border characters, it needs more work if you want an "empty title" upper border like yours. Nevertheless, the biggest problem I have is to choose a fix font that has a good look ;-) -- A.G.
Re: [Dialog] Customising Posts
Author: Jarrod Cifer
Date: Tue, 15 Jul 2003 20:37
Date: Tue, 15 Jul 2003 20:37
20 lines
2291 bytes
2291 bytes
Alain GUERIN, upon reaching Nirvana, postulated: > I believed only you is asking for it :-) > But, as buggy scripts are, perhaps, more difficult to copy into Wiki (after > my own experience), I prefer wait a bit, just to be sure there is no big > bug. I finally got around to testing(Sorry for taking so long), but while trying to compile I get an error message in this line > IF Odd(maxlength) THEN > Failed when compiling > [Error] (57:12): Unknown identifier 'Odd' Suggestions? -- J. Cifer
Re: [Dialog] Customising Posts
Author: Alain GUERIN
Date: Wed, 16 Jul 2003 03:59
Date: Wed, 16 Jul 2003 03:59
218 lines
9391 bytes
9391 bytes
Hello,
On Tue, 15 Jul 2003 22:37:09 +0200, Jarrod Cifer wrote:
> Alain GUERIN, upon reaching Nirvana, postulated:
>
>> I believed only you is asking for it :-)
>
>> But, as buggy scripts are, perhaps, more difficult to copy into Wiki (after
>> my own experience), I prefer wait a bit, just to be sure there is no big
>> bug.
>
> I finally got around to testing(Sorry for taking so long), but while trying
> to compile I get an error message in this line
>
>> IF Odd(maxlength) THEN
>
>> Failed when compiling
>> [Error] (57:12): Unknown identifier 'Odd'
>
> Suggestions?
Add this function in your script before the procedure Buildquotedbox.
function Odd(Value:integer): boolean;
begin
result := value mod 2 <> 0
end;
and also a new version that do not treat a single marked line, One title
alone on an empty box has no reason (or at least can be build by hand) and
it avoids to build this kind of empty box only because, you use the "magic"
character in the beginning of a line in a post without any whish to have a
box. (I has this "bug" in a post where I emphasized a word with square
brackets '['...']' and has the surprise to see many stars around and under
the word ;-)
procedure Buildquotedbox(VAR MessageQB : TStringlist);
var
firstline : integer;
lastline : integer;
LineIndex : integer;
BoxIndex : integer;
linelength : integer;
maxlength : integer;
spaces : integer;
newline : string;
CenterCustomQuoteChar : CHAR;
LeftAlignCustomQuoteChar : CHAR;
HorizontalborderChar : CHAR;
VerticalBorderChar : CHAR;
LeftTopBottomRightChar : CHAR;
RightTopBottomLeftChar : CHAR;
Proceed : boolean;
BEGIN
LineIndex:=0;
CenterCustomQuoteChar := '|';
HorizontalborderChar := '*';
VerticalBorderChar := '*';
LeftTopBottomRightChar := '*';
RightTopBottomLeftChar := '*';
WHILE LineIndex < MessageQB.count DO
BEGIN
IF pos(CenterCustomQuoteChar, MessageQB.Strings[LineIndex])=1 THEN
BEGIN
firstline:=LineIndex;
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(CenterCustomQuoteChar,
MessageQB.Strings[LineIndex])=1);
WHILE Proceed DO
BEGIN
IF length(MessageQB.Strings[LineIndex]) > maxlength THEN
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(CenterCustomQuoteChar,
MessageQB.Strings[LineIndex])=1)
END;
lastline := LineIndex-1;
IF lastline <> firstline THEN
BEGIN
spaces := (maxlength+1) div 2;
{proceed title}
newline := MessageQB.Strings[firstline];
{delete custom char}
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2 +2)+RightTopBottomLeftChar
ELSE
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2+1)+RightTopBottomLeftChar;
MessageQB.delete(firstline);
MessageQB.insert(firstline,newline);
{procrrd box}
FOR BoxIndex := firstline+1 to lastline DO
BEGIN
newline := MessageQB.Strings[BoxIndex];
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline := padr(newline,linelength+(spaces-(linelength div
2)))
ELSE
newline := padr(newline,linelength+spaces-(linelength div
2)+1);
newline := VerticalBorderChar+padl(newline, spaces-(linelength
div 2))+VerticalBorderChar;
MessageQB.delete(BoxIndex);
MessageQB.insert(BoxIndex,newline);
END;
{proceed last box line}
IF Odd(maxlength) THEN
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+2)+LeftTo
pBottomRightChar
ELSE
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+1)+LeftTo
pBottomRightChar;
MessageQB.insert(lastline+1,newline);
END
END;
LineIndex := LineIndex+1;
END;
LeftAlignCustomQuoteChar := '[';
LineIndex:=0;
WHILE LineIndex < MessageQB.count DO
BEGIN
IF pos(LeftAlignCustomQuoteChar, MessageQB.Strings[LineIndex])=1 THEN
BEGIN
firstline:=LineIndex;
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(LeftAlignCustomQuoteChar,
MessageQB.Strings[LineIndex])=1);
WHILE Proceed DO
BEGIN
IF length(MessageQB.Strings[LineIndex]) > maxlength THEN
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(LeftAlignCustomQuoteChar,
MessageQB.Strings[LineIndex])=1)
END;
lastline := LineIndex-1;
IF lastline <> firstline THEN
BEGIN
{proceed title}
newline := MessageQB.Strings[firstline];
{delete custom char}
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+RightTopBottomLeftChar
ELSE
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2-1)+RightTopBottomLeftChar;
MessageQB.delete(firstline);
MessageQB.insert(firstline,newline);
{procrrd box}
FOR BoxIndex := firstline+1 to lastline DO
BEGIN
newline := MessageQB.Strings[BoxIndex];
delete(newline,1,1);
linelength := length(newline);
newline :=
VerticalBorderChar+padr(newline,linelength+spaces*2-linelength-1)+VerticalBo
rderChar;
MessageQB.delete(BoxIndex);
MessageQB.insert(BoxIndex,newline);
END;
{proceed last box line}
IF Odd(maxlength) THEN
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength)+LeftTopB
ottomRightChar
ELSE
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+1)+LeftTo
pBottomRightChar;
MessageQB.insert(lastline+1,newline);
END
END;
LineIndex := LineIndex+1;
END;
END;
--
A.G.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads