Getting File Type

JB sundown at
Mon Aug 11 06:45:58 CEST 2014

The Standard library would not give me the
file type when I tried it so here is a handler
I wrote that will give the file type.

on mouseUp
   answer files "Select the file you want the type info"
   put the longFilePath of line 1 of it into filePath
   put number of chars in filePath into n
   put "false" into geType
   put empty into theType
   repeat for n times
      if geType = "false" then put char n of filePath before theType
      put n - 1 into n
      if char n of filePath = "." then put "true" into gType
      if gType = "true" then exit repeat
   end repeat
   --put theType into fld id 1098
   ask "File Type" with theType
end mouseUp

I am sure someone can write it better but it works.

John Balgenorth

More information about the use-livecode mailing list