Page 1 of 1

Saving data from three text fields into a single file

Posted: Mon Jan 30, 2012 12:53 am
by urbaud
I have a small program that has three text fields and each field has unique data in it. I wanted to save the data from each field into a single file so I wrote the code, posted below, to accomplish this task. However, I assume there must be another way(s) of doing the same thing, but I have been unable to think of alternate solutions. If there are other ways of accomplishing the same thing I’d be interested in seeing the code. I also believe there is a limit as to the amount of data that can be put into each item in the variable “onetwothree”, but I’m not sure what it is or whether this belief is correct.

Code: Select all

on mouseUp --save text from three flds into single file
   put fld "t1" into item 1 of onetwothree
   put fld "t2" into item 2 of onetwothree
   put fld "t3" into item 3 of onetwothree
   put onetwothree into url "file: test3fields.TXT"
end mouseUp

on mouseUp  --retrieve data and put into separate text flds
   get url "file: test3fields.TXT"
   put item 1 of it into fld "t1"
   put item 2 of it into fld "t2"
   put item 3 of it into fld "t3"
end mouseUp

Re: Saving data from three text fields into a single file

Posted: Mon Jan 30, 2012 2:49 am
by dunbarx
No limit on the data.

Your code handles your data simply and cleanly. What else could you ask for? I assume that commas doe not exist in your data, of course.

Craig Newman