answer file with filter problem

Klaus Major klaus at major-k.de
Wed Mar 8 04:16:30 EST 2006


Hi Garrett,

> Rev 2.6.1
>
> Greetings,
> Am I doing something wrong with the answer file?
>   put "Please select a file:" into varOne
>   put "Text Files,*.txt" into varTwo
>   put "Open file" into varThree
>   answer file varOne with filter varTwo titled varThree
> I originally had this way:
>   answer file "Please select a file:" with filter "Text  
> Files,*.txt" titled "Open file"
> But either way, the files listed in the answer file dialog are all  
> blocked out and not accessible at all.

your script(s) above will work wonderfully on a windows pc :-)

But since you are using a mac (I guessed from your mail header,  
please do always
mention the platform you are using) you need another syntax ->  
"answer... WITH TYPE ..."

So you should script:
...
answer file "Please select a file:" with type "Text Files|txt| 
TEXTttxt" titled "Open file"
...

Or fill your variables accordingly.

This syntax is crossplaform and takes the FILETYPES on a Mac into  
account.
FILETYPES are going away in the future on OS X I am sure, and only  
suffixes
will be supported and that is also taken care of by this syntax.

If you don't know the necessary FILEPTYPE (last parameter), simply  
omit it, and on
OS X only files with the appropriate suffix will be shown in the dialog:

...
answer file "Please select a file:" with Type "Text Files|txt|"  
titled "Open file"
...

will also show all text files with the suffix ".txt"

The "delimiter" sign is the "pipe" = "|" = ALT-7 on a german keyboard

See also "answer file with type" in the docs.

Hope that helps.

> Thanks,
> -Garrett

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de




More information about the use-livecode mailing list