• 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: Searching a Mail message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searching a Mail message


  • Subject: Re: Searching a Mail message
  • From: deivy petrescu <email@hidden>
  • Date: Sun, 3 Jun 2007 10:21:50 -0400


On Jun 3, 2007, at 7:11, Philip Aker wrote:

On 2007-06-02, at 14:18:19, deivy petrescu wrote:

Some people tend to undermine AS abilities.
May be my problem is I tend to overestimate its capabilities and can not go past it.

Here's your script adapted to work with Mail. When I run it on your post I'm replying to, it doesn't produce an acceptable result.



Philip,
I beg to disagree. It produces perfect results.
Reread my message. I said I cheated a bit.
I did not need to do any cheating and I'd probably get more appropriate results.
I'll leave the solution as an exercise... :).
However, obviously, no matter what you try, you'd get spurious email addresses if the user decides to write in a "different" way, say.
For instance, "Meet me@3PM" or
"Write me at applescript@
dicas.com"


But even with this spurious email addresses, you did get all the emails of the body. Cleaning up some email is much easier than to look for all of them.

on tid(theDelimiter)
	set AppleScript's text item delimiters to theDelimiter
end tid

tid("@")
set emails to {}
tell application "Mail" to set m to content of item 1 of (get selection)
set q to text items of m
tid(space)


repeat with j from 1 to ((count q) - 1)
if (text item -1 of text item j of q) ≠ "" and (text item 1 of text item (j + 1) of q) ≠ "" then set end of emails to (text item -1 of text item j of q) & "@" & (text item 1 of text item (j + 1) of q)
end repeat
emails


Result:

{"\"@\"", "it.

Here

<script>
tid(\"@\")
set", "\"email@hidden", "email@hidden", "email@hidden", "\"@\"", "tid
</script>


---{\"email@hidden\",", "\"email@hidden\",", "\"email@hidden\"}

I", "(email@hidden)
Help/Unsubscribe/Update", "email@hidden
"}


Philip Aker email@hidden




Deivy _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Searching a Mail message
      • From: Philip Aker <email@hidden>
References: 
 >Re: Searching a Mail message (From: Jeffers <email@hidden>)
 >Re: Searching a Mail message (From: Luther Fuller <email@hidden>)
 >Re: Searching a Mail message (From: Michelle Steiner <email@hidden>)
 >Re: Searching a Mail message (From: Luther Fuller <email@hidden>)
 >Re: Searching a Mail message (From: Michelle Steiner <email@hidden>)
 >Re: Searching a Mail message (From: Luther Fuller <email@hidden>)
 >Re: Searching a Mail message (From: deivy petrescu <email@hidden>)
 >Re: Searching a Mail message (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: Searching a Mail message
  • Next by Date: Re: Searching a Mail message
  • Previous by thread: Re: Searching a Mail message
  • Next by thread: Re: Searching a Mail message
  • Index(es):
    • Date
    • Thread