I need help changing the following info in the labels that are syncing to my iphone. The addresses i’m having trouble with were imported originally from an exchange account at an old job. I have a problem understanding what is going on with AB’s labels. All labels display fine in AB, just display with the weird label in the iphone. So i used the two simple scripts below to try and find out what the label should be called. Once i found that i used the script from an earlier post and i’ve included the results-- it says one label changed, and that was all i was testing it on. However when i query the properties its not changed and its actually returning a “0” for records that match, so why am i not matching the correct syntax for the label?
tell application "Address Book"
set thePeople to selection
get properties of (item 1 of thePeople)
end tell
returns among other things…
item1.TEL;type=pref:(915) 544-4647
item1.X-ABLabel:$!!$
item2.TEL:(915) 544-9459
item2.X-ABLabel:$!!$
item3.ADR;type=HOME;type=pref:;;801 N. El Paso St. Suite 200;El Paso;Texas;79902;United States of America
item3.X-ABLabel:$!!$
item3.X-ABADR:us
What is displaying on my iphone is for business fax is “$!!$” as the label. Problem is Address book seems to only see the following when i run a script for phone labels:
tell application "Address Book"
set thePeople to selection
get properties of phones of (item 1 of thePeople)
end tell
returns
{{label:“work fax”, value:“(915) 544-4647”, class:phone, id:“154C6FD9-52D0-4EEC-8583-62F6154E6EDF”}, {label:“work”, value:“(915) 544-9459”, class:phone, id:“E8343200-C6A4-4CB4-97E0-DDF98C1FB431”}}
so i found the following script from John M
(*
set XX to text returned of (display dialog "What label do you want to change?" default answer "")
set YY to text returned of (display dialog "What do you want the new label to say?" default answer "")
*)
-- Credit to John M on macscripter.net and modified slightly to include dialogs
set theOld to "_$!<EX-BusinessFax>!$_" -- label to replace
set theNew to "Business Fax" -- new label
tell application "Address Book"
--to mark time taken
set startTime to (current date)
-- get people whose phone labels contain the old term
set thePeople to selection
-- loop through these people
repeat with aPerson in thePeople
-- loop through phone entries with the old term
repeat with myPhone in (phones of aPerson whose label is equal to theOld)
-- set the label to the new label
set the ABlabel of myPhone to theNew
end repeat
end repeat
-- to refresh
save
-- to mark time taken
set takenTime to (current date) - startTime
-- display confirmation
display dialog "All \"" & theOld & "\" changed to \"" & theNew & "\"," & return & (count thePeople) & " records changed," & return & "in " & takenTime & " seconds." as string buttons {"OK"} default button 1
end tell
and when i run it it says.
tell application “Address Book”
current date
→ error number -10004
end tell
tell current application
current date
→ date “Tuesday, May 11, 2010 11:59:36 PM”
end tell
tell application “Address Book”
get selection
→ {person id “690172FF-991F-4509-838C-55712ED8E82C:ABPerson”}
count every phone of person id “690172FF-991F-4509-838C-55712ED8E82C:ABPerson” whose label = “$!!$”
→ 0
save current application
→ missing value
current date
→ error number -10004
end tell
tell current application
current date
→ date “Tuesday, May 11, 2010 11:59:36 PM”
end tell
tell application “Address Book”
display dialog “All "$!!$" changed to "Business Fax",
1 records changed,
in 0 seconds.” buttons {“OK”} default button 1
→ {button returned:“OK”}
end tell
Result:
{button returned:“OK”}
but the label hasn’t been changed in address book like its telling me. Thoughts. The addresses i’m having trouble with were imported originally from an exchange account at an old job.