• 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
Applescript quick question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Applescript quick question


  • Subject: Applescript quick question
  • From: Joel Esler <email@hidden>
  • Date: Thu, 05 Jun 2008 15:30:00 -0400

This is probably a newbie question, however, I can't get this script to function how i'd like.

I have no errors coming out of it, so I am not sure the next troubleshooting step.  Can anyone help me out, this is super simple, and I am apparently just not getting it.

So basically, I need to the script to cycle through group "Contacts" and see if the contact has an @domain email address, and if it doesn't then take the first name and last name of the contact and make an email address that is email@hidden. 

tell application "Address Book"
set contacts to (every person in group "Contacts")
repeat with thisContact in contacts
repeat with thisEmail in email of thisContact
if value of thisEmail contains "@domain" then
set found to true
exit repeat
if not found then
try
set first_name to first name of thisContact as Unicode text
set last_name to last name of thisContact as Unicode text
set emailentry to first_name & "." & last_name & "@domain.com" as Unicode text
tell thisContact
make new email with properties {label:"Work", value:emailentry}
end tell
on error errmsg number errnum
tell me
activate
display dialog errmsg
end tell
end try
else if value of thisEmail contains "@domain" then
-- beep
end if
end if
end repeat
end repeat
end tell



--
Joel Esler
  email@hidden
  http://blog.joelesler.net
[m]



 _______________________________________________
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: Applescript quick question
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Re: no exit!
  • Next by Date: Re: no exit!
  • Previous by thread: Re: Newbie Question...
  • Next by thread: Re: Applescript quick question
  • Index(es):
    • Date
    • Thread