• 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: Sat, 2 Jun 2007 17:18:19 -0400


On Jun 2, 2007, at 16:45, Luther Fuller wrote:

Second, you find someone who really, really, really needs to parse addresses and let them do it. I didn't say it was something good to do ... just a first step. Of course you're right, which is why I wouldn't want to do it.

On Jun 2, 2007, at 3:35 PM, Michelle Steiner wrote:

On Jun 2, 2007, at 1:27 PM, Luther Fuller wrote:

As I said ...
first find all "@" characters, using either offset or text item delimiters

I understood that, but what next? That character doesn't guarantee that there's an email address surrounding it, as I indicated with my example.


How do you determine that "Meet me @2PM @45th St and Broadway." does not contain an email address?

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

<script>
tid("@")
set emails to {}
set l to "email@hidden wrote \"it's one long line of 6343 characters for the perfect option.\"
email@hidden wrote
\"Second, you find someone who really, really, really needs to parse addresses and let them do it. I didn't say it was something good to do ... just a first step. Of course you're right, which is why I wouldn't want to do it.\"
email@hidden wrote
\"Meet me @2PM @45th St and Broadway.\" "


set q to text items of l
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

on tid(x)
	set AppleScript's text item delimiters to x
end tid
</script>

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

I cheated a bit, but as one can see it is not all that hard.

AS is not perfect. It can be perfect by its nature, but I sure find it very powerful.

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>)

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