Jump to content

vcard


This topic is 7024 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I would get data straight from the database to Address book with applescript. The following script runned from ScriptEditor (applescript) - put me straight into your address book. And such scripts can be embedded to pull variables from the base:

tell application "Address Book"

set foo to make new person at the end of the people with properties {first name:"S

Link to comment
Share on other sites

I've only been messing about with Address Book. Here's what I've got to create a person from FileMaker. It has a clause to look first and see if they're there already (to prevent duplicates).

As far as vCards, it's pretty easy to export a vCard from Address Book; way easier than doing it from FileMaker itself. You could Find the person in the address book then export 1 vCard. Is that what you want to do?

Put in a Perform AppleScript step. You must have all the fields on the current layout.

Remove the "--" from the 1st and last lines after pasting into Script Editor; if you want to edit it, or see the pretty colors :-) FileMaker doesn't want those lines; it knows who it is.

[Oops! All the ? question marks are "not equal" signs. AppleScript doesn't have an "IsEmpty" phrase, but it will handle "does not = ""

There's probably another way to write that, but this seems to work; so you don't create things when there are no values for it.]

--tell application "FileMaker Developer"

tell window 1

tell current record

set theGroup to cell "Group"

set firstName to cell "FirstName"

set lastName to cell "LastName"

set firstLast to cell "FirstLast"

set theStreet to cell "Street"

set theCity to cell "City"

set theState to cell "State"

set theZip to cell "Zip"

set theCountry to cell "Country"

set Email_home to cell "Email_Home"

set Email_work to cell "Email_Work"

set phone_home to cell "Phone_Home"

set phone_work to cell "Phone_Work"

end tell

tell application "Address Book"

set foundList to (id of every person whose name is firstLast)

if foundList is {} then

set thePerson to make new person at end of the people with properties {first name:firstName, last name:lastName}

if theGroup = "" then

set (group of thePerson) to theGroup

else

set (group of thePerson) to "All"

end if

set theAddress to make new address at end of thePerson

set (label of theAddress) to "Home"

set (street of theAddress) to theStreet

set (city of theAddress) to theCity

if theState = "" then

set (state of theAddress) to "CA"

else

set (state of theAddress) to theState

end if

set (zip of theAddress) to theZip

if theCountry = "" then

set (country of theAddress) to "USA"

else

set (country of theAddress) to theCountry

end if

if Email_home ? "" then

set theEmail to make new email at end of thePerson with properties {label:"Home", value:Email_home}

end if

if Email_work ? "" then

set theEmail to make new email at end of thePerson with properties {label:"Work", value:Email_work}

end if

if phone_home ? "" then

set thePhone to make new phone at end of thePerson with properties {label:"Home", value:phone_home}

end if

if phone_work ? "" then

set thePhone to make new phone at end of thePerson with properties {label:"Work", value:phone_work}

end if

save addressbook

end if

end tell

end tell

--end tell

Link to comment
Share on other sites

This topic is 7024 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.