🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #265139

Re: [dialog] Can I set dialog to edit in Notepad++

#265139
From: bill
Date: Fri, 13 Aug 2021 18:09
87 lines
4796 bytes
On 2021-08-13, Bernd Rose <b.rose.tmpbox@arcor.de> wrote:
> In theory: You mix both scripts into one and order the commands in
> a logical way during that mixing.

I apologize I sent that last message before I saw this, as I was working 
on the solution the entire time so I didn't check the newsgroup first 
and we both posted at about the same time.

This works but it only works standalone:
 function OnBeforeSendingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean):boolean;
 begin
 result:=true;
 message.savetofile('C:\temp\dialog.txt');
 FileExecute(0,'C:\program files\notepad++\notepad++.exe','open','"C:\temp\dialog.txt"','',1,50000);
 message.loadfromfile('C:\temp\dialog.txt');
 end;

 begin
 end.

> Having the right commands at hands isn't even half of it. Placing
> such a call to an external editor in OnBeforeSendingMessage cries
> out for problems. You'd need to hit <Send> inside the 40tude Compose 
> window before even beginning with editing.

Yup. I saw that. It's ok. Worse case it sends an incomplete message.
No big deal. I increased the failure time to five seconds just in case.

> You sure could add a
> return value of failure to this script, which would bring you back
> to the editor.

I tried adding the return value of false to a variety of locations.

function OnBeforeSendingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean):boolean;
begin
// result:=true;    
result:=false;
message.savetofile('C:\temp\dialog.txt');
FileExecute(0,'C:\program files\notepad++\notepad++.exe','open','"C:\temp\dialog.txt"','',1,5000); 
result:=false;
message.loadfromfile('C:\temp\dialog.txt'); 
result:=false;
end;

begin   
end.

No matter _where_ I put the return value of false it errors with:
"Posting article failed: Posting canceled by "OnBeforeSendingMessage" script."

> If you do not return, but send unconditionally, you
> loose the ability to cancel a post. Of course, you can add another
> inquiry ("Send or not?") to the script. But this would, again, just
> increase complexity.

I'll have to figure out how to get back to the composition window
but the return value of false just kills the process and does nothing.

> Sometimes, you may wish just to send a message without the detour
> to Notepad++. Permitting this, requires additional code. As would
> returning from Notepad++, cancelling the send, changing a bit within 
> the 40tude Compose window and /then/ send.

Agreed.

> Because 40tude assigns charsets on-the-fly, your saved intermediate
> text file could have /any/ encoding. After loading the text inside
> Notepad++, you may need to adjust the encoding to avoid the creation
> of mixed-encoding texts. 

That's the entire reason why I use notepad++ in the first place!
(Notepad++ has a macro to fix all inconsistent character encoding.)

> It wasn't by accident, that I initially recommended to /not/ pursue
> the approach of calling an external editor by 40tude Dialog script.
> And I /still/ strongly advise you, to leave this matter be...

I would like to experiment with it for a while to see if the dangers 
outweigh the benefits (or vice versa). 

I can't for the life of me figure out how to _combine_ two 
OnBeforeSendingMessage scripts (I've tried every syntax guess 
I could figure out and they all fail).

For now, _that_ is what I will work on because otherwise I'll
never be able to do two things in the OnBeforeSendingMessage task.
Technical Details
Message-ID: <sf6cgf$131m$1@gioia.aioe.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <sevelu$1qrk$1@gioia.aioe.org> <l01qbjvknuqe.dlg@v.nguard.lh> <sf0pg9$16vs$1@gioia.aioe.org> <20210811163605.abc503d2af7b32d36dd31e34@127.0.0.1> <sf12g8$1bn1$1@gioia.aioe.org> <aje23prjgwng.dlg@v.nguard.lh> <sf23af$18a9$1@gioia.aioe.org> <1qaeainv3x9gl$.dlg@b.rose.tmpbox.news.arcor.de> <sf3f6h$k0u$1@gioia.aioe.org> <86lyjunafj21$.dlg@b.rose.tmpbox.news.arcor.de> <70r516k5wr9t$.dlg@v.nguard.lh> <1lo779jiegvl3$.dlg@b.rose.tmpbox.news.arcor.de> <sf4ube$r5v$1@gioia.aioe.org> <an0k6nzbgcqh$.dlg@b.rose.tmpbox.news.arcor.de> <sf668m$408$1@gioia.aioe.org> <uci12ip228kn.dlg@b.rose.tmpbox.news.arcor.de>

Show Full Headers
Complete Article Headers
Message-ID: <sf6cgf$131m$1@gioia.aioe.org>
Subject: Re: [dialog] Can I set dialog to edit in Notepad++
Date: Fri, 13 Aug 2021 20:09:36 +0200
From: bill <bill@spam.invalid>
References: <sevelu$1qrk$1@gioia.aioe.org> <l01qbjvknuqe.dlg@v.nguard.lh> <sf0pg9$16vs$1@gioia.aioe.org> <20210811163605.abc503d2af7b32d36dd31e34@127.0.0.1> <sf12g8$1bn1$1@gioia.aioe.org> <aje23prjgwng.dlg@v.nguard.lh> <sf23af$18a9$1@gioia.aioe.org> <1qaeainv3x9gl$.dlg@b.rose.tmpbox.news.arcor.de> <sf3f6h$k0u$1@gioia.aioe.org> <86lyjunafj21$.dlg@b.rose.tmpbox.news.arcor.de> <70r516k5wr9t$.dlg@v.nguard.lh> <1lo779jiegvl3$.dlg@b.rose.tmpbox.news.arcor.de> <sf4ube$r5v$1@gioia.aioe.org> <an0k6nzbgcqh$.dlg@b.rose.tmpbox.news.arcor.de> <sf668m$408$1@gioia.aioe.org> <uci12ip228kn.dlg@b.rose.tmpbox.news.arcor.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Content-Transfer-Encoding: 7bit
X-Notice: Filtered by postfilter v. 0.9.2
User-Agent: 40tude_Dialog/2.0.15.41 (51e03d8d.9.298)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0
Newsgroups: news.software.readers
Organization: Aioe.org NNTP Server