🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
5 messages
5 total messages Started by Copelandia Cyanescens Wed, 04 Aug 2004 16:33
[Dialog] Action Item - notify application?
#152994
Author: Copelandia Cyanescens
Date: Wed, 04 Aug 2004 16:33
27 lines
2644 bytes
The problem in a nut shell... I'd like to automate the downloading of
some software updates. I'm notified of these updates by email.

I wrote a Python script that handles the downloading and installation of
the files just fine, but an hour or so of cursory digging around hasn't
turned up an easy (to me) way to make it fire when my notifications come
in. I'm no Pascal/Dialog guru. ;)

Is there any "down and dirty" way to fire an external application by
watching for a specific email Subject: header? Do I need an
OnEmailChecked event script, or is there some other way like...

 !MagicallyCallApplication(MyScript.py) subject "New Updates"

Yeah right... <grin>

Anyway, I have FileExecute() figured out, and a custom script with a
button in the tool bar that makes the updates a one click deal. I'd
still like to run it automatically though.

A "pseudo script" outline with the proper function names to scan
incoming email Subject: headers would be great, but I could deal with
just some pointers to what functions I need to be looking at too. I
don't mind filling in the blanks and figuring out a few things on my
own, but I'm a bit "lacking" when it comes to Pascal and Dialog
scripting so I don't really know where to begin.
Re: [Dialog] Action Item - notify application?
#153032
Author: Aries
Date: Thu, 05 Aug 2004 08:59
11 lines
1632 bytes
On Wed, 4 Aug 2004 12:33:09 -0400, Copelandia Cyanescens surfed into the
newsgroup from cyberspace:

> Yeah right... <grin>

Copelandia eh?  LOL  

Sorry to hijack your thread particularly as I don't know the answer to your
query. I would just like to say hi from one Copeland to another <grin>

http://www.copelands.plus.com/val/
Re: [Dialog] Action Item - notify application?
#153060
Author: MLC
Date: Thu, 05 Aug 2004 14:33
49 lines
2573 bytes
mercoledì 04/ago/2004 _Copelandia Cyanescens_ in
<news:1qp56uceq0qwd$.dlg@x02x67invalid.net>:

[...]
 
> A "pseudo script" outline with the proper function names to scan
> incoming email Subject: headers would be great, but I could deal with
> just some pointers to what functions I need to be looking at too.

Hi,
if I understand well you might consider to use the OnBeforeSavingMessage
event, checking isEmail and the Subject.
Something of this kind:

program OnBeforeSavingMessage;

function GetMessageSubject(Message: TStringList): string;
var
   i: integer;
begin
  i:=0;
  result:='';
  while i < Message.count-1 do
  begin    
   if pos('Subject:', Message.strings[i])>0 then break;
   i:=i+1;
  end; //while
  result:=Message.strings[i]; 
end;

procedure OnBeforeSavingMessage(var Message: TStringlist; 
   Servername: string; IsEmail: boolean);
var
  s: string;
begin
  if IsEmail then 
  begin
   s:=GetMessageSubject(Message);
   if s:='***' then  //change the *** with your Subject
    FileExecute(0,'***','open','','',1,5);//change the *** with your program
  end;
end;

begin
end. 

HTH
-- 
Maria Luisa C - 05/08/2004 16.16.06
Re: [Dialog] Action Item - notify application?
#153074
Author: Copelandia Cyanescens
Date: Thu, 05 Aug 2004 18:30
34 lines
2524 bytes
MLC wrote...

> if I understand well you might consider to use the OnBeforeSavingMessage

<snip>

My eternal gratitude! 

I was so fixated on trying to figure out the script itself I completely
overlooked the OnBeforeSavingMessage event, and the script was *exactly*
what I needed. It all becomes so clear now. ;) 

FWIW, aside from plugging in my literals, there was one minor correction
that needed to be made...

if s:='***' then  //change the *** with your Subject

should be...

if s='***' then  //change the *** with your Subject

Being a "C guy" who took just a little bit of Pascal in college, I've
made a somewhat similar mistake by confusing := and ==. ;)

Anyway, once again I have to say many, many thanks...

-- 
"Researchers have discovered that chocolate produces some of the
same reactions in the brain as marijuana. The researchers also
discovered other similarities between the two, but can't remember
what they are."

                                                    -- Matt Lauer
Re: [Dialog] Action Item - notify application?
#153078
Author: MLC
Date: Thu, 05 Aug 2004 19:54
21 lines
2027 bytes
giovedì 05/ago/2004 _Copelandia Cyanescens_ in
<news:153t32d5gms7p$.dlg@x02x67invalid.net>:

> if s:='***' then  //change the *** with your Subject
> 
> should be...
> 
> if s='***' then  //change the *** with your Subject

Oops, you're right: one of my careless mistakes... ;-)

> 
> Being a "C guy" who took just a little bit of Pascal in college, I've
> made a somewhat similar mistake by confusing := and ==. ;)
> 
> Anyway, once again I have to say many, many thanks...

NP. Happy to have helped somewhat. :-)

-- 
Maria Luisa C - 05/08/2004 21.48.14
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