address book apple-script
the powerbook blog linked to a nice hint on macosxhints.ch (features german translations of osxhints.com, but also original german hints). you might have seen that you can click on any label in a contacts detail (e.g. work address, telephone, etc) to get a nice menu to do things with the data (get it in huge letters all over your screen, look for the map, print label, etc.). since the release of panther coders can add to these menus with little apple-script-effort. the script mentioned in the hints adds an european map search, but i wanted to alter it to use the excellent map.search.ch. after downloading the nice applescript i changed it to this point:
on action property
return "address"
end action property
on action title for thePerson with theAddress
return "mit map.search.ch anzeigen"
end action title
on should enable action for thePerson with theAddress
return true
end should enable action
on perform action for thePerson with theAddress
tell application "Address Book"
set z to zip of theAddress
set c to city of theAddress
set s to street of theAddress
end tell
tell application "Safari"
set browser to make new document
tell browser
set URL to "http://map.search.ch/" & z & "-" & c & "/" & s
end tell
end tell
return true
end perform action
end using terms from
so, to use the script, just open script editor, paste the code above (or FAR better, just click here1), save as “script” in ~/Library/Address Book Plug-Ins/ restart your address book and have fun with the address label. it should work with all swiss addresses, if it doesn’t send me a note and i’ll try to fix it… oh, and i forgot to mention: the whole thing only works for os x.3!
1that link took me ages!