Article View: news.software.readers
Article #127655Re: [Dialog] Customising Posts
From: 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.
Technical Details
Message-ID:
<3f05573c$0$5262$626a54ce@news.free.fr>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!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!newsfeed.stueberl.de!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mailReferences:
<3f03353e$0$5400$626a54ce@news.free.fr> <3f03484e$0$5442$626a54ce@news.free.fr> <6tudnRrDCvmRMJ6iU-KYuQ@giganews.com> <3f03c01d$0$12435$626a54ce@news.free.fr> <QwSdnS7w_MKaep6iXTWJkQ@giganews.com>Show Full Headers
Complete Article Headers
Message-ID: <3f05573c$0$5262$626a54ce@news.free.fr>
Subject: Re: [Dialog] Customising Posts
Date: Fri, 4 Jul 2003 12:30:16 +0200
From: Alain GUERIN <news40@spamout-alain-guerin.com.invalid>
References: <3f03353e$0$5400$626a54ce@news.free.fr> <3f03484e$0$5442$626a54ce@news.free.fr> <6tudnRrDCvmRMJ6iU-KYuQ@giganews.com> <3f03c01d$0$12435$626a54ce@news.free.fr> <QwSdnS7w_MKaep6iXTWJkQ@giganews.com>
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!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!newsfeed.stueberl.de!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mail
Newsgroups: news.software.readers
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Reply-To: news40@alain-guerin.com
Organization: NA
X-Face: GOI#J$,onz-'Uz6us^h!d&!=/wSO@@FxWc?}1i_p@/E%ViONg.TD9>V7VA4(S/j%&mb%4uD
,=8(bmy`{t`AM[~^Y#8*]ZJ;
{y2%EU,B'%$9[qEDa)B{/P4+eTD5E4{Un+XE$|RWd(=aNN%(,yP,cG
=k=7dqQ"euLbBTVKLCV-Ql@aFEdzF1F6GU4b}qG%JPDjL'~T2;
-03s=7s5[QUH@>GQ!CLJ@S{%K[m1
$j`EsD+M&'5>>&-'tfiB0p',<4e0SN,4NDZ:f._qI9vVW0[r\~yk7{.GmY^cN*&/=5qjcH&Q; $
Supersedes: <3f0554f9$0$5242$626a54ce@news.free.fr>
User-Agent: 40tude_Dialog/2.0.5.1
Lines: 128
NNTP-Posting-Date: 04 Jul 2003 12:30:22 MEST
NNTP-Posting-Host: 62.147.137.64
X-Trace: 1057314622 news1-1.free.fr 5262 62.147.137.64:1207
X-Complaints-To: abuse@proxad.net