Saveing and entire card?

Mark Smith mark at maseurope.net
Sun Mar 13 12:45:01 EST 2005


On 13 Mar 2005, at 17:00, Kevin J wrote:

> Say you have 5 text fields on one card is it possible to have them all
> save to one file that the user names?

Yes, you just have to concatenate the fields into a variable and then 
write the variable to the file

put field 1 into temp
put cr & field 2 after temp
put cr & field 3 after temp
put cr & field 4 after temp
put cr & field 5 after temp

put temp into URL "file:" & fileName

Exactly how you do this depends on what's in the fields (is there more 
than one line in each field?), and whether or not you're going to want 
to read the file back into the separate fields. If there's only one 
line of text in each field then the above would give you a file 
containing five lines of text. To repopulate the fields from the file 
you would do something like

put URL fileName into temp
put line 1 of temp into fld 1
put line 2 of temp into fld 2 etc...

If any of the fields contains more than one line, you'll need to use 
something other than cr as the delimiter, and so line references won't 
be appropriate, but you could use any character that you're sure won't 
be in the actual text ('^' perhaps) and then set the itemDelimiter to 
that, and refer to the different fields' text as items.

Cheers,

Mark



More information about the use-livecode mailing list