Mac OS X Technologies

AppleScript not working on Friends MacBook but it works fine on mine

We manipulate contact data for hundreds of contacts, and I have this AppleScript that move the spouses name from the spouse field to the middle name field, adding a & in front of it. So the whole name shows up as John & Sue Doe. But you can still access it with Siri as John Doe.

This script works fine for me but not on a coworkers MacBook. He has updated to Catalina. I have not. Would that be the problem? If so, does anyone know how I need to fix it? Thanks

tell application "Contacts"
	display dialog "This will move the spouse from the 'Spouse' Field to the 'Middle Name' field.  It will add '&' in front of it" buttons {"Continue"} default button {"Continue"}
	set _groups to name of every group
	set theirGroup to choose from list _groups with title "Moving Spouse to new location" with prompt "Select an Address Book Group"
	if theirGroup is false then --user canceled
		say "Goodbye"
	end if
	set theirGroup to theirGroup as string
	set theContacts to (every person in group theirGroup)
	repeat with theContact in theContacts
		set theirSpouse to ""
			set theirSpouse to (the value of the first related name of theContact whose label is "spouse")
			set theirSpouse to the first word of theirSpouse
		end try
		if theirSpouse is not "" then
			set theirSpouse to "& " & theirSpouse
			set the middle name of theContact to theirSpouse
			set (the value of the first related name of theContact whose label is "spouse") to ""
		end if
	end repeat
end tell
say "We are done moving the spouses to a new field"

Click to rate this post!
[Total: 0 Average: 0]

Related posts

Combine a pair of one-page pdfs


Unmount APSF-data volume


Disable Hyperthreading


Leave a Comment