Saving User-Entered Text (The Solution)

Klaus Major k_major at os.surf2000.de
Tue Jan 28 07:00:01 EST 2003


Hi Joseph,

>> ...
>> 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.

That's coooool.
But i would not rely on that ;-)

> Also note that the slashes (/) are backwards from normal Windows file 
> path slashes (\) for some reason.

That's the way pathnames are handled in RR.
They do it internally the "unix" way and the engines will translate to 
the proper
platform path :-)


Regards

Klaus Major
k_major at os.surf2000.de




More information about the use-livecode mailing list