--clean up junk web address data from address book
on is_invalid_url(the_url)
return (the_url contains " ") or (length of the_url is 0) or (the_url contains "&")
end is_invalid_url
tell application "Address Book"
-- set junk_urls to {}
set total_urls to 0
set invalid_urls to 0
repeat with this_person in (get selection)
set url_id to " "
set theUrls to properties of urls of this_person
repeat with each_url from 1 to (count of theUrls)
-- repeat with each_url in (get urls of this_person)
set total_urls to total_urls + 1
if my is_invalid_url(value of item each_url of theUrls) then
-- (delete item each_url)
set value of item each_url of urls to url_id
set invalid_urls to invalid_urls + 1
-- if junk_urls is {} then
-- set junk_urls to (id of each_url)
-- else
-- set junk_urls to junk_urls & (id of each_url)
-- end if
end if
end repeat
-- repeat with url_id in junk_urls
-- delete (url whose id is url_id)
-- end repeat
end repeat
save
display dialog "Checked " & total_urls & " URLs. " & invalid_urls & " were invalid."
end tell
Sincerely,
JoAnne Sorlie