ask file with filter/type - how to read the selected type ?

Björnke von Gierke bvg at mac.com
Tue Jun 10 19:05:45 CDT 2008


You have to use the "ask file with type" form to know the file type  
selected within the dialogue, for example:

on mouseUp
ask file "" with type "PNG file|png|PNGf" or type "Plain file|txt|TEXT"
put it && the result
end mouseUp

message box:
/Users/bvg/Desktop/file.txt Plain file

Most likely "ask file with filter" will be marked as obsolete or  
discontinued in a not too distant future...

Have Fun
Björnke

On 10 Jun 2008, at 17:57, viktoras didziulis wrote:

> Jacqueline, Thanks for the suggestion,
>
> still 'the result' after execution is empty. It would probably  
> contain something if path selection failed. The other 'result' (path  
> stored in 'it') does not always contain an extension. If user types  
> it in, or chooses from a list of existing file names, then it is  
> there. But otherwise if user provides file name without an  
> extension, script has to check what was the file type selected,  
> appends correct extension and directs output to a necessary  
> processing handler. It knows file type just because it asked about  
> it before asking for the path. Now I guess if I wish to avoid  
> displaying a chain of dialogs, I have to design own custom askFile()  
> function or handler. The only role of ask file with type or ask file  
> with filter that is described in the dictionary seems to be limited  
> to displaying existing filenames whose types match the one selected  
> in the file type list...
>
> All the best!
> Viktoras
>
> J. Landman Gay wrote:
>> viktoras didziulis wrote:
>>> is there any way to know what file type user selects in ask file  
>>> with filter dialog ? I need to specify different handlers for file  
>>> "Save as", and now am first asking user to select the type of a  
>>> desired output (i.e. raw binary, ascii text, png image or ppm  
>>> image) and next opening ask file dialog to get the path for saving  
>>> the data. But I know "this is not good", because users are used to  
>>> a single dialog for file saving where they choose save as type and  
>>> the data is processed without any additional disturbances... The  
>>> problem is that the selection of ask file dialog is returned in  
>>> 'it' variable but the selected type of file in the dropdown list  
>>> of that dialog is not returned in any readable way, or is it?..
>>
>> Check the result after the user selects a file. The tag is in there.
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list