• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Address book--getting rid of junk url data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Address book--getting rid of junk url data


  • Subject: Address book--getting rid of junk url data
  • From: JoAnne Sorlie <email@hidden>
  • Date: Wed, 03 Nov 2010 13:36:42 -0400

I have almost 30 years worth of addresses in a personal address book file that has migrated through and synchronized with many software platforms. Along the way, it has picked up  strange junk in the url fields, for example "12&00%20PM".   This junk seems to make it impossible to synchronize via bluetooth.

I've tried to adapt scripts I've found via Google to this purpose without success.  I'm neither able to delete the junk url's, nor replace them with inoffensive values.  Following is the closest I've come to getting an applescript to work.  This results in: 
"error "Address Book got an error: Can’t set every url to \"                                    \"." number -10006 from every url

I have left some commented out lines from previous versions that haven't worked; you can perhaps see from this how confused I've gotten myself.

Thanks!

--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
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: TreeView X and dnd Files
  • Next by Date: Re: TreeView X and dnd Files
  • Previous by thread: Re: TreeView X and dnd Files
  • Next by thread: Re: how does an a/s app find other apps?
  • Index(es):
    • Date
    • Thread