in reply to Win32::OLE and outlook

SUSSED IT......(sort of!)
For some strange reason I can't pattern match for \r's with this string. However I've split it to an array, and printed that to the file to get around it.
Thanks anyway!

Replies are listed 'Best First'.
Re: Re: Win32::OLE and outlook
by mikeB (Friar) on Jun 29, 2001 at 18:13 UTC
    Congratulations on solving it yourself! I'm glad to see you continued to work through your problem after posting it here.
Re: Re: Win32::OLE and outlook
by Foggy Bottoms (Monk) on Jun 20, 2003 at 08:48 UTC
    I noticed you worked on Outlook & OLE (quite a long time ago) - I'm currently working on that too and I'd like to get your insights on the whole thing :
         I want to find out whether there's an active email open and how to retrieve the text from that email. Note that since it's a new mail, it is highly unlikely that it's been saved.

    I did the same with Word and Excel easily enough (even though I must admit I did have a bit a trouble there as well) but it seems to me Outlook is not as easy.
         Please let me know if you come across anything that could be helpful.

    Thanks, David.

    Heureux qui, comme Ulysse, a fait un beau voyage
    Ou comme celui-là qui conquit la Toison,
    Et puis est retourné plein d'usage et raison,
    Vivre entre ses parents le reste de son âge!

    J. du Bellay, poëte angevin

      Any time you have an Outlook item open in a separate window, it's in an Inspector.

      What I would do in this case is get the list of all the Inspectors, filter out the ones that aren't open on a Mail item, and then, if necessary, apply further filtering on the contents of the item. For example:
      use Win32::OLE; use Win32::OLE::Const '.*Outlook'; # load the relevant constants my $ol = new Win32::OLE 'Outlook.Application'; my $inspectors = $ol->Inspectors; my @inspectors = Win32::OLE::Enum->new( $inspectors )->All; my @mail_items = grep { $_->Class == olMail } map { $_->CurrentItem } # get the MailItem object @inspectors;
      You could, perhaps, try to rely on the fact that for a brand spanking new mail message, the Inspector has a caption (that is, its window has a title) of Untitled - Message (Plain Text)
      my @mail_items = grep { $_->Class == olMail } map { $_->CurrentItem } # get the MailItem object grep { $_->Caption eq 'Untitled - Message (Plain Text)' } @inspectors;
      Once you've found the element in @mail_items which is the one you want, you can extract its body text with the Body method, of course.

      jdporter
      The 6th Rule of Perl Club is -- There is no Rule #6.