2/13/2005
Add Google Maps to Mac OS X Address Book
Just when you thought Google couldn't get any better, they launched an amazing online mapping service this week. Also newsworthy, MapQuest crapped their pants.If you have yet to play with Google Maps, don't waste time and go check it out. The service is still in beta, so expect a few glitches and make sure you download the FireFox web browser first (even Google thinks Internet Explorer sucks!). Also please note that Google Maps currently only supports U.S. addresses.
After checking it out, I'm sure you will agree that Google Maps isn't only a great mapping tool, but it's fun to navigate and has great graphics. You will probably want to bookmark it and make it part of your normal routine. Savvy Mac OS X users may even want to integrate it into their Address Book.
Here's how:
- Launch up Script Editor (Applications > AppleScript > Script Editor)
- Select New from the File menu to create a new empty script
- Copy the code listed below in-between the "--Start" and "--End" comments
- Paste this code into the blank empty script in Script Editor
- Save the script in your ~/Library/Address Book Plug-Ins/ directory and name it "Google Map Of.scpt"
- If the Address Book application is open, quit it
- Launch Address Book and select someone with a U.S. address
- Right-click or control-click on an address and select 'Google Map Of (Firefox)' from the pop-up menu
- FireFox should open up with a map
- Enjoy
AppleScript Code from MacOSXHints.com:
-- Start
property googleMaps : "http://maps.google.com/maps?q="
using terms from application "Address Book"
on action property
return "address"
end action property
on action title for p with v
return "Google Map Of (Firefox)"
end action title
on should enable action for p with v
return true
end should enable action
on perform action for p with v
set params to ""
if street of v is not missing value then set params to params & street of v & " "
if city of v is not missing value then set params to params & city of v & " "
if state of v is not missing value then set params to params & state of v & " "
if zip of v is not missing value then set params to params & zip of v & " "
try
tell application "Firefox"
OpenURL googleMaps & params
activate
end tell
on error
display dialog "You must have Firefox installed to use this plug-in."
end try
end perform action
end using terms from
-- End
FYI- it doesn't work with the Safari browser on Mac. it's about time i tried FireFox anyway. thanks guys!
If you want this script to work in Safari, change the script as follows:
- find and replace the word Firefox with the word Safari
- change the line "OpenURL googleMaps & params" to read "set URL of front document to googleMaps & params"
- if you want the map to open up in a new window rather than in the current window, insert the line "make new document" before the "set URL of..." line
- find and replace the word Firefox with the word Safari
- change the line "OpenURL googleMaps & params" to read "set URL of front document to googleMaps & params"
- if you want the map to open up in a new window rather than in the current window, insert the line "make new document" before the "set URL of..." line
This is cool, and useful at the same time. I have used the mods suggested above and changed it so that it works better for the UK:
-- Start
property googleMaps : "http://maps.google.co.uk/maps?q="
using terms from application "Address Book"
on action property
return "address"
end action property
on action title for p with v
return "Google Map Of (Safari)"
end action title
on should enable action for p with v
return true
end should enable action
on perform action for p with v
set params to ""
if street of v is not missing value then set params to params & street of v & " "
if city of v is not missing value then set params to params & city of v & " "
if state of v is not missing value then set params to params & state of v & " "
if zip of v is not missing value then set params to params & zip of v & " "
try
tell application "Safari"
make new document
set URL of front document to googleMaps & params
activate
end tell
on error
display dialog "You must have Safari installed to use this plug-in."
end try
end perform action
end using terms from
-- End
-- Start
property googleMaps : "http://maps.google.co.uk/maps?q="
using terms from application "Address Book"
on action property
return "address"
end action property
on action title for p with v
return "Google Map Of (Safari)"
end action title
on should enable action for p with v
return true
end should enable action
on perform action for p with v
set params to ""
if street of v is not missing value then set params to params & street of v & " "
if city of v is not missing value then set params to params & city of v & " "
if state of v is not missing value then set params to params & state of v & " "
if zip of v is not missing value then set params to params & zip of v & " "
try
tell application "Safari"
make new document
set URL of front document to googleMaps & params
activate
end tell
on error
display dialog "You must have Safari installed to use this plug-in."
end try
end perform action
end using terms from
-- End
These codes are really useful sometimes. I had a book from www.kevacorp.com.It contains all details of these types of codes,multimedia ,and all software programs. really useful and interesting.
eindu
eindu
another small addition to that script - to do a reverse lookup on a phone number, here's the applescript (it's made for canada, but you can substitute that url with equivalent for US or whatever other country you need - just find proper website)
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for p with v
return "Reverse Phone Lookup"
end action title
on should enable action for p with v
return true
end should enable action
on perform action for p with v
set telephone to ""
if value of v is not missing value then set telephone to value of v
try
tell application "Firefox"
OpenURL "http://411ca.whitepages.com/1234/search/ReversePhone?phone=" & telephone
activate
end tell
on error
display dialog "You must have Firefox installed to use this plug-in."
end try
end perform action
end using terms from
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for p with v
return "Reverse Phone Lookup"
end action title
on should enable action for p with v
return true
end should enable action
on perform action for p with v
set telephone to ""
if value of v is not missing value then set telephone to value of v
try
tell application "Firefox"
OpenURL "http://411ca.whitepages.com/1234/search/ReversePhone?phone=" & telephone
activate
end tell
on error
display dialog "You must have Firefox installed to use this plug-in."
end try
end perform action
end using terms from
hese codes are really useful sometimes. I had a book from www.osx86spain.com.It contains all details of these types of codes,multimedia ,and all software programs. really useful and interesting.
Links to this post:





RSS Subscribe
Turkey Bowl is a 3D perspective target game where you celebrate the fall harvest by knocking over turkeys with bowling apples. Here's a hint, the turkeys further away are worth more points. Happy Thanksgiving!!!
Has a virus or hard
drive crash wiped out your entire music collection on your computer? No
problem. Here's how to copy music off your iPod or iPhone and back onto your computer.
Bugs tend to freak us out. Mosquitoes, spiders, wasps, centipedes... you name it. If it crawls, bites or buzzes anywhere near our faces, then we squirm, swat and run. But what's worse than a little bug crawling on or biting you? How about a really, really big one? Here are some of the biggest bugs on Earth. Enjoy!. 






Post a Comment