Thread View: news.software.readers
5 messages
5 total messages
Started by Ernie Ramaker
Mon, 27 Oct 2003 23:46
[Dialog] Scripting question
Author: Ernie Ramaker
Date: Mon, 27 Oct 2003 23:46
Date: Mon, 27 Oct 2003 23:46
16 lines
1649 bytes
1649 bytes
I have this script to add a Distribution-header to outgoing messages: program OnBeforeSendingMessage; function OnBeforeSendingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean):boolean; begin message.insert (1, 'Distribution: world'); end; begin end. Now, if I wanted to check which newsgroup the message is sent to, and then only add the header if that group is "foo.bar", how would I go about doing that?
Re: [Dialog] Scripting question
Author: Jarrod Cifer
Date: Tue, 28 Oct 2003 04:54
Date: Tue, 28 Oct 2003 04:54
13 lines
1966 bytes
1966 bytes
Ernie Ramaker, upon reaching Nirvana, postulated: > Now, if I wanted to check which newsgroup the message is sent to, and > then only add the header if that group is "foo.bar", how would I go > about doing that? I'm not a scripting expert, but you might want to take a look at http://40tude.com/dialog/wiki/index.php/JustifyMessage The script contains the function you're looking for and you should be able to extract it for your own use. -- J. Cifer
Re: [Dialog] Scripting question
Author: matija
Date: Tue, 28 Oct 2003 07:26
Date: Tue, 28 Oct 2003 07:26
42 lines
2642 bytes
2642 bytes
Ernie Ramaker, completely geschtonkenflapped, wrote:
> Now, if I wanted to check which newsgroup the message is sent to, and
> then only add the header if that group is "foo.bar", how would I go
> about doing that?
program OnBeforeSendingMessage;
const cNewsgroups = 'Newsgroups: ';
cGroup = 'foo.bar';
cDistribution = 'Distribution: world';
function OnBeforeSendingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean):boolean;
var i : integer;
begin
for i := 0 to message.count-1 do
begin
if copy(message.strings[i], 1, length(cNewsgroups)) = cNewsgroups then
begin
if pos(cGroup, message.strings[i]) > 0 then
begin
message.insert (1, cDistribution);
break;
end;
end;
end;
end;
begin
end.
of course, this won't work properly if you're posting to a
group called 'megafoo.bar' :)
(all possible typos and compile errors are due to the fact that
i woke up a couple of minutes ago.)
--
there is a cheer. the gnomes have learned a new way to say hooray. [-shpongle]
address is scrambled - remove SPAMISEVIL to reply
Re: [Dialog] Scripting question
Author: Ernie Ramaker
Date: Tue, 28 Oct 2003 09:41
Date: Tue, 28 Oct 2003 09:41
6 lines
1423 bytes
1423 bytes
matija: > (all possible typos and compile errors are due to the fact that > i woke up a couple of minutes ago.) Thanks, Matija! It works perfectly.
Re: [Dialog] Scripting question
Author: matija
Date: Tue, 28 Oct 2003 11:21
Date: Tue, 28 Oct 2003 11:21
15 lines
2036 bytes
2036 bytes
Ernie Ramaker, completely geschtonkenflapped, wrote:
>> (all possible typos and compile errors are due to the fact that
>> i woke up a couple of minutes ago.)
>
> Thanks, Matija! It works perfectly.
sometimes i scare myself. if i'm able to make a working piece
of code exactly four and a half minutes after being violently
woken up from my sleep, well...
--
there is a cheer. the gnomes have learned a new way to say hooray. [-shpongle]
address is scrambled - remove SPAMISEVIL to reply
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