home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Popular Mechanics - New Car Buyers Guide 1995
/
Popular_Mechanics_New_Car_Buyers_Guide_1995_Books_That_Work_1994.iso
/
howto
/
ads
/
toyota
/
locator.dir
/
00118_Script_118
< prev
next >
Wrap
Text File
|
1994-09-14
|
3KB
|
89 lines
on initializeFields
--put "" into field "zipHole"
put "Enter a five digit zip code and press Enter." into field "displayResults"
end InitializeFields
on checkKey
set x = charToNum(the key)
if (x < 48 OR x > 57) AND x <> 8 then dontPassEvent
if length(field "zipHole") = 5 AND x <> 8 then dontPassEvent
if the key = RETURN then go to frame "sea"
end checkKey
on searchAndReport
global index, zip, foist
set foist = 1
put EMPTY into field "displayResults"
if length(field "zipHole") < 5 then
put "Please enter five digits and press Enter." into field "displayResults"
put empty into field "zipHole"
else
put "Let me look up zip code" && field "zipHole" & "." & RETURN ¼
& "Back in a flash!" into field "displayResults"
put field "zipHole" into zip
put (char 1 to 2 of field "zipHole") into xx
set flag = 0
set index = 1
repeat while (line (index) of field xx <> empty)
if line (index) of field xx contains zip then
report (xx)
set flag = 1
end if
set index = index + 5
end repeat
put string (value (xx) - 1) into xy
if value (xy) < 0 then put "00" into xy
if length (xy) < 2 then put "0" before xy
set index = 1
repeat while (line (index) of field xy <> empty)
if line (index) of field xy contains zip then
report (xy)
set flag = 1
end if
set index = index + 5
end repeat
put string (value (xx) - 2) into xz
if value (xz) < 0 then put "00" into xz
if length (xz) < 2 then put "0" before xz
set index = 1
repeat while (line (index) of field xz <> empty)
if line (index) of field xz contains zip then
report (xz)
set flag = 1
end if
set index = index + 5
end repeat
if flag = 0 then
put "To locate a dealer near you:" & RETURN & "Call 1-800-GO-TOYOTA!" into field "displayResults"
end if
put EMPTY into field "zipHole"
end if
end searchAndReport
on report zz
global index, zip, foist
if foist = 1 then put "The Toyota Dealer(s) nearest to zip code" && zip && "is(are):" & RETURN into field "displayResults"
put RETURN & line (index + 1) of field zz & RETURN & line (index + 2) of field zz & RETURN after field "displayResults"
put word 1 to 3 of line (index + 3) of field zz after field "displayResults"
set x = charToNum (char 1 of word 3 of line (index + 3) of field zz)
if (x < 48 OR x > 57) then put " " & word 4 of line (index + 3) of field zz after field "displayResults"
set x = charToNum (char 1 of word 4 of line (index + 3) of field zz)
if (x < 48 OR x > 57) then put " " & word 5 of line (index + 3) of field zz after field "displayResults"
set x = charToNum (char 1 of word 5 of line (index + 3) of field zz)
if (x < 48 OR x > 57) then put " " & word 6 of line (index + 3) of field zz after field "displayResults"
set x = charToNum (char 1 of word 6 of line (index + 3) of field zz)
if (x < 48 OR x > 57) then put " " & word 7 of line (index + 3) of field zz after field "displayResults"
put RETURN & "(" & char 1 to 3 of line (index + 4) of field zz ¼
& ") " & char 4 to 6 of line (index + 4) of field zz ¼
& "-" & char 7 to 10 of line (index + 4) of field zz & return after field "displayResults"
set foist = 0
end report