save as for text file?

Derek Bump webmaster at dreamscapesoftware.com
Sat Jul 17 17:02:02 EDT 2004


Try This...

on mouseUp
  put cd fld "daTable" into tableData
  
  ask "Save File As..." with "untitled.txt"
  if it is empty then exit mouseUp
  put it into targetFileName

  set the defaultFolder to "/Users/rlague/Documents/Revolution-iB/RFPprojecto/7.2i/"
  
  open file targetFileName
  write tableData to file targetFileName
  close file targetFileName
end mouseUp
 

Derek Bump
Dreamscape Software
____________________________________________
Compress Images Easily with JPEGCompress
http://www.dreamscapesoftware.com
 

----- Original Message ----- 
From: "Rich Lague" <laguer at ucs.orst.edu>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: Saturday, July 17, 2004 1:48 PM
Subject: save as for text file?


> 
> 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
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 


More information about the use-livecode mailing list