Article View: news.software.readers
Article #161388[Dialog] PlonkWithAddress script
From: MLC
Date: Wed, 26 Jan 2005 12:44
Date: Wed, 26 Jan 2005 12:44
156 lines
4979 bytes
4979 bytes
To Tarkus and Charani particularly :-)
(I'm sorry though I didn't implement the choice for only address, without
nickname)
This script adds the email address to the nickname in a plonk action, with
the logical "and" between them.
So, in the "Score and actions" window you'll get something like:
!markread From "nickname" +"<email_address>"
Notes:
- This script doesn't check if you currently have the headers visible or
not, but: if they are not visible, it does its job and adds the address, if
instead they are visible it adds only the nickname (Dialog default).
- Some people use a nickname which is itself an email address: when only
that appears in the From: header, only that is added.
- A malformed address that in the headers doesn't start with a < is not
added.
The script at the end of its job shows the "Score and actions" window, so
you can check the result and see if it fits your needs. Clicking OK accepts
the changes, clicking Esc leaves all unchanged.
More Important Notes:
- Don't compile the script with F9 (or clicking on the green triangle), but
compile it with Ctr+F9 (or clicking on the gray little sheet with 10101, on
the left of the green triangle) and then run it _outside_ the script editor,
with a hotkey or a dedicated button.
- Don't use the Ctrl key in your hotkey combination: the script wouldn't
work well.
- The script uses the Postkey() function to send the "end" and "Ctrl+V"
keystrokes to the "Score and actions" window: so be aware of that, if you
have changed these keys to something else.
Program PlonkWithAddress; //v0.4 24/Gennaio/2005, by MLC
uses Forms, StdCtrls;
var
myForm: TForm;
myMemo: TMemo;
mail: string;
Function EmptyClipboard:boolean; external 'EmptyClipboard@user32.dll
stdcall';
Function OpenClipboard(hWndNewOwner: INTEGER):boolean; external
'OpenClipboard@user32.dll stdcall';
Function CloseClipboard:boolean; external 'CloseClipboard@user32.dll
stdcall';
function ItemCount(s: string; sep: char): integer;
var
i, r: integer;
stemp: string;
begin
stemp:=s;
r:=0;
i:=Pos(sep,stemp);
while i<>0 do
begin
r:=r+1;
delete(stemp, i, 1);
i:=Pos(sep,stemp);
end;
result:=r;
end;
function RevStr(s: string ): string;
var
i: integer;
s2: string;
begin
s2 := '';
for i:=1 to Length(s) do
begin
s2:=s[i]+s2;
end;
result:=s2;
end;
Procedure ClearClipboard;
Begin
OpenClipboard(0);
EmptyClipboard;
CloseClipboard;
end;
Procedure GetMsgBody;
begin
ClearClipboard;
myMemo.Clear;
ADo('ArticlePane');
ADo('SelectAll');
Ado('Copy');
myMemo.PasteFromClipboard;
end;
Function GetAddress: string;
var
i: integer;
addr: string;
begin
i:=0;
addr:='';
while (i < myMemo.Lines.count-1) do
begin
if Pos('From:', myMemo.lines.Strings[i]) = 1 then
begin
addr:=myMemo.lines.Strings[i];
break;
end
else i:=i+1;
end; //while
i:=ItemCount(addr, '<');
if (i > 0) then
begin
addr:=RevStr(addr);
i:=Pos('<',addr);
addr:=copy(addr, 1, i);
addr:=RevStr(addr);
end else addr:='';
result:=addr;
end;
Procedure BuildContainers;
begin
myMemo := tMemo.Create(myForm);
myMemo.Parent := myForm;
myMemo.Width := Application.Mainform.width;
end;
Begin
myForm := tForm.Create(nil);
lockdisplay;
try
BuildContainers;
ADo('ShowHeaders');
GetMsgBody;
ADo('ShowHeaders');
mail:=GetAddress;
if (mail='') then myMemo.text:=' '
else myMemo.text:=' +"'+mail+'"';
myMemo.SelectAll;
myMemo.CopyToClipboard;
ADoLater('AddPlonkFilter');
PostKey(35, false, false, false, false, false, false, false, false);
//end
PostKey(86, false, false, true, false, false, false, false, false);
//Ctrl+V
finally
unlockdisplay;
myForm.free;
end;
End.
--
Maria Luisa C - 26/01/2005 13.15.56
Technical Details
Message-ID:
<17rrajgqkqzah.dlg@maluc.it>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.ams.giganews.com!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border1.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <17rrajgqkqzah.dlg@maluc.it> Subject: [Dialog] PlonkWithAddress script Date: Wed, 26 Jan 2005 13:44:23 +0100 From: MLC <marialuisacNOSPAM@gmail.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!number1.nntp.ams.giganews.com!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border1.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Newsgroups: news.software.readers Organization: none Lines: 156 Reply-To: marialuisac@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: individual.net lif6Qyn2FyDwgi/ZeStBUAzEgMwNFJFPMVCAo/Cz2+MuLcZtAZ X-Now-Playing: Winamp is not active User-Agent: 40tude_Dialog/2.0.14.60it (38ca7754.476.505) X-Coord: Lat 44.317 N, Long 11.417 E X-URL: http://fido.altervista.org/index.php