Re: automate retrieving/sending outlook email via tcl/expect
From: Melissa Schrumpf (reverse-comDOTyahooATm_schrumpf_at_bogus.address)
Date: 03/18/04
- Next message: William J Giddings: "Detecting changes to the clipboard."
- Previous message: Andreas Leitgeb: "MacOS Classic support (finally) gone from CVS *sigh*"
- In reply to: Q X: "automate retrieving/sending outlook email via tcl/expect"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 18 Mar 2004 08:03:29 -0500
Q X wrote:
> Hello All,
> I am looking to automate getting an attachment from particular outlook
> emails (ie. filtered by who the email is from and the subject/contents
> of the email) as they come into my outlook inbox, taking this
> attachment and running a program (automated through Expect for
> windows) and then sending the email back to the person with another
> attachment.
> The reason for this is that I get a lot of emails with attachments.
> With these attachments I need to run a program using these attachments
> and then send an email back to them with another attachment. Is it
> possible to automate the entire process using tcl and expect?
Expect won't do what you want. Expect is for interacting with command-line
(and typically stream-oriented) applications. If you must use Outlook, you
can do pretty much whatever you want with it using Tcom. You could also
access the POP3 or IMAP server directly.
If you are looking for a way to use Tcom (and the COM interface to Outlook), I
have a chunk of code that I use to export entire .PST files to the filesystem,
which can be dredged for the code necessary to read just the INBOX. Once
you've saved a message out to the filesystem, you can use [open] on the file
or the attachments and process them however you like. You'd then need to add
the code for sending a reply, but I imagine it's not all that difficult, if
the script-kiddies can do it in .VBS files. :-)
The one problem with using Outlook -- and I'm not sure which versions require
this, but Outlook XP certainly does -- is security. Or, rather, Microsoft's
miserable attempt at dealing with the lack thereof in Outlook. See, since
script-kiddies _can_ and _do_ use this same interface to send email through
Outlook, MSFT has seen fit to have Outlook complain to you that "Another
application is attempting to access..." etc. You get a pop-up dialog that
asks you whether to allow it or disallow it. If you allow it, you can allow
access for up to 10 minutes.
That means you would have to babysit Outlook, granting access repeatedly. OR,
you would have to write a program to do it for you. I have another snippet of
code that I use to automate simple GUI interactions, and C programs that can
retrieve window ID's, and send Windows events to other programs' windows.
With a bit of fiddling, you can write another routine that will look for the
Outlook "access" window, and "press" the appropriate button. It's quite a bit
of fiddling to go through, and a filthy hack, so if you can access POP or IMAP
directly, I would strongly recommend doing that.
-- MKS
- Next message: William J Giddings: "Detecting changes to the clipboard."
- Previous message: Andreas Leitgeb: "MacOS Classic support (finally) gone from CVS *sigh*"
- In reply to: Q X: "automate retrieving/sending outlook email via tcl/expect"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]