Scripting for the zip code

Scott Rossi scott at
Thu Dec 12 13:32:06 EST 2013

Hi Jim:

You can try the following functions if you're looking up a single US
address (watch line wrapping).  Pass the street/city/state info to the
first function as separate arguments.

function getZip pStreet, pCity, pState
   put "" into
   put "&sensor=false" into URLsuffix
   put cleanString(pStreet) into streetData
   put streetData & comma into theStreet
   replace space with "+" in theStreet
   put cleanString(pCity) into cityData
   put cityData & comma into theCity
   replace space with "+" in theCity
   put cleanString(pState) into stateData
   put stateData into theState
   replace space with "+" in theState
   put baseURL & theStreet & "+" & theCity & "+" & theState & URLsuffix
into geoURL
   put url geoURL into theGeoData
   if "ZERO_RESULTS" is in theGeoData then return "No geocode data found."
   put line lineOffset("formatted_address",theGeoData) of theGeoData into
   return word 2 of item -2 of temp
end getZip

function cleanString pString
   replace "." with empty in pString
   replace "," with empty in pString
   if char -1 of pString is space then delete char -1 of pString
   return pString
end cleanString


Scott Rossi
Creative Director
Tactile Media, UX/UI Design

On 12/12/13 7:53 AM, "James Hurley" <jhurley0305 at> wrote:

>Is there a way to *script* for the zip code given
>Street address
>It used to be possible using the USPS web site, it was even possible to
>get the nine digit zip, but no longer.
>But for now, all I need is the 5 digit zip.
>Jim Hurley
>use-livecode mailing list
>use-livecode at
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:

More information about the use-livecode mailing list