Platforms to show: All Mac Windows Linux Cross-Platform

Back to UTTypeMBS module.

UTTypeMBS.ConformsTo(UTI as string, ConformsToUTI as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Launch Services MBS MacOSX Plugin 8.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Checks whether a type is a subtype of the second type.
Example
if UTTypeMBS.ConformsTo("public.jpeg","public.image") then
MsgBox "ConformsTo"
else
MsgBox "not ConformsTo"
end if

UTTypeMBS.CreateAllIdentifiersForTag(inTagClass as string, inTag as string, inConformingToUTI as string) as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Launch Services MBS MacOSX Plugin 8.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an array of all uniform type identifiers indicated by the specified tag.
Example
MsgBox join(UTTypeMBS.CreateAllIdentifiersForTag(UTTypeMBS.kUTTagClassFilenameExtension, "txt", ""))
// shows "public.plain-text"

MsgBox join(UTTypeMBS.CreateAllIdentifiersForTag(UTTypeMBS.kUTTagClassFilenameExtension, "xml", ""))
// shows "public.xml com.apple.dashcode.xml"

An overloaded tag (e.g., an extension used by several applications for different file formats) may indicate multiple types. If no declared type identifiers have the specified tag, then a single dynamic type identifier will be created for the tag. Optionally, the returned type identifiers must conform to the identified "conforming-to" type argument. This is a hint to the implementation to constrain the search to a particular tree of types. For example, the client may want to know the type indicated by a particular extension tag. If the client knows that the extension is associated with a directory (rather than a file), the client may specify "public.directory" for the conforming-to argument. This will allow the implementation to ignore all types associated with byte data formats (public.data base type).

UTTypeMBS.CreatePreferredIdentifierForTag(inTagClass as string, inTag as string, inConformingToUTI as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Launch Services MBS MacOSX Plugin 8.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a uniform type identifier for the type indicated by the specified tag.
Example
MsgBox UTTypeMBS.CreatePreferredIdentifierForTag(UTTypeMBS.kUTTagClassFilenameExtension, "jpg", "")
// shows "public.jpeg"
MsgBox UTTypeMBS.CreatePreferredIdentifierForTag(UTTypeMBS.kUTTagClassOSType, "TIFF", "public.image")
// shows "public.tiff"

This is the primary function to use for going from tag (extension/MIMEType/OSType) to uniform type identifier. Optionally, the returned type identifiers must conform to the identified "conforming-to" type argument. This is a hint to the implementation to constrain the search to a particular tree of types. For example, the client may want to know the type indicated by a particular extension tag. If the client knows that the extension is associated with a directory (rather than a file), the client may specify "public.directory" for the conforming-to argument. This will allow the implementation to ignore all types associated with byte data formats (public.data base type). If more than one type is indicated, preference is given to a public type over a non-public type on the theory that instances of public types are more common, and therefore more likely to be correct. When there a choice must be made between multiple public types or multiple non-public types, the selection rules are undefined. Clients needing finer control should use CreateAllIdentifiersWithTag. If no declared type is indicated, a dynamic type identifier is generated which satisfies the parameters.

Some examples using this method:

UTTypeMBS.DeclaringBundleURL(UTI as string) as folderitem

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Launch Services MBS MacOSX Plugin 8.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the folderitem of the bundle containing the type declaration of the identified type.
Example
MsgBox UTTypeMBS.DeclaringBundleURL("public.jpeg").NativePath

UTTypeMBS.Description(UTI as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Launch Services MBS MacOSX Plugin 8.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the localized, user-readable type description string.
Example
MsgBox UTTypeMBS.Description("public.jpeg") // "JPEG-Bild" in German

UTTypeMBS.Equal(UTI as string, SecondUTI as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Launch Services MBS MacOSX Plugin 8.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Checks whether two types are equal.
Example
if UTTypeMBS.Equal("public.jpeg","public.jpeg") then
MsgBox "equal"
else
MsgBox "not equal"
end if

Returns true if both UTIs are equal.

UTTypeMBS.PreferredTagWithClass(inUTI as string, inTagClass as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Launch Services MBS MacOSX Plugin 8.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the identified type's preferred tag with the specified tag class as a String.
Example
MsgBox UTTypeMBS.PreferredTagWithClass("public.jpeg",UTTypeMBS.kUTTagClassMIMEType)
// shows "image/jpeg"
MsgBox UTTypeMBS.PreferredTagWithClass("public.jpeg",UTTypeMBS.kUTTagClassFilenameExtension)
// shows "jpeg"

This is the primary function to use for going from uniform type identifier to tag. If the type declaration included more than one tag with the specified class, the first tag in the declared tag array is the preferred tag.

UTTypeMBS.UTI(file as folderitem) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Launch Services MBS MacOSX Plugin 8.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Queries the UTI for a given file.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.xojo_binary_project")
MsgBox UTTypeMBS.UTI(f) // shows com.xojo.project.binary

Returns "" if no UTI is available.

The items on this page are in the following plugins: MBS MacOSX Plugin.


The biggest plugin in space...