Newbie again
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Newbie again
All I want to do is open a text file and display it in a text field, modify it, then save it again. I can use the Answer command, but that gives me the path. How do I get the contents of the file? I've used Live code a long time ago (RunRev era), but the new dictionary is perplexing to me, and I can't remember how I loaded, searched, edited, and saved the text file. Can someone point me in the right direction?
Re: Newbie again
Hi dhobbs,
Best
Klaus
Code: Select all
## Load file into field:
...
answer file "Select text file:"
put IT into tFile
## User CANCELled
if the result = "cancel" then
exit to top
end if
## Load file into field:
put url("file:" & tFile) into fld "your field here..."
...
Code: Select all
## Save field content to file:
...
put specialfolderpath("desktop") & "/your file.txt" into tFile
put fld "your field here..." into url("file:" & tFile)
...
Klaus
Re: Newbie again
Code: Select all
## Save field content to file:
...
put specialfolderpath("desktop") & "/your file.txt" into tFile
put fld "your field here..." into url("file:" & tFile)
...
You could also use a combination of the above in an 'if/then' branch off.

Re: Newbie again
Perfect, thanks.
I totally forgot about the url keyword. Not particularly intuitive.
Appreciate it...
I totally forgot about the url keyword. Not particularly intuitive.
Appreciate it...