MACSCRPT Archives

March 2009

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Mark J. Reed" <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 19 Mar 2009 20:12:02 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (45 lines)
I would have used

do shell script "sed -ne 's/^\\(..\\)" & zip & ".*$/\\1/p' zcta5.txt"

but the principle is the same.  You could also script TextEdit or
BBEdit...  The variations I tried with pure AppleScript were
excruciatingly slow, but I might just be doing it wrong.

There are also web services, e.g.
http://www.webservicex.net/uszip.asmx, but my attempts to call those
using AppleScript's SOAP functionality also failed.



On Thu, Mar 19, 2009 at 7:29 PM, Mark Lively <[log in to unmask]> wrote:
> All you really need is a file with the data and then grep for the zip code.
>
> The file I used was http://www.census.gov/tiger/tms/gazetteer/zcta5.txt
>
> set zip to "66603"
> do shell script "grep \"" & zip & " 5-Digit\"
> /Users/lively/Desktop/zcta5.txt | cut -c 1,2"
>
>
> On Mar 19, 2009, at 6:14 PM, Stockly, Ed wrote:
>
>> Is it possible, from a script, to determine the state from the zip code?
>>
>> I have a script that reads an address from a data base, but the address
>> doesn't contain a state. (In the past all the user's addresses were in
>> California, now they are covering listings other states.)
>>
>> (The user is working on getting the state inserted in the data in future
>> builds, but until then we have hundreds of addresses that need to be
>> fixed).
>>
>> ES
>>
>



-- 
Mark J. Reed <[log in to unmask]>

ATOM RSS1 RSS2