• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: using variables to filter mail messages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using variables to filter mail messages


  • Subject: Re: using variables to filter mail messages
  • From: Ron Hunsinger <email@hidden>
  • Date: Fri, 23 Oct 2009 16:26:38 -0700

At 9:31 AM -0400 10/22/09, Mr. Dan Pouliot wrote:
I'm trying to create a service that will look for all mail messages with the selected text.

At 3:45 PM -0400 10/23/09, Mr. Dan Pouliot wrote:
I need this to be a service because I need to quickly locate emails based on the sender email address.

I was hoping someone would figure out how variables can help here. I just don't get it. Automator variables seem to be useless in all but the most trivial circumstances. Google searches keep turning up the same trivial examples over and over again, along with lots of frustration that the whole thing falls apart as soon as you try to do anything interesting.


I was able to get Automator to do what you want, by eschewing variables altogether. My solution workflow has three steps:

1: Service receives selected text in any application. (Same as your first step).

2: Run AppleScript, with the following script:

on run {input, parameters}
set theSender to item 1 of input
set output to {}
tell application "Mail"
repeat with acct in accounts
repeat with mbox in mailboxes of acct
set output to output & (every message of mbox whose sender contains theSender)
end repeat
end repeat
end tell
return output
end run


3: Display Mail Messages (Same as your last step).

An obvious enhancement (left for the interested student) would be to accept a list of accounts or mailboxes to search, instead of searching everywhere.

-Ron Hunsinger
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >using variables to filter mail messages (From: "Mr. Dan Pouliot" <email@hidden>)

  • Prev by Date: Re: Automator-users Digest, Vol 45, Issue 10
  • Next by Date: Automatic Email Send
  • Previous by thread: using variables to filter mail messages
  • Next by thread: Using Variables to Filter Mail Messages
  • Index(es):
    • Date
    • Thread