TrFile_GetIcon (function reference)

By May 1, 2017 May 22nd, 2019 Online 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} )


switchesthese determine the properties of the image that is returned
filePaththe 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=128maximum size of the height or width is 128 pixels
-Size=256maximum size of the height or width is 256 pixels

You can also add these switches:

-RetinaResolutioncreate 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:

$$-2003cantFindHandlerNo icon could be created

Other errors may be returned.

Originated in

Troi File Plug-in 8.6


FileMaker Pro 14 to 18


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.

Related functionFunction badge


Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 14 to 18 –> TrFile_GetIcon (filep4307) 2019-0522 16:46:46