Is there a way to determine the user selected format of the types provided to the ask file command?
I'm trying to make a "save as" option for exporting data tables. I know I can work around the issue if there is not a way of getting the selection from the ask file dialog, but it would be simpler for my users to use the ask file dialog types.
ask file - user selected type
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
That is what I thought at first, but I'm unable to get this information from the result. Do you have an example?
Here is what I'm testing with:
ask file "Please name the file:" with type "CSV File|csv|CSV" or type "TAB File|tab|TAB" as sheet
if it is empty then
answer "it is empty"
else
answer it
end if
"it" only contains the path and file name specified by the user. Selecting either format type doesn't appear to change anything. Is the selected format type stored somewhere else? Thanks.
Here is what I'm testing with:
ask file "Please name the file:" with type "CSV File|csv|CSV" or type "TAB File|tab|TAB" as sheet
if it is empty then
answer "it is empty"
else
answer it
end if
"it" only contains the path and file name specified by the user. Selecting either format type doesn't appear to change anything. Is the selected format type stored somewhere else? Thanks.
Dear Weasel73,
ask file "Please name the file:" with type "CSV File|csv|CSV " or type "TAB File|tab|TEXT" or type "TEXT File|txt|TEXT" as sheet
put the result into rslt
if it is not empty then
answer rslt & cr & it
else
answer "it is empty
end if
Kindest regards,
Mark
ask file "Please name the file:" with type "CSV File|csv|CSV " or type "TAB File|tab|TEXT" or type "TEXT File|txt|TEXT" as sheet
put the result into rslt
if it is not empty then
answer rslt & cr & it
else
answer "it is empty
end if
Kindest regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Livecode Opensource Backer
Note that to check up information about file types, a posteriori, on Macs, you can always use detailed files or long files
From the docs:
From the docs:
The detailed files form returns a list of files, one file per line. Each line contains the following attributes, separated by commas:
* The file's name, URL-encoded
* The file's size in bytes (on Mac OS and OS X systems, the size of the file's data fork)
* The resource fork size in bytes (Mac OS and OS X systems only)
* The file's creation date in seconds (Mac OS, OS X, and Windows systems only)
* The file's modification date in seconds
* The file's last-accessed date in seconds (Unix and Windows systems only)
* The file's last-backup date in seconds (Mac OS and OS X systems only)
* The file's owner (Unix systems only)
* The file's group owner (Unix systems only)
* The file's access permissions
* The file's creator and file type (Mac OS and OS X only)
Any attribute that is not supported on the current system is reported as "0" (zero).