Skip to main content

TrFile_GetFileType (function reference)

By June 1, 2024June 4th, 2024Online Help, Troi File Plug-in
Troi File Plug-in > Functions reference > TrFile_GetFileType
Troi File Plug-in for FileMaker Pro

TrFile_GetFileType

Returns the FileType for the file specified by the filePath.

SyntaxFunction badge

TrFile_GetFileType ( switches ; filePath )

Parameters

switches not used, reserved for future use. Leave blank or put "-Unused"
filePath the path to the file for which you want the information

Returned Result

Data type returned

Text

Result

The FileType is a 4 character code used to designate the type of file. For example: FileMaker 7 files have a FileType of “FMP7” and Applications have FileType of “APPL”.

Originated in

Troi File Plug-in 1.0

Compatibility

FileMaker Pro 17 to FileMaker Pro 21 (2024)

Considerations

FileType in macOS are not used much anymore, but are still supported. This function is not available in Windows.

If the file type is empty the function returns: “0000” (4 zero’s) .

You can use FileMaker styled paths, like “filewin:/C:/MyFiles/test.txt”.

Example

Set Field [ result ; TrFile_GetFileType ( "-Unused" ; "KES:test.fp7" ) ]

This will (probably) return “FMP7” which is the FileType for FileMaker Pro 7.

Example 2

We assume that in your FileMaker file the following fields are defined:

  fileType		text
  gFilePath		Global, text

gFilePath should contain the path to the file, for example “Mac HD:Logs:Log 1” (Mac). In a script add the following script step:

Set Field [ fileType ; TrFile_GetFileType ( "-Unused" ; gFilePath ) ]

This will store the FileType of the file specified by gFilePath in the field “fileType”.

Used in example file

Attribute.fmp12

Related functionsFunction badge

TrFile_GetFileCreator
TrFile_SelectFileDialog

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 17 to 2024 –> TrFile_GetFileType (filep4242) 2024-0604 19:12:45