HyperCard: Importing Tab-Separated Text (8/93)

Here is a simple script that will import tab-separated text into a
HyperCard 2.1 stack.


on mouseUp
answer file "Choose the file to import" of type TEXT
if it is empty then exit mouseUp
put it into fileName
open file fileName
repeat
read from file fileName until return
if it is empty then
close file fileName
answer "Your data has been imported."
exit mouseUp
end if
doMenu "New Card"
put it into oneRecord
set the itemDelimiter to tab
repeat with i = 1 to the number of fields
put item i of oneRecord into bg fld i
end repeat
end repeat
end mouseUp

Note: The script will not work with earlier versions of HyperCard because
it relies on the new ItemDelimiter property.


This article is adapted from the Claris Tech Info database.
Published Date: Feb 19, 2012