airport codes, dialog window sizes

I’ve been playing around with the files in “/usr/share/misc/” for fun. So I tried running this script to see if I could extract Air Port Codes. It works, but…

repeat
	display dialog "Enter the Name of a Major City, State, or Country to Display it's Airport Codes" default answer "St.\ Louis"
	set airCode to (text returned of result)
	try
		do shell script "grep -i " & airCode & " /usr/share/misc/airport"
		display dialog result buttons {"OK"} default button "OK"
	on error
		display dialog "I Couldn't Find an Airport Code for "" & airCode & "". Sorry About That!" buttons {"Cancel", "OK"} default button "OK"
	end try
end repeat

how do I get it to show a larger window so that doesn’t truncate the list of airport codes displayed? For instance, type in “USA” or “Canada” and you’ll see that the last codes displayed are cut short in the dialog window.

btw, if you want to enter a name that has spaces (like Salt Lake City) you’ll need to escape the spaces like this (Salt Lake City) in the default answer Dialog window

An even better example would be…

display dialog "Enter the Name of a City" default answer "Saint\ Louis,\ Mo" --add a backslash after a word that has spaces
set zipCty to (text returned of result)
do shell script "grep -i " & zipCty & " /usr/share/misc/zipcodes"
display dialog result

Does this do what you want?

display dialog "Enter the Name of a City" default answer "Saint\ Louis,\ Mo" --add a backslash after a word that has spaces 
set zipCty to (text returned of result)
set foo to do shell script "grep -i " & zipCty & " /usr/share/misc/zipcodes"

try
	set oldDelims to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {return}
	set bar to text items of foo as list
	set AppleScript's text item delimiters to oldDelims
on error
	set AppleScript's text item delimiters to oldDelims
end try

choose from list bar

Yes it does, thanks Rob. TID’s never crossed my mind ;¬)