🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #162246

Re: [dialog] script plonk by name and address

#162246
From: Jim Scott
Date: Tue, 08 Feb 2005 16:51
149 lines
4877 bytes
On Tue, 8 Feb 2005 11:43:50 -0500, Cold Coffee wrote:

> On Tue, 8 Feb 2005 16:25:14 +0000, Jim Scott wrote:
> 
>> I cut and pasted a script that, I thought, allowed me to plonk using the
>> name *and* the address of the sender.
>> However it doesn't work and I may have made a mess of it. However I cannot
>> find the original. Can someone please direct me to it, or post one here?
> 
> 
> Here is the original script that the author (not me) posted to this group
> about three weeks ago:
> 
> I copied and pasted the script exactly as he posted under the custom
> scripts, then assigned a shortcut key and menu icon.  It works well for me.
> 
> 
> 
> ---------   begin script --------------------------------
> 
> 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.
> 
> -------------------- end script -------------------------

Thanks CC, that's the one and I got it right.
How do I assign a shortcut key and a menu item to a *script*?
I know, in general terms, how to assign shortcuts to things already there.
-- 
Jim on Tyneside UK
Remove X to email me.
http://freespace.virgin.net/mr.jimscott/
Technical Details
Message-ID: <1dgw4qs15us96.dlg@ID-104726.news.individual.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.ams.giganews.com!number1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.r-kom.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <1iu3rrsrl7b14.dlg@ID-104726.news.individual.net> <fl2bosvq2l73.dlg@ID-259643.user.individual.net>

Show Full Headers
Complete Article Headers
Message-ID: <1dgw4qs15us96.dlg@ID-104726.news.individual.net>
Subject: Re: [dialog] script plonk by name and address
Date: Tue, 8 Feb 2005 16:51:53 +0000
From: Jim Scott <mr.jimscott@Xvirgin.net>
References: <1iu3rrsrl7b14.dlg@ID-104726.news.individual.net> <fl2bosvq2l73.dlg@ID-259643.user.individual.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.ams.giganews.com!number1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.r-kom.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Lines: 149
Reply-To: mr.jimscott@Xvirgin.net
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: individual.net gNw7BivHYD82UzbziNnkqQrg4IgDLXyFCmSE7/3El5h6AbbYyZ
User-Agent: 40tude_Dialog/2.0.15.1
X-Face: @q-(&%KO$SkpZr^lK+1g^&c7m%V1AB+; :y.|j9aFv=r&lpJz8*Rg;
 +h_ZzsiNuCXW<M@'=6
 8P_<Qr>VG*&.ZN(VGR)v!rmOB/(aA-A/O7w(4xi8\#df(a{+lRQ'6Q3LOcBOcGj}Au#019|f`jbKBG
 iE]4YUvH01$1B2vq)UWSjF4&ZggPRLmqx,sL`kXdgJO{nx