🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #139915

Re: [Dialog] Scripting String type

#139915
From: Warwick
Date: Sat, 27 Dec 2003 02:31
318 lines
10071 bytes
On Fri, 26 Dec 2003 21:05:36 -0500, Liz Albin wrote:

> On Sat, 27 Dec 2003 14:54:11 +1300, Warwick wrote:
> 
>> Any help most appreciated.
> 
> Looking at this function:
> 
>  FUNCTION ExtractHeaderValue( HeaderKey : string ): string;
>     VAR
>       i, strpos : integer;
>       tmp : string;
>     BEGIN  
>       Result := '';  
>       i := 0;  
>       
>       memo.Lines.SaveToFile(OutputPath+'memotest.txt');
>       
>      WHILE (i < memo.Lines.count-1) AND (Result = '') DO
>      BEGIN
>          
>          tmp :=  memo.Lines.Strings[i];   
>          info.Add(tmp);               
>          i := i+1;
>       END;  
>       Info.SaveToFile(OutputPath + 'Info.txt'); 
>       Halt := true; //parse one post only
>     END;
> 
> I notice that neither Result nor ExtractHeaderValue is ever set.
> Perhaps this is a problem?

there is an empty string assigned into result immediately after BEGIN.

Oddly Statements like 
	ExtractHeaderValue := 'AString';
will not compile in Dialog, only functions that are of the form
	Result := 'AString';
I posted on that irregularity to another newsgroup and was made aware of
what the Result variable is.

It might be a problem but it does not readily explain why the strings added
to Info have been broken up with newlines that should not be there.

It is easily tested, so I have replaced that function with a procedure
called ATest.

The problem of newlines breaking up the value in tmp persists :(

btw, I am very grateful for your input :)

new listing and output follow
<Code>
rogram MyTest;
uses
   forms,   
   textfile,
   stdctrls;

   CONST
   OutputPath = 'C:\Documents And Settings\Warwick Barnes\My
Documents\Dialog Outputs\';
   
  

    VAR
    memo : TMemo; {work-around for copyclipboard function for lines}
    HostForm : TForm;   
    PrevMessageId : string;
    MessageID : string;
    Info : TStringList; {to be replace by appropriate data structure for
other analysis}
    Halt : boolean; {work around of the propagation of an exception that
abort the script}

   
    
//-----------------------------------------------------------------------------------------------------
    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';

//-----------------------------------------------------------------------------------------------------
    PROCEDURE ClearCLipboard;
    {to avoid side effects: if an empty selection is copyed in the
clipboard}
    BEGIN
      OpenClipboard(Application.Handle);
      EmptyClipboard;
      CloseClipboard;
    END;
//-----------------------------------------------------------------------------------------------------   


//-----------------------------------------------------------------------------------------------------   
    FUNCTION GetClipboardData():boolean; //Copy Clipboard data to Global
DummyMemo
    begin                                // return true if data copied.
        memo.Clear();
        memo.PasteFromClipboard();
        result := memo.Lines.Count > 0;
     end;
//-----------------------------------------------------------------------------------------------------  

 PROCEDURE ATest();
    VAR
      i : integer;
      tmp : string;
    BEGIN  
      
      i := 0;  
      
      memo.Lines.SaveToFile(OutputPath+'memotest.txt');
      
     WHILE (i < memo.Lines.count-1) do
     BEGIN
         
         tmp :=  memo.Lines.Strings[i];   
         info.Add(tmp);               
         i := i+1;
      END;  
      Info.SaveToFile(OutputPath + 'Info.txt'); 
      Halt := true; //parse one post only
    END;


//----------------------------------------------------------------------------------------------------
   PROCEDURE AnalyseAllMessages();
   
   VAR
      MessageCounter : INTEGER;
      Done:boolean;
      MessageId, PrevMessageId:string;    
      
   BEGIN
         MessageCounter:=0;
         PrevMessageId := ' ';
         Done := false;
         WHILE( NOT Done ) Do
         Begin
            ClearClipboard();
            ADo('ArticlePane');
            ADo('ShowHeaders');  
            ADo('SelectAll'); 
            ADo('Copy');  
            if GetClipboardData() then        
                       ATest();
            if( Halt = true ) then
               Done := true;
            if MessageId = PrevMessageId then
                 Done := true; 
           ADo('NextMessageInHistory');      
           
         end;//while
   END;
//-----------------------------------------------------------------------------------------------------

BEGIN   //main
   try
      lockdisplay;   
      HostForm := TForm.Create(Nil); 
      memo := TMemo.Create(HostForm);
      memo.Parent := HostForm;
      Info := TStringList.Create();
      AnalyseAllMessages();
      ADo('CollapseAllThreads');	
   finally
   	memo.Free();
   	Info.Free();   
  	unlockdisplay;
   end;

End.
</Code>

<Contents of Memo>
Path:
news.xtra.co.nz!enews.sgi.com!tdsnet-transit!newspeer.tds.net!diablo.voicenet.com!rcn!feed3.news.rcn.net!not-for-mail
From: Liz Albin <lizalbin@yahooNotThis.com>
Subject: Re: [Dialog] Scripting String type
Newsgroups: news.software.readers
User-Agent: 40tude_Dialog/2.0.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
References: <1b6u8igdk34r0$.a6efjxy49gi9.dlg@40tude.net>
<3fec4018$0$4751$61fed72c@news.rcn.com>
<cpggdl6fzows$.e509dp8nmg5f.dlg@40tude.net>
<3fece09c$0$4761$61fed72c@news.rcn.com>
<jajhoqqonc5e.1q1m1s6565rcw$.dlg@40tude.net>
Date: Fri, 26 Dec 2003 21:05:36 -0500
Archive: yes
Lines: 31
Message-ID: <3fece90f$0$4754$61fed72c@news.rcn.com>
NNTP-Posting-Host: 207.237.44.199
X-Trace: 1072490767 reader3.news.rcn.net 4754 207.237.44.199:4173
X-Complaints-To: abuse@rcn.com
Xref: news.xtra.co.nz news.software.readers:120639

On Sat, 27 Dec 2003 14:54:11 +1300, Warwick wrote:

> Any help most appreciated.

Looking at this function:

 FUNCTION ExtractHeaderValue( HeaderKey : string ): string;
    VAR
      i, strpos : integer;
      tmp : string;
    BEGIN  
      Result := '';  
      i := 0;  
      
      memo.Lines.SaveToFile(OutputPath+'memotest.txt');
      
     WHILE (i < memo.Lines.count-1) AND (Result = '') DO
     BEGIN
         
         tmp :=  memo.Lines.Strings[i];   
         info.Add(tmp);               
         i := i+1;
      END;  
      Info.SaveToFile(OutputPath + 'Info.txt'); 
      Halt := true; //parse one post only
    END;

I notice that neither Result nor ExtractHeaderValue is ever set.
Perhaps this is a problem?
-- 
liz


</Contents of Memo>

<Contents of Info>
Path: 
news.xtra.co.nz!enews.sgi.com!tdsnet
-transit!newspeer.tds.net!diablo.voice
net.com!rcn!feed3.news.rcn.net!not-f
or-mail
From: Liz Albin 
<lizalbin@yahooNotThis.com>
Subject: Re: [Dialog] Scripting String 
type
Newsgroups: news.software.readers
User-Agent: 40tude_Dialog/2.0.9.1
MIME-Version: 1.0
Content-Type: text/plain; 
charset="us-ascii"
Content-Transfer-Encoding: 7bit
References: 
<1b6u8igdk34r0$.a6efjxy49gi9.dlg@4
0tude.net> 
<3fec4018$0$4751$61fed72c@new
s.rcn.com> 
<cpggdl6fzows$.e509dp8nmg5f.dlg@
40tude.net> 
<3fece09c$0$4761$61fed72c@new
s.rcn.com> 
<jajhoqqonc5e.1q1m1s6565rcw$.dlg
@40tude.net>
Date: Fri, 26 Dec 2003 21:05:36 
-0500
Archive: yes
Lines: 31
Message-ID: 
<3fece90f$0$4754$61fed72c@news
.rcn.com>
NNTP-Posting-Host: 207.237.44.199
X-Trace: 1072490767 
reader3.news.rcn.net 4754 
207.237.44.199:4173
X-Complaints-To: abuse@rcn.com
Xref: news.xtra.co.nz 
news.software.readers:120639

On Sat, 27 Dec 2003 14:54:11 
+1300, Warwick wrote:

> Any help most appreciated.

Looking at this function:

 FUNCTION ExtractHeaderValue( 
HeaderKey : string ): string;
    VAR
      i, strpos : integer;
      tmp : string;
    BEGIN  
      Result := '';  
      i := 0;  
      
      
memo.Lines.SaveToFile(OutputPath+'
memotest.txt');
      
     WHILE (i < memo.Lines.count-1) 
AND (Result = '') DO
     BEGIN
         
         tmp :=  memo.Lines.Strings[i];   
         info.Add(tmp);               
         i := i+1;
      END;  
      Info.SaveToFile(OutputPath + 
'Info.txt'); 
      Halt := true; //parse one post only
    END;

I notice that neither Result nor 
ExtractHeaderValue is ever set.
Perhaps this is a problem?
-- 

</Contents of Info>
Technical Details
Message-ID: <thmjf3ul88gq.v292hic8wob1$.dlg@40tude.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!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!news.xtra.co.nz!53ab2750!not-for-mail
References: <1b6u8igdk34r0$.a6efjxy49gi9.dlg@40tude.net> <3fec4018$0$4751$61fed72c@news.rcn.com> <cpggdl6fzows$.e509dp8nmg5f.dlg@40tude.net> <3fece09c$0$4761$61fed72c@news.rcn.com> <jajhoqqonc5e.1q1m1s6565rcw$.dlg@40tude.net> <3fece90f$0$4754$61fed72c@news.rcn.com>

Show Full Headers
Complete Article Headers
Message-ID: <thmjf3ul88gq.v292hic8wob1$.dlg@40tude.net>
Subject: Re: [Dialog] Scripting String type
Date: Sat, 27 Dec 2003 15:31:11 +1300
From: Warwick <wjcb@extra.co.nz>
References: <1b6u8igdk34r0$.a6efjxy49gi9.dlg@40tude.net> <3fec4018$0$4751$61fed72c@news.rcn.com> <cpggdl6fzows$.e509dp8nmg5f.dlg@40tude.net> <3fece09c$0$4761$61fed72c@news.rcn.com> <jajhoqqonc5e.1q1m1s6565rcw$.dlg@40tude.net> <3fece90f$0$4754$61fed72c@news.rcn.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!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!news.xtra.co.nz!53ab2750!not-for-mail
Newsgroups: news.software.readers
User-Agent: 40tude_Dialog/2.0.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Lines: 318
NNTP-Posting-Host: 219.88.59.85
X-Complaints-To: newsadmin@xtra.co.nz
X-Trace: news.xtra.co.nz 1072492268 219.88.59.85 (Sat,
NNTP-Posting-Date: Sat, 27 Dec 2003 15:31:08 NZDT
Organization: Xtra