Getting the type code of a file under OSX
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Sat Jul 30 07:19:52 EDT 2005
Hi Dave,
You are perfectly right: I missed this one.
So a reliable function could be:
function CreatorAndType pFilePath
local tDefaultFolder,tFile,tCreatorType
-----
if the platform <> "MacOs" then return "Error: filetype not
supported"
put the defaultFolder into tDefaultFolder
set the itemdel to slash
set the defaultFolder to item 1 to -2 of pFilePath
put urlDecode(the detailed files) into tFile
filter tFile with item - 1 of pFilePath & ",*"
if tFile = empty then return "Error: could not find file"
set the defaultFolder to tDefaultFolder
set the itemDel to comma
put item 11 of tFile into tCreatorType
if tCreatorType = empty then return "Error: could not find the
filetype"
return char 1 to 4 of item 11 of tFile & comma & char 5 to 8 of
item -1 of tFile
end CreatorAndType
Le 30 juil. 05 à 13:07, Dave Cragg a écrit :
> On 30 Jul 2005, at 10:40, Eric Chatonet wrote:
>
>
>> Hi Brian,
>>
>> As the files function returns a list sorted by alphabetical order,
>> I don't think it's necessary.
>>
>
>
> But, for example, if you were looking for a file named "mend.png"
> and there was a file named "amend.png" in the folder, you'd find
> "amend.png".
>
> A bit cumbersome, but when I've done this, I've repeated through
> all lines in the detailed files and done a match on the first item
> in each.
>
> Cheers
> dave
Best Regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
So Smart Software
For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch
Free plugins and tutorials on my website
----------------------------------------------------------------
Web site http://www.sosmartsoftware.com/
Email eric.chatonet at sosmartsoftware.com/
Phone 33 (0)1 43 31 77 62
Mobile 33 (0)6 20 74 50 86
----------------------------------------------------------------
More information about the use-livecode
mailing list