Updating Contact via vCard

We have a corporate directory, that permits downloading of people’s vCards. I have collected many emails in my Contact without the rest of the data.

The URL looks like

http://www.directory.here.com/dir/vcard/waynwill.vcf

What I would like to do is to scan through the contacts looking for a @here.com email, if there is one download the vCard, and then merge it with the contact.

I am ok with the dialog popping up…

I can figure the scan the contact data base looking for the emails, with something like

repeat with onePerson in (get people)
		
		set theEmail to (get value of every email of onePerson) as string
		
		(* if there is a @here.com in the email address needs to be checked *)
		if (theEmail as string) contains "@here.com" then
			
			-- do download
                        -- do import
				
			end if
		end if
		
	end repeat

Hi kcossabo,

Are you trying to script the Contacts app?

What do you mean by this? Ok, I think you mean email addresses.

Edited: this one is a little tricky. You’ll probably need the contacts name also.

gl,
kel

Model: MBP
AppleScript: AS 2.2.4
Browser: Safari 536.28.10
Operating System: Mac OS X (10.8)

Sorry yes I am trying to script the contact app.

Hi kcossabo,

How do you download the vcard without AppleScript? I cannot see anything in your link. It is a blank page or network.

gl,
kel

I think you would use ‘curl’. Something like:

set vcard_link to "http://www.directory.here.com/dir/vcard/waynwill.vcf"
do shell script "curl -O " & quoted form of vcard_link

Not sure how to use curl yet.

Edited: added the -O option to download the file to your computer.

gl,
kel