Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

An Address Book plug-in to find addresses in Route66 Apps
I have written a small Applescript plug-in for Address Book that finds the address of the selected person in Route 66. Depending on the version of Route 66 you have, you'll need to edit the property _version and property _subversion values in the script.

For this to work, GUI scripting needs to be enabled.

[robg adds: Several previous hints, like this one, explain how to use Address Book plug-in scripts; see that one for the details on getting this to work...]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[5,533 views]  

An Address Book plug-in to find addresses in Route66 | 12 comments | Create New Account
Click here to return to the 'An Address Book plug-in to find addresses in Route66' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Anyone Get This To Work?
Authored by: pxlated on Jan 19, '05 02:51:22PM

Followed the instructions and do have the "GoogleMe" script referenced working and the "System Events" are enabled.
It opens Route66 but gets to the "subversion" and throws the "ERROR - GUI scripting enabled?" message.
In the provided script, it lists the subversion as "R2004_1.dat" tried that and get the error. In the finder, that file on my system is listed as "R2004_1.dat.app" so tried that and it's still a no go, get the error.
Any ideas?



[ Reply to This | # ]
Anyone Get This To Work?
Authored by: staypuft on Jan 19, '05 03:26:04PM

I'm getting the same problem...



[ Reply to This | # ]
Anyone Get This To Work?
Authored by: thashef on Jan 19, '05 07:44:17PM

Same Problem...



[ Reply to This | # ]
Anyone Get This To Work? Yes, kinda.
Authored by: darrick on Jan 19, '05 07:55:22PM

by changing the _subversion to be the same as the _version, i got it to work for simple addresses (not with suite #s and such).

property _version : "ROUTE 66 Route 2004"
property _subversion : "ROUTE 66 Route 2004"

i have not done a lot of testing with it, but it did find apple's location in cupertino.

what would be nice would be zooming in on it automatically.
>now if i can only get my bluetooth belkin gps to work ; )



[ Reply to This | # ]
Anyone Get This To Work? Yes, kinda.
Authored by: staypuft on Jan 20, '05 12:31:02AM

Thanks, that seems to work... now to play with it and try to make it better ;-)



[ Reply to This | # ]
Anyone Get This To Work? Yes, kinda.
Authored by: pxlated on Jan 20, '05 04:24:22AM

Super...got it now :-)
You're right, would be nice if it zoomed.



[ Reply to This | # ]
Anyone Get This To Work? Yes, kinda.
Authored by: Kaneda_Tatsaki on Jan 20, '05 12:33:04PM

Hi sorry that I've seen the posts just wright now, I'm no AppleScript Guru.
My Version of Route66 launches a second app and I just got it to work when I use the second one. If someone rewrites it or adds functionality to the script your free to do so but please post all changes to the board that everyone can benefit from them.
Thnx in advance and I hope it's a little usefull ;-)
(sorry for my bad english)



[ Reply to This | # ]
Anyone Get This To Work? Yes, kinda.
Authored by: staypuft on Jan 20, '05 02:16:45PM

I think it's great. I tried to make a similar script a month or two ago and failed miserably. I plan to look through some AppleScript tutorials and see if I can make it work with apartment numbers in the address (by stripping them from the query).

Thanks again for writing the script.



[ Reply to This | # ]
Updated Script
Authored by: staypuft on Jan 20, '05 04:22:28PM
I updated the script to strip apartment numbers from the address field. This only works if you list apartment and suite numbers as 123 street #7 and not 123 street apartment 7. I also changed it to format the query as street, city, state, zip instead of street zip city. Route 66 seems to work fine with either formatting, it was just a personal preference.
property _version : "ROUTE 66 Route 2004"
property _subversion : "ROUTE 66 Route 2004"

using terms from application "Address Book"
	on action property
		return "address"
	end action property
	
	on action title for _person with _address
		return "Find Address in Route66"
	end action title
	
	on should enable action for _person with _address
		return true
	end should enable action
	
	on perform action for _person with _address
		set theresult to my getaddress_of_selection() as list
		if item 1 of theresult is {} and item 2 of theresult is {} and item 3 of theresult is {} and item 4 of theresult is {} then
			display dialog "\"No Address entry found\"" buttons {"OK"} default button 1 with icon 2
		else
			set addr to item 1 of theresult & ", " & item 2 of theresult & ", " & item 3 of theresult & ", " & item 4 of theresult as string
			try
				tell application _version to activate
			end try
			tell application "System Events"
				repeat 20 times
					if application process _subversion exists then
						exit repeat
					end if
				end repeat
			end tell
			try
				tell application _subversion to activate
				tell application "System Events"
					tell application process _subversion
						set value of combo box 1 of tab group 1 of splitter group 1 of splitter group 2 of window 1 to addr
						delay 0.5
						click button 2 of tab group 1 of splitter group 1 of splitter group 2 of window 1
					end tell
				end tell
			on error
				display dialog "ERROR - GUI scripting enabled?" with icon 2
			end try
		end if
	end perform action
end using terms from

on getaddress_of_selection()
	tell application "Address Book"
		set sellist to selection
		set oneentry to item 1 of sellist
		set oneentry to id of oneentry
		set str to street of address of person id oneentry as string
		set thezip to zip of address of person id oneentry
		set cit to city of address of person id oneentry
		set sta to state of address of person id oneentry
	end tell
	if str is {missing value} then
		set str to "" as string
	else
		repeat with Num from 1 to length of str by 1
			if get character Num of str is equal to "#" then
				set str to (get text 1 through (Num - 2) of str)
				display dialog "Apartment Number was stripped" with icon 2
				exit repeat
			end if
		end repeat
	end if
	if thezip is {missing value} then set thezip to "" as string
	if cit is {missing value} then set cit to "" as string
	if sta is {missing value} then set sta to "" as string
	return {str, cit, sta, thezip}
end getaddress_of_selection


[ Reply to This | # ]
Updated Script -- handler attempt for street number
Authored by: darrick on Jan 20, '05 08:10:23PM
i 'm trying to improve this super script a bit by trying to get the street number and name with this language


set savedTextItemDelimiters to AppleScript's text item delimiters
		try
			set street_address to (street of _address) as string
			set AppleScript's text item delimiters to {","}
			set number_and_street to first text item of street_address
			--reset the text item delimiters:
			set AppleScript's text item delimiters to savedTextItemDelimiters
		on error
			--also reset text item delimiters in case of an error:
			set AppleScript's text item delimiters to savedTextItemDelimiters
			beep
		end try
but i'm burned out and cannot get it to work (it should grab whatever comes before the first comma, which should be the street number and the street name before the apartment number or suite number)

[ Reply to This | # ]
Anyone Get Zoom to Work?
Authored by: pxlated on Jan 21, '05 10:03:34AM

A little hard to see the little symbol, would be nice (as mentioned) if it would automagically zoom in on the address. Anyone played with that at all?



[ Reply to This | # ]
Anyone Get Zoom to Work?
Authored by: staypuft on Jan 21, '05 12:33:13PM

I tried... I found the element to select, but could not get AppleScript to select it. If anyone know how to work with menubuttons in AppleScript, let me know.



[ Reply to This | # ]