Default folder path

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Rod Edwardson
Posts: 23
Joined: Sun Mar 03, 2013 1:09 am

Default folder path

Post by Rod Edwardson » Thu Oct 31, 2013 8:52 pm

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")

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Default folder path

Post by Simon » Thu Oct 31, 2013 9:08 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Rod Edwardson
Posts: 23
Joined: Sun Mar 03, 2013 1:09 am

Re: Default folder path

Post by Rod Edwardson » Thu Nov 07, 2013 10:28 pm

Works great! Thank you very much for the assistance.

nextyoyoma
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 37
Joined: Sat Oct 06, 2012 6:29 am

Re: Default folder path

Post by nextyoyoma » Thu Nov 07, 2013 10:40 pm

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?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Default folder path

Post by Simon » Thu Nov 07, 2013 10:54 pm

I think you want to put that in the Feature Request forum.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

nextyoyoma
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 37
Joined: Sat Oct 06, 2012 6:29 am

Re: Default folder path

Post by nextyoyoma » Thu Nov 07, 2013 11:02 pm

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!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”