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


Click here to return to the 'UPDATED: Add a zip code lookup to Address Book' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
UPDATED: Add a zip code lookup to Address Book
Authored by: joejoethedog on Dec 18, '08 07:42:02PM
As previously mentioned, the USPS changed their website code. Here is the script again with the updated URL. Also updated to open Safari directly and to allow for lookup if 5-digit Zip already there (from previous hints; thanks!)

-- zip code locator
using terms from application "Address Book"
	on action property
		return "address"
	end action property
	
	on action title for p with e
		if zip of e contains "-" then
			return "Zip Code Present"
		else
			return "ZIP + 4 Lookup "
		end if
	end action title
	
	on should enable action for p with e
		if zip of e does not contain "-" then
			return true
		else
			return false
		end if
	end should enable action
	
	on perform action for p with e
		set LookupURL to ¬
			"http://zip4.usps.com/zip4/zcl_0_results.jsp?visited=1&pagenumber=0&firmname=&address2=" & street of e & "&address1=&city=" & ¬
			city of e & "&state=" & state of e & "&urbanization=&zip5=&submit.x=6&submit.y=15"
		tell application "Safari" to open location LookupURL
		return true
	end perform action
end using terms from
-Joe

[ Reply to This | # ]