Selecting a file to open using the answer function

Want to move your code and projects to LiveCode but don't know where to start?

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller

Post Reply
drhoward
Posts: 22
Joined: Tue Dec 10, 2013 9:03 am

Selecting a file to open using the answer function

Post by drhoward » Fri May 01, 2015 9:02 am

I'm working on a program that reads a csv file and am using the answer file function. The function has a parameter to specify the file type. However, when I get to the directory containing my file, all of the files are displayed, not just the csv files. I've tried various ways of entering the parameter; with a period as in .csv, without the period as in csv, with and without quotes, etc. Can someone please make a suggestion as to the correct syntax to use?

Here is a sample of the code that I've been using:

answer file "Select the text file to read" with type "csv"

Thanks

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2207
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Selecting a file to open using the answer function

Post by jmburnod » Fri May 01, 2015 9:26 am

Hi,
I think you have to use "answer with type" like this :

Code: Select all

 answer file "Select an image" with type ("JPEG files|jpg,jpeg|JPEG,JFIF" & return & "Any file||*")
Best regards
Jean-marc

drhoward
Posts: 22
Joined: Tue Dec 10, 2013 9:03 am

Re: Selecting a file to open using the answer function

Post by drhoward » Fri May 01, 2015 5:57 pm

Thank you! This worked.

Post Reply

Return to “Converting to LiveCode”