Getting data from Contacts app

I can get the most important data from the Contacts app. Except: Facebook entry. How has that to be done? Any tip or hint is welcome. Thanks in advance. Lazy

Hi.

A person’s Facebook entry is one of its instant messages. But, in Sequoia at least, it appears that normal specifiers don’t work with these. It’s necessary to use specifiers which reference right back into the application rather than fetching the items first and then testing the results:

No:

thisPerson's instant messages
service type of item 1 of result

No:

service type of thisPerson's first instant message

Yes:

service type of item 1 of thisPerson's instant messages -- All one specifier.

It’s not quite so confusing if a repeat like this is used:

tell application "Contacts"
	set thisPerson to person "Mr Fred Bloggs" -- Substitute one of your own contacts.
	repeat with thisIM in thisPerson's instant messages
		if (thisIM's service type is Facebook) then
			set FacebookDetails to thisIM's {service type, service name, user name}
			exit repeat
		end if
	end repeat
	-- Do something with FacebookDetails
end tell

In Sequoia there is a (new?) element social profiles

1 Like

Hi Stefan.

Thanks for the suggestion. I did try that last night, but it didn’t pick up the Facebook entry I’d set up in my test person. (Edit: Ah. I see. A “Profile” field has to be explicitly added. Yes. That works well.)