KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Finding Uniform Type Identifier in OS X
PRODUCT: 4D | VERSION: 13.2 | PLATFORM: Mac
Published On: February 15, 2013

Finding Uniform Type Identifier in OS X

Uniform Type Identifier is a string text used since OS X 10.4 to identify the class or type of item (e.g. document, image, folder, application data) allowing developers to add their own UTI to an application. This is useful when trying to open a file in 4D as shown in the example.

Example from Select Documents command: https://doc.4d.com/4Dv13.2/help/Command/en/page905.html

C_LONGINT($platform)
PLATFORM PROPERTIES($platform)
C_TEXT($DocType)
C_LONGINT($Options)
C_TEXT($Doc)

If ($platform=Windows)
   $DocType:=".4DD"
Else
   $DocType:="com.4d.4d.data-file" //UTI type
End if
$Options:=Alias selection+Package open+Use Sheet Window
$Doc:=Select document("";$DocType;"Select the data file";$Options)


What if the UTI is not known?

Open Terminal and type "mdls" + "location of file trying to find the UTI" (You can also drag and drop the file in terminal after typing mdls).

The terminal will display (kMDItemContentType = ""). In the quotes will be the UTI information.



This will allow users to find the Uniform Type Identifier newer than the published list by Apple.
https://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259-SW1