No subject


Fri Nov 19 08:05:59 EST 2021


> 2. write the field to a file and read it in again when necessary...
>
> on closecard
>    put fld "userinput" into url("file:userinput.txt")
> end closecard
>
> and:
>
> on opencard
>    put url("file:userinput.txt") into fld "userinput"
> end opencard
>
> et voila you are in the profesional "preferences writing"-business ;-)

Klaus, thanks for the excellent reply. And thanks to all the others who responded to this query. Your solution of using the URL keyword was just what I was looking for (although I wouldn't have guessed that user-modified fields aren't automatically saved in Rev :). I understand the security issues put forth in several other notes, but in my case the user is simply specifying a directory to save text files into. My near-final code looks like this (note: as I'm working on a Windows platform, please excuse the path name ;):

on openStack
  put URL "file:/Program Files/TextDisplay/savedir.txt" into fld "Directory"
end openStack

on closeStack
  put fld "Directory" into URL "file:/Program Files/TextDisplay/savedir.txt" 
end closeStack

I found it interesting that I didn't have to specify which drive (C:\ etc.) I wanted to read/write to even though I have several in my PC. Also note that the slashes (/) are backwards from normal Windows file path slashes (\) for some reason.

Again, thanks to all who responded with solutions to this problem.

joe.



More information about the use-livecode mailing list