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


Click here to return to the 'Amended script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Amended script
Authored by: hughescr on Jan 20, '04 03:18:34PM
This modified script uses infospace.com which has better results generally than Google, will automatically switch searches for "work" vs "home" phone lookups, and also does a better job figuring out phone number format:

using terms from application "Address Book"
	on action property
		return "phone"
	end action property
	
	on action title for aPerson with aPhone
		return "Look Up Address"
	end action title
	
	on should enable action for aPerson with aPhone
		return true
	end should enable action
	
	on perform action for aPerson with aPhone
		set thephone to ((value of aPhone) as string)
		set wpq to 1
		if (label of aPhone) = "work" then
			set wpq to 0
		end if
		set AppleScript's text item delimiters to {"(", ")", " ", "-"}
		set qpa to (first word of thephone)
		set qpx to (second word of thephone)
		set qpp to (third word of thephone)
		set AppleScript's text item delimiters to ""
		tell application "Safari"
			activate
			open location ("http://ypng.infospace.com/home/yellow-pages/redir.htm?" & ¬
				"qfm=p&searchtype=all&fromform=psearch&QK=10&top=1&" & ¬
				"qcat=reverse&qsubcat=revphone&wqp=" & wpq & "&qpa=" & ¬
				qpa & "&qpx=" & qpx & "&qpp=" & qpp & "&x=0&y=0")
		end tell
	end perform action
end using terms from


[ Reply to This | # ]