Save field text to file

Mark Schonewille m.schonewille at economy-x-talk.com
Sun Dec 10 11:16:13 EST 2006


Hi Adrian,

The script should look like:

case "Save"
   ask file empty with "Untitled.txt"
   -- now, the variable 'it' contains a file path or
   -- it is empty if the user pressed Cancel
   if it is not empty then
     put it into myFile
     -- set filetype before creating a file
     set the filetype to "ttxtTEXT"
     put fld "edtText" into url ("file:" &  myFile)
   end if
   break


Don't forget: thou shalt always use quotes around literals! The name  
edtText should be surrounded by quotes.

Best regards,

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Get your store on-line within minutes with Salery Web Store software.  
Download at http://www.salery.biz

Op 10-dec-2006, om 16:16 heeft Adrian Williams het volgende geschreven:

> Mark,
> Thanks for that. Logical really. Just shows my newness to Rev!
>
> Your suggestion about filetype saves the text out to a file,
> but the file is Saved with the filename tFilePath. What's wrong
> with my code that "Untitled.txt" is not used?
>
>  case "Save"
>     ask file empty with "Untitled.txt"
>     put URL tURLfile into URL ("file:" & tFilePath)
>
>     set the filetype to "ttxtTEXT"
>     put fld edtText into url ("file:" &  tFilePath)
>     break
>
> Many thanks,
> Adrian





More information about the use-livecode mailing list