Have a simple script that spins thru address book and gets all contacts into a file. However, many customers getting this error: “Address Book got an error: Can’t get every <> of item 1 of every person”
Anyone have any idea what this <> could possibly means and why this can happen?!
Here is the original script:
set _result to {}
set _userGroup to "test groupp"
tell application "Address Book"
try
if _userGroup = "All Contacts" then
set _contacts to a reference to every person
else
set _contacts to a reference to every person of group named "test group"
end if
repeat with _contact in _contacts
tell _contact
if first name is not missing value then
set _firstname to first name
else
set _firstname to ""
end if
if last name is not missing value then
set _lastname to last name
else
set _lastname to ""
end if
if name is not missing value then
set _name to name
else
set _name to ""
end if
--phone
repeat with _phone in phones
if _phone's label does not contain "fax" then
if company then
copy (_name & "|" & "phone-" & _phone's label & "=" & _phone's value & "") to the end of _result
else if _firstname = "" and _lastname = "" then
copy (_name & "|" & "phone-" & _phone's label & "=" & _phone's value & "") to the end of _result
else
copy (_firstname & ", " & _lastname & "|" & "phone-" & _phone's label & "=" & _phone's value & "") to the end of _result
end if
end if
end repeat
--email
repeat with _email in emails
if company then
copy (_name & "|" & "email-" & _email's label & "=" & _email's value & "") to the end of _result
else if _firstname = "" and _lastname = "" then
copy (_name & "|" & "email-" & _email's label & "=" & _email's value & "") to the end of _result
else
copy (_firstname & ", " & _lastname & "|" & "email-" & _email's label & "=" & _email's value & "") to the end of _result
end if
end repeat
--instant message
repeat with _skype in instant messages
if _skype's service type is equal to Skype then
if _skype's label is equal to "_$!<Work>!$_" then set _skype_label to "work"
if _skype's label is equal to "_$!<Home>!$_" then set _skype_label to "home"
if _skype's label is equal to "_$!<Other>!$_" then set _skype_label to "other"
if company then
copy (_name & "|" & "skype-" & _skype_label & "=" & _skype's user name & "") to the end of _result
else if _firstname = "" and _lastname = "" then
copy (_name & "|" & "skype-" & _skype_label & "=" & _skype's user name & "") to the end of _result
else
copy (_firstname & ", " & _lastname & "|" & "skype-" & _skype_label & "=" & _skype's user name & "") to the end of _result
end if
end if
end repeat
end tell
end repeat
on error msg
display dialog msg
end try
end tell
set old_delim to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set _result to _result as text
set AppleScript's text item delimiters to old_delim
set _file to (((path to desktop) as string) & "test.txt")
set open_file to (open for access file _file with write permission)
try
set eof of open_file to 0
write _result to open_file starting at eof -- as Unicode text
close access open_file
on error
try
close access file _file
end try
end try