Skip to main content

TrFile_GetIcon (function reference)

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


Gets the icon of a file and returns it as a PNG image.

SyntaxFunction badge

TrFile_GetIcon ( switches ; filePath ; {iconName} )


switches these determine the properties of the image that is returned
filePath the path to the file from which to get the icon
iconName (optional) the (internal) name of the created PNG image


Switches can be empty or one or more of the following:

-Size=64 (default) maximum size of the height or width is 64 pixels
-Size=128 maximum size of the height or width is 128 pixels
-Size=256 maximum size of the height or width is 256 pixels

You can also add these switches:

-RetinaResolution create icons with double resolution (144 dpi), ideal for displaying on retina screens

Returned Result

Data type returned



The returned result is a PNG thumbnail of the icon. If an error occurs an error code is returned. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:

$$-2003 cantFindHandler No icon could be created

Other errors may be returned.

Originated in

Troi File Plug-in 8.6


FileMaker Pro 17 to FileMaker Pro 21 (2024)


The optional iconName is added to the created image data and also when the image is stored in the container. This name is normally not visible, but will be used for example when you perform an Export Field Contents action later.

You can also use FileMaker styled paths, like “filemac:/MacHD/folder/myData.doc”.


Set Field [ container field ; TrFile_GetIcon ( "-Unused" ; "Mac HD:sample.pdf" ) ]

This will create a PNG thumbnail image of the icon of the PDF file and put it in a container field.

Used in example file


Related functionFunction badge


Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 17 to 2024 –> TrFile_GetIcon (filep4307) 2024-0604 19:13:50