ask file with filter

Cubist at aol.com Cubist at aol.com
Mon Apr 19 09:26:42 EDT 2004


sez janschenkel at yahoo.com
><webmaster at dreamscapesoftware.com> wrote:
>> How do I get the filter that was choosen within the
>> ask file dialog box?
>
>There is currently no way to do that ; but you could
>always check the extension of the file :
>
>  answer "Select a file"
>  if it is empty then exit to top
>  put it into tFilePath
>  put char -3 to -1 of tFilePath into tExtension
   I don't think you can count on a file extension *always* being 3 
characters. Consider all those ".html" files out there, for instance. Therefore, it 
might be best to modify this code as follows:

  answer "Select a file"
  if it is empty then exit to top
  put it into tFilePath
  set the itemDelimiter to "." # i.e., period
  put the last item of tFilePath into tExtension

   You may get into trouble with files that don't actually *have* an 
extension... but then again, such files could yield problematic results with the 
*original* code, too, so I think the ability to handle 4-character extensions is a 
win, overall.
   Hope this helps...


More information about the use-livecode mailing list