Loading ...
Sorry, an error occurred while loading the content.

Outlook Email Filter

Expand Messages
  • Eric
    use Win32; use Win32::OLE; use Win32::GuiTest; use Win32::Clipboard; ###################################################################### # EMAIL FILTER -
    Message 1 of 3 , Jun 11, 2004
    • 0 Attachment
      use Win32;
      use Win32::OLE;
      use Win32::GuiTest;
      use Win32::Clipboard;

      ######################################################################
      # EMAIL FILTER - for Microsoft Outlook.
      #
      # This script reads in an input text file "EmailList.txt" to build a
      # program array of recognized email addresses, recognized domains, and
      # recognized partial email addresses to compare to email addresses
      # found within all email message's ...
      #
      # INTERNET HEADERS
      #
      # Then it moves each email message to 1 of 3 user-defined folders
      # based upon the findings of the comparison.
      #
      # This script uses the Win32::Guitest module to automate the task of
      # accessing the internet header via the Outlook "Message Options"
      # Dialogbox. Each email message is focused upon (in turn) and a series
      # of keystrokes sent to open the "Message Options" Dialogbox, and to
      # copy the internet header to the Windows Clipboard for pasting into
      # a variable within this program for its inspection.
      #
      # This script DOES NOT use any form of CDO
      # (Collaboration Data Objects).
      #
      # This script DOES NOT cause the Outlook Security Window to popup,
      # hence there is no code needed to deal with that issue.
      #####################################################################
      # The input text file should be placed in the same directory as this
      # perl script or this compiled perl program. That can be on a local
      # machine or network file server. On our network (a Windows 2000
      # Professional, 5 person, peer-to-peer network), each person has a
      # desktop shortcut pointing to this compiled script, and one pointing
      # to the input text file, so each can easily add, modify, or delete
      # email address entries from the list of recognized email addresses,
      # at will. This text file is maintained using the "Notepad" text file
      # editor.
      #
      # Example records/lines in the input text file of recogized addresses
      #
      # Lynn,Golf Channel News,thegolfchannel.com
      # Lynn,Morningstar,@...
      #
      # Eric,Cat Rescue Group,kitticocat@...
      # Eric,Perl Win32 Gui Users Group,perl-win32-gui-users
      # Eric,Political Action Group,@...
      #
      # Amerwood,Maersk Group,@...
      # Amerwood,Crescent Transport Group,@...
      #
      # Where records(lines) have 3 fields each, which are comma delimited
      # (or comma separated). Blank lines may be used for spacing of
      # entries.
      #
      # First 2 fields are for identification use only and are not
      # used by this script. Last field (i.e. field 3) is the recognized
      # address used by this perl script, and read into the program
      # array.
      #
      # We use the first field to identify these email addresses as either
      # a specific individual's list (e.g. Eric, Lynn), or the Companywide
      # list (e.g. Amerwood). This is useful in maintaining the
      # EmailList.txt input text file. All addresses in the input text
      # file are considered "Recognized" for all persons using this input
      # text file on the network.
      ####################################################################
      # Each person in our company has Outlook pull down their own
      # personal internet email account and the company email account to
      # their computer Inbox.
      #
      # Account amerwood@... goes to the Amerwood folder and
      # Account someone.amerwood@... goes to the AmerwoodMe
      # folder.
      #
      # Everyone on the Network has these same generic folder names setup.
      #
      # We use Outlook's Rules Wizard to move incoming Inbox email to
      # either the Amerwood or AmerwoodMe directories. But we use an
      # exclusion rule saying that if the email is from someone within the
      # company ...
      #
      # amerwood@... or all someones.amerwood@...
      #
      # then, leave the email in the Inbox.
      #
      # This is a necessity for this script to work correctly. If we
      # didn't do this, then all the email sent to us from someone within
      # the company would filter down to the UnRecognized folders. And
      # there is another important reason. Should someone place one of
      # their own sent emails into the Amerwood or AmerwoodMe folders,
      # that would cause this script to blow because your sent emails do
      # not have an internet header. That causes a change in the TAB
      # sequence on the Outlook Message Options Dialogbox which would
      # throw the script off course onto a wild tangent.
      ####################################################################
      # After a user retrieves their email, they can run this script
      # to automatically place messages from these 2 folders down to 1 of
      # 3 subfolders (Recognized, UnRecognized, and JunkMail).
      #
      # Where:
      #
      # Recognized = emails that contain a recognized email address
      # within the internet header. These are from
      # your friends and other contacts. Good email!!
      #
      # UnRecognized = emails which do not contain a recognized email
      # address within the internet header, but they
      # were at least sent to amerwood@...
      # or someone.amerwood@.... This would be
      # emails sent to you by people you know, but you
      # have yet to record them in the EmailList.txt
      # file. And it would include emails sent to you
      # by people you don't know who have your email
      # address. You might want to look at them
      # however.
      #
      # JunkMail = Anything not meeting the 2 above. This might
      # include any emails you receive inwhich you
      # are on someone's Group, or SPAM email
      # distribution list, where your individual email
      # address is not listed in the internet header.
      # If you like being on a certain group distri-
      # bution list, and want those emails to go to
      # the recognized folder, be sure to place the
      # address in the EmailList.txt file. An example
      # might be: maillist1@....
      #
      # No emails will remain in the Amerwood and AmerwoodMe folders after
      # this script is run. This lets you easily see if the script has not
      # been run.
      ####################################################################
      # Recommended that you disable all auto Send/Receive settings in
      # Outlook so you must manually press Send/Receive. This may prevent
      # possible conflicts from arising during the execution of this
      # script should auto Send/Receive initiate. Also a good idea to
      # close or at least minimize other desktop applications which are
      # running before running this script. Also, once the script is
      # running, it is necessary to avoid touching the keyboard or moving
      # the mouse since this can interfere with the proper execution of
      # this script, causing the script to possibly go off on a wild
      # tangent.
      ####################################################################
      # Turn down your speakers to avoid the annoying "ding ding" ringing.
      ####################################################################
      $PWD=Win32::GetCwd or die;
      $file="$PWD\\EmailList.txt";
      if (! -s $file) {die;}
      open(MailList,"< $file") or die;

      @emailaddrs=();
      $i=0;

      while(<MailList>) {
      chomp;
      $line=$_;
      @fields=();
      @fields=split(/,/,$line);
      $field2=$fields[2];
      $field2=~s/ //g;
      if ($field2 eq "") {
      next;
      }

      #-- If somebody put amerwood@... or
      #-- someone.amerwood@... in our input text file, we need
      #-- to exclude from our array of valid sender email addresses
      #-- since we handle this another way.

      if ($field2 =~ /amerwood\@charter\.net/) {
      next;
      }

      $field2=~s/\-/\\\-/g; #-- literal backslash before dashes
      $field2=~s/\_/\\\_/g; #-- literal backslash before underscores
      $field2=~s/\@/\\\@/g; #-- literal backslash before ampersands
      $field2=~s/\./\\\./g; #-- literal backslash before periods

      $field2=lc($field2); #-- convert to lowercase
      $emailaddrs[$i]=$field2;
      $i++;
      }
      $i--;
      close(MailList);

      ##################################################################

      $OL = Win32::OLE->new('Outlook.Application') or die;
      #-- starts a new instance of Outlook

      $NameSpace = $OL->GetNameSpace("MAPI") or die;
      $Contacts = $NameSpace->GetDefaultFolder(10) or die;
      $Root = $Contacts->Parent or die;

      $Amerwood = $Root->Folders("Amerwood") or die;
      $AmerwoodEX = $Amerwood->GetExplorer or die;
      $AmerwoodRec = $Amerwood->Folders("Recognized") or die;
      $AmerwoodUnRec = $Amerwood->Folders("UnRecognized") or die;
      $AmerwoodJunk = $Amerwood->Folders("JunkMail") or die;

      $AmerwoodMe = $Root->Folders("AmerwoodMe") or die;
      $AmerwoodMeEX = $AmerwoodMe->GetExplorer or die;
      $AmerwoodMeRec = $AmerwoodMe->Folders("Recognized") or die;
      $AmerwoodMeUnRec = $AmerwoodMe->Folders("UnRecognized") or die;
      $AmerwoodMeJunk = $AmerwoodMe->Folders("JunkMail") or die;

      $Clip = Win32::Clipboard or die;

      #################################################################

      $AmerwoodEX->Activate; #-- display the Amerwood folder
      if ($AmerwoodEX->IsPaneVisible(3)) {
      Win32::GuiTest::SendKeys("%Vn"); #-- close preview pane
      }
      Win32::GuiTest::SendKeys("{END}"); #-- focus on last messager
      $cnt=$Amerwood->Items->Count; #-- how many messages

      while ($cnt > 0) {
      $Clip->Empty; # initialize clipboard to empty

      Win32::GuiTest::SendKeys("{APP} {UP} {ENTER}");
      #-- opens message options dialog

      Win32::GuiTest::SendKeys("{TAB 6}");
      #-- moves down to internet header

      Win32::GuiTest::SendKeys("{APP} {DOWN 2} {ENTER}");
      #-- puts internet header in clipboard

      Win32::GuiTest::SendKeys("{TAB}");
      #-- moves to Cancel Button

      Win32::GuiTest::SendKeys("{ENTER}");
      #-- closes message options dialog

      $found = 0;

      undef $text;
      $text=$Clip->Get; #-- get clipboard contents
      $text=lc($text); #-- convert to lowercase is necessary

      for($j=0;$j<=$i;$j++) {
      $emailaddr=$emailaddrs[$j];
      if ($text =~ /$emailaddr/) {
      $found=1;
      last;
      }
      }

      undef $Sel;
      $Sel = $AmerwoodEX->Selection;
      #-- only one message will be selected at a time

      if ($found) {
      $Sel->Item(1)->Move($AmerwoodRec);
      } else {
      if ($text =~ /amerwood\@charter\.net/) {
      $Sel->Item(1)->Move($AmerwoodUnRec);
      } else {
      $Sel->Item(1)->Move($AmerwoodJunk);
      }
      }

      $cnt--;
      }

      $AmerwoodEX->Close;

      ###################################################################

      $AmerwoodMeEX->Activate; #-- displays the AmerwoodMe folder
      if ($AmerwoodMeEX->IsPaneVisible(3)) {
      Win32::GuiTest::SendKeys("%Vn"); #-- must close preview pane
      }
      Win32::GuiTest::SendKeys("{END}"); #-- focus on last message
      $cnt=$AmerwoodMe->Items->Count; #-- how many messages

      while ($cnt > 0) {
      $Clip->Empty;

      Win32::GuiTest::SendKeys("{APP} {UP} {ENTER}");
      #-- opens message options dialog

      Win32::GuiTest::SendKeys("{TAB 6}");
      #-- moves down to internet header

      Win32::GuiTest::SendKeys("{APP} {DOWN 2} {ENTER}");
      #-- puts internet header in clipboard

      Win32::GuiTest::SendKeys("{TAB}");
      #-- moves to Cancel Button

      Win32::GuiTest::SendKeys("{ENTER}");
      #-- closes message options dialog

      $found = 0;

      undef $text;
      $text=$Clip->Get; #-- get clipboard contents
      $text=lc($text); #-- convert to lowercase is necessary

      for($j=0;$j<=$i;$j++) {
      $emailaddr=$emailaddrs[$j];
      if ($text =~ /$emailaddr/) {
      $found=1;
      last;
      }
      }

      undef $Sel;
      $Sel = $AmerwoodMeEX->Selection;
      #-- only one message will be selected at a time

      if ($found) {
      $Sel->Item(1)->Move($AmerwoodMeRec);
      } else {
      if ($text =~ /amerwood\@charter\.net/) {
      $Sel->Item(1)->Move($AmerwoodMeUnRec);
      } else {
      $Sel->Item(1)->Move($AmerwoodMeJunk);
      }
      }

      $cnt--;
      }

      $AmerwoodMeEX->Close;

      ###################################################################

      #-- end script
    • Dennis K. Paulsen
      Hello Eric, Should I assume that you are providing this script simply as a potential example, or was there a question? Also, I m not getting a feel for why
      Message 2 of 3 , Jun 13, 2004
      • 0 Attachment
        Hello Eric,
        Should I assume that you are providing this script simply as a
        potential example, or was there a question? Also, I'm not getting a
        feel for why simple Outlook message rules can't be used
        exclusively. :-?

        Regards.


        --- In perlguitest@yahoogroups.com, "Eric" <eric_hansen85@y...>
        wrote:
        > use Win32;
        > use Win32::OLE;
        > use Win32::GuiTest;
        > use Win32::Clipboard;
        >
        >
        #####################################################################
        #
        > # EMAIL FILTER - for Microsoft Outlook.
        > #
        > # This script reads in an input text file "EmailList.txt" to build
        a
        > # program array of recognized email addresses, recognized domains,
        and
        > # recognized partial email addresses to compare to email addresses
        > # found within all email message's ...
        > #
        > # INTERNET HEADERS
        > #
        > # Then it moves each email message to 1 of 3 user-defined folders
        > # based upon the findings of the comparison.
        > #
        > # This script uses the Win32::Guitest module to automate the task
        of
        > # accessing the internet header via the Outlook "Message Options"
        > # Dialogbox. Each email message is focused upon (in turn) and a
        series
        > # of keystrokes sent to open the "Message Options" Dialogbox, and
        to
        > # copy the internet header to the Windows Clipboard for pasting
        into
        > # a variable within this program for its inspection.
        > #
        > # This script DOES NOT use any form of CDO
        > # (Collaboration Data Objects).
        > #
        > # This script DOES NOT cause the Outlook Security Window to popup,
        > # hence there is no code needed to deal with that issue.
        >
        #####################################################################
        > # The input text file should be placed in the same directory as
        this
        > # perl script or this compiled perl program. That can be on a
        local
        > # machine or network file server. On our network (a Windows 2000
        > # Professional, 5 person, peer-to-peer network), each person has a
        > # desktop shortcut pointing to this compiled script, and one
        pointing
        > # to the input text file, so each can easily add, modify, or
        delete
        > # email address entries from the list of recognized email
        addresses,
        > # at will. This text file is maintained using the "Notepad" text
        file
        > # editor.
        > #
        > # Example records/lines in the input text file of recogized
        addresses
        > #
        > # Lynn,Golf Channel News,thegolfchannel.com
        > # Lynn,Morningstar,@m...
        > #
        > # Eric,Cat Rescue Group,kitticocat@a...
        > # Eric,Perl Win32 Gui Users Group,perl-win32-gui-users
        > # Eric,Political Action Group,@m...
        > #
        > # Amerwood,Maersk Group,@m...
        > # Amerwood,Crescent Transport Group,@c...
        > #
        > # Where records(lines) have 3 fields each, which are comma
        delimited
        > # (or comma separated). Blank lines may be used for spacing of
        > # entries.
        > #
        > # First 2 fields are for identification use only and are not
        > # used by this script. Last field (i.e. field 3) is the recognized
        > # address used by this perl script, and read into the program
        > # array.
        > #
        > # We use the first field to identify these email addresses as
        either
        > # a specific individual's list (e.g. Eric, Lynn), or the
        Companywide
        > # list (e.g. Amerwood). This is useful in maintaining the
        > # EmailList.txt input text file. All addresses in the input text
        > # file are considered "Recognized" for all persons using this
        input
        > # text file on the network.
        >
        ####################################################################
        > # Each person in our company has Outlook pull down their own
        > # personal internet email account and the company email account to
        > # their computer Inbox.
        > #
        > # Account amerwood@c... goes to the Amerwood folder and
        > # Account someone.amerwood@c... goes to the AmerwoodMe
        > # folder.
        > #
        > # Everyone on the Network has these same generic folder names
        setup.
        > #
        > # We use Outlook's Rules Wizard to move incoming Inbox email to
        > # either the Amerwood or AmerwoodMe directories. But we use an
        > # exclusion rule saying that if the email is from someone within
        the
        > # company ...
        > #
        > # amerwood@c... or all someones.amerwood@c...
        > #
        > # then, leave the email in the Inbox.
        > #
        > # This is a necessity for this script to work correctly. If we
        > # didn't do this, then all the email sent to us from someone
        within
        > # the company would filter down to the UnRecognized folders. And
        > # there is another important reason. Should someone place one of
        > # their own sent emails into the Amerwood or AmerwoodMe folders,
        > # that would cause this script to blow because your sent emails do
        > # not have an internet header. That causes a change in the TAB
        > # sequence on the Outlook Message Options Dialogbox which would
        > # throw the script off course onto a wild tangent.
        >
        ####################################################################
        > # After a user retrieves their email, they can run this script
        > # to automatically place messages from these 2 folders down to 1 of
        > # 3 subfolders (Recognized, UnRecognized, and JunkMail).
        > #
        > # Where:
        > #
        > # Recognized = emails that contain a recognized email
        address
        > # within the internet header. These are from
        > # your friends and other contacts. Good email!!
        > #
        > # UnRecognized = emails which do not contain a recognized
        email
        > # address within the internet header, but they
        > # were at least sent to amerwood@c...
        > # or someone.amerwood@c... This would be
        > # emails sent to you by people you know, but
        you
        > # have yet to record them in the EmailList.txt
        > # file. And it would include emails sent to you
        > # by people you don't know who have your email
        > # address. You might want to look at them
        > # however.
        > #
        > # JunkMail = Anything not meeting the 2 above. This might
        > # include any emails you receive inwhich you
        > # are on someone's Group, or SPAM email
        > # distribution list, where your individual
        email
        > # address is not listed in the internet header.
        > # If you like being on a certain group distri-
        > # bution list, and want those emails to go to
        > # the recognized folder, be sure to place the
        > # address in the EmailList.txt file. An example
        > # might be: maillist1@t...
        > #
        > # No emails will remain in the Amerwood and AmerwoodMe folders
        after
        > # this script is run. This lets you easily see if the script has
        not
        > # been run.
        >
        ####################################################################
        > # Recommended that you disable all auto Send/Receive settings in
        > # Outlook so you must manually press Send/Receive. This may
        prevent
        > # possible conflicts from arising during the execution of this
        > # script should auto Send/Receive initiate. Also a good idea to
        > # close or at least minimize other desktop applications which are
        > # running before running this script. Also, once the script is
        > # running, it is necessary to avoid touching the keyboard or moving
        > # the mouse since this can interfere with the proper execution of
        > # this script, causing the script to possibly go off on a wild
        > # tangent.
        >
        ####################################################################
        > # Turn down your speakers to avoid the annoying "ding ding"
        ringing.
        >
        ####################################################################
        > $PWD=Win32::GetCwd or die;
        > $file="$PWD\\EmailList.txt";
        > if (! -s $file) {die;}
        > open(MailList,"< $file") or die;
        >
        > @emailaddrs=();
        > $i=0;
        >
        > while(<MailList>) {
        > chomp;
        > $line=$_;
        > @fields=();
        > @fields=split(/,/,$line);
        > $field2=$fields[2];
        > $field2=~s/ //g;
        > if ($field2 eq "") {
        > next;
        > }
        >
        > #-- If somebody put amerwood@c... or
        > #-- someone.amerwood@c... in our input text file, we need
        > #-- to exclude from our array of valid sender email addresses
        > #-- since we handle this another way.
        >
        > if ($field2 =~ /amerwood\@charter\.net/) {
        > next;
        > }
        >
        > $field2=~s/\-/\\\-/g; #-- literal backslash before dashes
        > $field2=~s/\_/\\\_/g; #-- literal backslash before underscores
        > $field2=~s/\@/\\\@/g; #-- literal backslash before ampersands
        > $field2=~s/\./\\\./g; #-- literal backslash before periods
        >
        > $field2=lc($field2); #-- convert to lowercase
        > $emailaddrs[$i]=$field2;
        > $i++;
        > }
        > $i--;
        > close(MailList);
        >
        > ##################################################################
        >
        > $OL = Win32::OLE->new('Outlook.Application') or die;
        > #-- starts a new instance of Outlook
        >
        > $NameSpace = $OL->GetNameSpace("MAPI") or die;
        > $Contacts = $NameSpace->GetDefaultFolder(10) or die;
        > $Root = $Contacts->Parent or
        die;
        >
        > $Amerwood = $Root->Folders("Amerwood") or die;
        > $AmerwoodEX = $Amerwood->GetExplorer or die;
        > $AmerwoodRec = $Amerwood->Folders("Recognized") or die;
        > $AmerwoodUnRec = $Amerwood->Folders("UnRecognized") or die;
        > $AmerwoodJunk = $Amerwood->Folders("JunkMail") or die;
        >
        > $AmerwoodMe = $Root->Folders("AmerwoodMe") or die;
        > $AmerwoodMeEX = $AmerwoodMe->GetExplorer or die;
        > $AmerwoodMeRec = $AmerwoodMe->Folders("Recognized") or die;
        > $AmerwoodMeUnRec = $AmerwoodMe->Folders("UnRecognized") or die;
        > $AmerwoodMeJunk = $AmerwoodMe->Folders("JunkMail") or die;
        >
        > $Clip = Win32::Clipboard or die;
        >
        > #################################################################
        >
        > $AmerwoodEX->Activate; #-- display the Amerwood folder
        > if ($AmerwoodEX->IsPaneVisible(3)) {
        > Win32::GuiTest::SendKeys("%Vn"); #-- close preview pane
        > }
        > Win32::GuiTest::SendKeys("{END}"); #-- focus on last messager
        > $cnt=$Amerwood->Items->Count; #-- how many messages
        >
        > while ($cnt > 0) {
        > $Clip->Empty; # initialize clipboard to empty
        >
        > Win32::GuiTest::SendKeys("{APP} {UP} {ENTER}");
        > #-- opens message options dialog
        >
        > Win32::GuiTest::SendKeys("{TAB 6}");
        > #-- moves down to internet header
        >
        > Win32::GuiTest::SendKeys("{APP} {DOWN 2} {ENTER}");
        > #-- puts internet header in clipboard
        >
        > Win32::GuiTest::SendKeys("{TAB}");
        > #-- moves to Cancel Button
        >
        > Win32::GuiTest::SendKeys("{ENTER}");
        > #-- closes message options dialog
        >
        > $found = 0;
        >
        > undef $text;
        > $text=$Clip->Get; #-- get clipboard contents
        > $text=lc($text); #-- convert to lowercase is necessary
        >
        > for($j=0;$j<=$i;$j++) {
        > $emailaddr=$emailaddrs[$j];
        > if ($text =~ /$emailaddr/) {
        > $found=1;
        > last;
        > }
        > }
        >
        > undef $Sel;
        > $Sel = $AmerwoodEX->Selection;
        > #-- only one message will be selected at a time
        >
        > if ($found) {
        > $Sel->Item(1)->Move($AmerwoodRec);
        > } else {
        > if ($text =~ /amerwood\@charter\.net/) {
        > $Sel->Item(1)->Move($AmerwoodUnRec);
        > } else {
        > $Sel->Item(1)->Move($AmerwoodJunk);
        > }
        > }
        >
        > $cnt--;
        > }
        >
        > $AmerwoodEX->Close;
        >
        > ###################################################################
        >
        > $AmerwoodMeEX->Activate; #-- displays the AmerwoodMe folder
        > if ($AmerwoodMeEX->IsPaneVisible(3)) {
        > Win32::GuiTest::SendKeys("%Vn"); #-- must close preview pane
        > }
        > Win32::GuiTest::SendKeys("{END}"); #-- focus on last message
        > $cnt=$AmerwoodMe->Items->Count; #-- how many messages
        >
        > while ($cnt > 0) {
        > $Clip->Empty;
        >
        > Win32::GuiTest::SendKeys("{APP} {UP} {ENTER}");
        > #-- opens message options dialog
        >
        > Win32::GuiTest::SendKeys("{TAB 6}");
        > #-- moves down to internet header
        >
        > Win32::GuiTest::SendKeys("{APP} {DOWN 2} {ENTER}");
        > #-- puts internet header in clipboard
        >
        > Win32::GuiTest::SendKeys("{TAB}");
        > #-- moves to Cancel Button
        >
        > Win32::GuiTest::SendKeys("{ENTER}");
        > #-- closes message options dialog
        >
        > $found = 0;
        >
        > undef $text;
        > $text=$Clip->Get; #-- get clipboard contents
        > $text=lc($text); #-- convert to lowercase is necessary
        >
        > for($j=0;$j<=$i;$j++) {
        > $emailaddr=$emailaddrs[$j];
        > if ($text =~ /$emailaddr/) {
        > $found=1;
        > last;
        > }
        > }
        >
        > undef $Sel;
        > $Sel = $AmerwoodMeEX->Selection;
        > #-- only one message will be selected at a time
        >
        > if ($found) {
        > $Sel->Item(1)->Move($AmerwoodMeRec);
        > } else {
        > if ($text =~ /amerwood\@charter\.net/) {
        > $Sel->Item(1)->Move($AmerwoodMeUnRec);
        > } else {
        > $Sel->Item(1)->Move($AmerwoodMeJunk);
        > }
        > }
        >
        > $cnt--;
        > }
        >
        > $AmerwoodMeEX->Close;
        >
        > ###################################################################
        >
        > #-- end script
      • Eric
        The reason Outlook rules wizard can not be used is because it does not work. I know that sounds cruel. But I attempted it without success, except for being
        Message 3 of 3 , Jun 14, 2004
        • 0 Attachment
          The reason Outlook rules wizard can not be used is because it does
          not work. I know that sounds cruel. But I attempted it without
          success, except for being able to send emails downloaded from
          specific internet email accounts to their own folders to keep them
          separate from other email accounts. You might say, "That is just your
          inability problem". Oh yea? Thanks heaps!

          Problems I had with rules wizard included emails being copied to
          folders instead of moved. The problem with this is that subsequent
          tests/rules, cause the same emails to be copied to other folders as
          well. A major issue is that rules wizard looks at the DISPLAY NAME
          instead of the email address in the TO: and FROM: and CC: and BCC:
          fields. Many emails coming in to me show a person's DISPLAY NAME
          istead of their email address, so the rule does not work except for
          those emails actually showing the email address in the TO: field.
          And each rule can basically only do one thing, although you can ask
          it to do more than one thing and you have no reason to believe it
          won't do more than one thing, except it doesn't. And Microsoft
          acknowledges a "rule" can do just "one" thing. That being the case,
          you have to create a lot of rules, and then the issue of the emails
          being copied instead of moved becomes a real problem! You get
          multiple copies of emails in your folders. It's a mess! That's my
          experience.

          This script works on Windows 2000 professional with Outlook 2002
          (i.e. Microsoft Office XP Suite). It may also work "as is" with any
          Outlook version. Just be sure to first manually test the keystroke
          sequence needed to access the "Message Options" Dialogbox and then
          tab down to the internet header field. Access the Message Options
          Dialogbox via the APP keystroke (same as right mouse clicking) a
          particular email message within the Explorer ListView on the right
          side of the window opposite the Folders TreeView. The internet header
          is higlighted when you tab into that field. So from there, an APP
          keystroke (same as mouse right click) and a Arrow Down Twice <Enter>
          should copy the contents of that field to the clipboard.

          If anyone knows how to make this script a bit more full-proof so that
          if the user decides to touch their keyboard or mouse during execution
          it does not have the potential to make the script go off course, let
          us know. It would be nice if the keyboard and mouse became inactive
          to the user during execution of a Win32::GuiTest script so that the
          intended sequence of keystrokes can't be jacked with during
          execution.

          Eric

          --- In perlguitest@yahoogroups.com, "Dennis K. Paulsen"
          <ctrondlpaulsden@y...> wrote:
          > Hello Eric,
          > Should I assume that you are providing this script simply as a
          > potential example, or was there a question? Also, I'm not getting
          a
          > feel for why simple Outlook message rules can't be used
          > exclusively. :-?
          >
          > Regards.
          >
          >
          > --- In perlguitest@yahoogroups.com, "Eric" <eric_hansen85@y...>
          > wrote:
          > > use Win32;
          > > use Win32::OLE;
          > > use Win32::GuiTest;
          > > use Win32::Clipboard;
          > >
          > >
          >
          #####################################################################
          > #
          > > # EMAIL FILTER - for Microsoft Outlook.

          etc. etc. etc. See original post
        Your message has been successfully submitted and would be delivered to recipients shortly.