Defaults When Writing Files

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
smith8867
Posts: 57
Joined: Tue Nov 18, 2014 5:36 pm

Defaults When Writing Files

Post by smith8867 » Wed Oct 12, 2016 5:08 pm

I have this piece of code:

Code: Select all

ask file "Please choose where you want to save the file..."
   if the result is not "Cancel" then
      put it into fileLocation
   end if
   put outputData into url("file:" &fileLocation)
Is there a way I can change the defaults that are shown here:
Image

Thanks!

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Defaults When Writing Files

Post by AndyP » Wed Oct 12, 2016 5:43 pm

Try this from the dictionary as an example.
ask file "Please choose where you want to save the file..." with filter "JPEG file,*.jpg"
Andy .... LC CLASSIC ROCKS!

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Defaults When Writing Files

Post by MaxV » Fri Oct 14, 2016 10:01 am

Please note, that the follwing codes have different results (note the ";"):

Code: Select all

ask file "Export picture as:" with filter "Image file, *.jpg; *.gif"

Code: Select all

ask file "Export picture as:" with filter "Jpeg image, *.jpg, Gif image,*.gif"
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Defaults When Writing Files

Post by Klaus » Fri Oct 14, 2016 12:45 pm

Hi Mr. Smith,

the question is do your users know what kind of file your app will output?
I mean do they know what filetype/suffix to use?

If not then this is "moot", since you will write the file in the neccessary format and with the correct suffix.
Know what I mean? Does not make sense if the user selects e.g "JPEG" but your app will just write a TXT file.


Best

Klaus

smith8867
Posts: 57
Joined: Tue Nov 18, 2014 5:36 pm

Re: Defaults When Writing Files

Post by smith8867 » Mon Oct 17, 2016 12:24 am

The program will always output a text file, at least that is the idea.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Defaults When Writing Files

Post by Klaus » Mon Oct 17, 2016 1:26 pm

smith8867 wrote:The program will always output a text file, at least that is the idea.
In that case it does not make sense at all to let the user select a filetype, right?
Just ask for a filename and then output your TXT file, you can even omit the suffix, if you like!

Post Reply