Page 1 of 1

Default folder path

Posted: Thu Oct 31, 2013 8:52 pm
by Rod Edwardson
Hello all

I have a need to save a fields contents to a .txt file and have that figured out. What I am having issues with is the right way to save the file in a specific folder. Right now its placed in the documents folder and Im wondering how to have a folder created within the documents folder and have the .txt file saved there. Any help would be appreciated. This is what I have functioning

Code: Select all

Put  Field "fld_title"of card "Step one"Into URL ("file:" & specialFolderPath("documents") & slash & "Title" & ".txt")

Re: Default folder path

Posted: Thu Oct 31, 2013 9:08 pm
by Simon
Hi Rod,
Just create the folder first:

Code: Select all

on mouseUp
   create folder  specialFolderPath("documents") & slash & "1Folder"
      Put  Field "fld_title"of card "Step one"Into URL ("file:" & specialFolderPath("documents") & slash & "1Folder/Title" & ".txt")
end mouseUp
Simon

Re: Default folder path

Posted: Thu Nov 07, 2013 10:28 pm
by Rod Edwardson
Works great! Thank you very much for the assistance.

Re: Default folder path

Posted: Thu Nov 07, 2013 10:40 pm
by nextyoyoma
Simon wrote:Hi Rod,
Just create the folder first
Can someone explain why we need to do that? I'm used to bash scripting, where you don't have to create a directory before writing a file to it. Would it not be simpler for LiveCode to create a directory if one does not exist?

Re: Default folder path

Posted: Thu Nov 07, 2013 10:54 pm
by Simon
I think you want to put that in the Feature Request forum.

Simon

Re: Default folder path

Posted: Thu Nov 07, 2013 11:02 pm
by nextyoyoma
Simon wrote:I think you want to put that in the Feature Request forum.

Simon
Will do. Just wasn't sure if there was some particularly important reason it didn't already work that way. Thanks!