Thread View: news.software.readers
5 messages
5 total messages
Started by MLC
Wed, 26 Jan 2005 12:44
[Dialog] PlonkWithAddress script
Author: 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
Re: [Dialog] PlonkWithAddress script
Author: MLC
Date: Wed, 26 Jan 2005 12:47
Date: Wed, 26 Jan 2005 12:47
7 lines
1270 bytes
1270 bytes
_MLC_, mercoledì 26/gen/2005: > clicking Esc leaves all unchanged Sorry, it should have been "clicking Cancel". -- Maria Luisa C - 26/01/2005 13.45.53
Re: [Dialog] PlonkWithAddress script
Author: Tarkus
Date: Wed, 26 Jan 2005 16:52
Date: Wed, 26 Jan 2005 16:52
24 lines
2026 bytes
2026 bytes
On 1/26/2005 4:44:23 AM, MLC wrote: > To Tarkus and Charani particularly :-) Thanks very much! > (I'm sorry though I didn't implement the choice for only address, > without nickname) No big deal. If necessary, it's easier to delete the nickname than it is to manually copy and paste the address, as before. At first the script wouldn't compile, but I found a couple lines (9 and 12) that got wrapped in your message. Seems to work fine now. Just a question, is there supposed to be a space before the "+" but not after? Thanks again! -- "It's not easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day." Now playing: "Demons & Wizards - Poor Man's Crusade"
Re: [Dialog] PlonkWithAddress script
Author: MLC
Date: Wed, 26 Jan 2005 17:40
Date: Wed, 26 Jan 2005 17:40
13 lines
1547 bytes
1547 bytes
_Tarkus_, mercoledì 26/gen/2005: > At first the script wouldn't compile, but I found a couple lines (9 and > 12) that got wrapped in your message. Damn, I didn't think about the wrapping in my post! > > Seems to work fine now. Just a question, is there supposed to be a space > before the "+" but not after? Yes, it must be so :-) -- Maria Luisa C - 26/01/2005 18.38.42
Re: [Dialog] PlonkWithAddress script
Author: Charani
Date: Wed, 26 Jan 2005 19:51
Date: Wed, 26 Jan 2005 19:51
14 lines
1360 bytes
1360 bytes
On Wed, 26 Jan 2005 13:44:23 +0100, MLC wrote: > (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>" 8>< snipped but read and saved Very many thanks for that :)) It's much appreciated :))
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