Article View: news.software.readers
Article #261676Re: Request help with 40tude dialog program syntax
From: JJ
Date: Sat, 07 Jan 2017 21:00
Date: Sat, 07 Jan 2017 21:00
109 lines
6483 bytes
6483 bytes
On Fri, 6 Jan 2017 22:35:25 +0000 (UTC), Stijn De Jong wrote:
> b. I couldn't add certain headers (e.g., NNTP-Posting-Host).
> (I suspect that's an NNTP RFC spec that prevents that from working)
That's correct. The server may also place additional restrictions on which
headers and their contents. e.g. the email in the "From" header must match
with the email used to register an account from a newsgroups provider.
> c. I couldn't get a WriteLn(Add_Header) to write to the message window.
> (The WriteToLog worked but it wrote to the log file instead.)
This is a technical problem which is not well explained in Dialog's
"Scripting" documentation page. There's a line that says "Only available in
script called from the main GUI thread for thread safety" which refers to
the `Application`, `Screen`, `Timer1`, and `Timer2` global variables, but
actually, the WriteLn() function is one of them too. i.e. they are usable
from the main thread, and the OnBeforeSendingMessage, OnBeforeSavingMessage,
etc., are executed from a (separate) worker thread, which isn't the main
thread.
> So are you saying that, functionally, these two command are, in effect,
> exactly the same functionality?
> A. if (StrMatch (newsgroup, 'news.software.readers') or
> StrMatch (newsgroup, 'alt.free.newsservers')) then
> result := 'id1'
> B. if StrMatch(newsgroup, 'news.software.readers') then
> result := 'id1'
>
> Is it that both A & B above will only set the result to "id1" if
> "news.software.readers" is the first newsgroup in the outgoing Newsgroups:
> header?
[A] and [B] are different because [A] has two conditions to check, and [B]
only has one.
[A] will set the result to "id1" if the first newsgroup in the Newsgroups
header is "news.software.readers" or "alt.free.newsservers".
[B] will set the result to "id1" if the first newsgroup in the Newsgroups
header is "news.software.readers".
> Asked another way, are you saying that only the first outgoing header line
> below will be matched by either of the two commands above?
> Newsgroups: news.software.readers,alt.free.newsservers
> Newsgroups: alt.free.newsservers,news.software.readers
[A] will set the result to "id1" for Newsgroups header #1 and #2.
First StrMatch() matches header #1, and second StrMatch() matches header#2.
[B] will set the result to "id1" for Newsgroups header #1.
Here's some simpler examples for the basic of StrMatch().
These will return `true`:
StrMatch('abc', 'abc') //"abc" is at start of "abc"
StrMatch('abc', 'ab') //"ab" is at start of "abc"
StrMatch('abc', 'a') //"a" is at start of "abc"
These will return `false`:
StrMatch('abc', 'abcd') //"abcd" is not at start of "abc"
StrMatch('abc', 'bc') //"bc" is not at start of "abc"
StrMatch('abc', 'b') //"b" is not at start of "abc"
StrMatch('abc', 'c') //"c" is not at start of "abc"
> I just added your new "string contains" function, and a call to it as
> follows. If this post works, then the vignette below worked.
[snip]
> if StrContains(newsgroup, 'news.software.readers') or
> StrContains(newsgroup, 'alt.free.newssservers') then
> result := 'id1'
> else if StrMatch(newsgroup, 'alt.comp.os.windows-10') then
> result := 'id2'
> else if StrMatch(newsgroup, 'alt.os.linux') then
> result := 'id3'
> else
> result := '';
The first if-then statement (or command) would work as expected, but the
second and the third ones may fail if a message is posted to multiple
newsgroups because they still use the StrMatch() function. i.e.
This won't to set the result to "id2" if the Newsgroups header is
"Newsgroups: news.software.readers,alt.comp.os.windows-10".
It will only set the result if the header is
"Newsgroups: alt.comp.os.windows-10,news.software.readers".
//...
else if StrMatch(newsgroup, 'alt.comp.os.windows-10') then
result := 'id2'
//...
And this won't to set the result to "id3" if the Newsgroups header is
"Newsgroups: alt.comp.os.windows-10,alt.os.linux".
It will only set the result if the header is
"Newsgroups: alt.os.linux,alt.comp.os.windows-10".
//...
else if StrMatch(newsgroup, 'alt.os.linux') then
result := 'id3'
//...
PS) The scripting language used by Dialog is Delphi which is based on the
Pascal programming language. You can use Free Pascal Compiler (FPC)
documentations if you have any interest on understanding the Pascal
programming language. You can also ask Pascal/Delphi related question to
comp.lang.pascal.delphi.misc.
Technical Details
Message-ID:
<2nmhjmd7yn5z.7aee9qvl2s4h.dlg@40tude.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mailReferences:
<o491jh$7jr$1@gioia.aioe.org> <o4926s$933$1@gioia.aioe.org> <o492qg$a9k$1@gioia.aioe.org> <1ibo1gzmbqy5b.33119bupvh2q.dlg@40tude.net> <o4h57j$hhe$6@news.mixmin.net> <o4jr33$u80$1@news.mixmin.net> <7vpx5y09pu98.1sukl5d600sda$.dlg@40tude.net> <o4mllr$1tes$1@gioia.aioe.org> <o4mmls$1ufs$1@gioia.aioe.org> <o4mp2u$1mp$1@gioia.aioe.org> <o4mqdl$3dn$1@gioia.aioe.org> <18a15xlqpx8bu$.p7s6f5qnpimv$.dlg@40tude.net> <o4p63d$1jiv$1@gioia.aioe.org>Show Full Headers
Complete Article Headers
Message-ID: <2nmhjmd7yn5z.7aee9qvl2s4h.dlg@40tude.net>
Subject: Re: Request help with 40tude dialog program syntax
Date: Sun, 8 Jan 2017 04:00:31 +0700
From: JJ <jj4public@vfemail.net>
References: <o491jh$7jr$1@gioia.aioe.org> <o4926s$933$1@gioia.aioe.org> <o492qg$a9k$1@gioia.aioe.org> <1ibo1gzmbqy5b.33119bupvh2q.dlg@40tude.net> <o4h57j$hhe$6@news.mixmin.net> <o4jr33$u80$1@news.mixmin.net> <7vpx5y09pu98.1sukl5d600sda$.dlg@40tude.net> <o4mllr$1tes$1@gioia.aioe.org> <o4mmls$1ufs$1@gioia.aioe.org> <o4mp2u$1mp$1@gioia.aioe.org> <o4mqdl$3dn$1@gioia.aioe.org> <18a15xlqpx8bu$.p7s6f5qnpimv$.dlg@40tude.net> <o4p63d$1jiv$1@gioia.aioe.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mail
Newsgroups: news.software.readers,alt.windows7.general,alt.os.linux
Lines: 109
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.albasani.net GgJ3p0uqvSxykBNAc4hBdLChkvX4qZb1RXQT8WNWW9iLL2CvJnj+JpQn5ZNZbqglMJ95V6zTBiXtuvpbAX11UT8dnuOPaU0tJVMLz3gzWjjBjRmHXD1+472gYJf0aCJx
NNTP-Posting-Date: Sat, 7 Jan 2017 21:00:32 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="WOEufWBdqU9FOEr+OnM4D4rV7RAeHI3QzPPu1UXKak3JyqaS80a+rg67FCw2cxDhMnFyDFVnnklVpVB5YvLYCaXvvVotriqJlYpjDe2GbRKwGqZ+y2/zUxeONrqKb65p"; mail-complaints-to="abuse@albasani.net"
User-Agent: 40tude_Dialog/2.0.15.84
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
Cancel-Lock: sha1:kpMb+28xLgq/QbVzbuEaf5K/LSI=
X-Received-Body-CRC: 2015641713
X-Received-Bytes: 6397