Select Category Allgemein (57) Blafasel (17) Elender Weltverbesserer (2) hubionmac.com (11) Kino Filme (4) NERV! (14) TV Serien (3) Wordpress (1) Fun (13) Bilder (1) Hardware (18) ipod (5) ps3 (4) synonlogy (2) Nice2Know (58) Apple Mail (5) Bootcamp (1) Bugs (2) links (15) OS X (14) scripting (6) Shortcuts (5) Snow Leopard (3) Spotlight (1) software (30) Software I Use (15) tools (2) Softwareschmiede (185) AppleScript (158) Address Book (9) Apple Mail (23) CDFinder (1) Excel (1) EyeTV (1) Finder (12) Google Chrome (1) ical (7) iPhoto (1) iTunes (11) Microsoft Word (1) Numbers (1) OS X (31) Outlook (1) Pages (1) Photoshop (2) Safari (11) Transmit 4 (1) Useful Snippets (43) Automator (2) Printing (2) pdf (6) Quartz Composer (3) ready2use (12) webdev (12) javascript (9) terminal (41) defaults write (11) Things I add to a new system (5)
AppleScript: Search&Replace im Adressbuch
--script to remove certain characters/strings from an address
set toBeRemoved to {"
"}
tell application "Address Book"
set my_selections to selection
repeat with my_selection in my_selections
repeat with i from 1 to count of every address of my_selection
repeat with current_replace_string in toBeRemoved
set current_replace_string to current_replace_string as text
set street of address i of my_selection to my replace_chars((street of address i of my_selection), current_replace_string, "")
set city of address i of my_selection to my replace_chars((city of address i of my_selection), current_replace_string, "")
set zip of address i of my_selection to my replace_chars((zip of address i of my_selection), current_replace_string, "")
set country of address i of my_selection to my replace_chars((country of address i of my_selection), current_replace_string, "")
set state of address i of my_selection to my replace_chars((state of address i of my_selection), current_replace_string, "")
end repeat
end repeat
end repeat
save
end tell
to replace_chars(this_text, search_string, replacement_string)
if this_text contains the search_string then
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
end if
return this_text
end replace_chars