save as for text file?
Rich Lague
laguer at ucs.orst.edu
Sat Jul 17 15:48:08 EDT 2004
I'm trying to create an application in which the user will fill in a
table field. I would then like to let the user save that field as a
text file under a name they chose.
This was my first attempt:
on mouseUp
ask "Save list as..."
set the defaultFolder to "/Users/rlague/Documents/Revolution-iB/RFP
projecto/7.2i"
put field "daTable" into URL "file:it.txt"
end mouseUp
This script did work-- it saved the file, but the file name was "it.txt"
For my second attempt I copied most of a script from Dan Shafer's book
(page 218,)--
on mouseUp
ask "Save list as..."
set the defaultFolder to "/Users/rlague/Documents/Revolution-iB/RFP
projecto/7.2i"
open file it
write card field "daTable" to file it
close it
end mouseUp
This worked to the extent that a file was created with the correct
name, but the file was empty.
For my third try I copied Dan Shafer's script very carefully--
on mouseUp
ask file "Save list as..." with "Temp"
open it
write card field "daTable" to file it
close it
end mouseUp
With this script I get an error message: "Chunk: error in object
expression" and no file is created.
If I make a slight change in this script--
on mouseUp
ask file "Save list as..." with "Temp"
open it
write card field "daTable" to file it
close file it
end mouseUp
I do not get the error message, but no file is created.
So, is there a way to do what I'm trying?
Thanks!
Rich Lague
More information about the use-livecode
mailing list