Skip to main content

TrFile_CreateAlias (function reference)

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


Create an alias file (or shortcut) from the source file or source folder.

SyntaxFunction badge

TrFile_CreateAlias( switches ; sourcePath ; destAliasSpec )


switches modifies the behavior of the function
sourcePath the path to the file, folder or disk of which an alias (shortcut) must be created
destAliasSpec the path to the alias file

Returned Result

Data type returned

Error code


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

0 no error The alias was created
$$-43 fnfErr Source file/folder not found
$$-48 dupFNErr Destination alias already exists

Other errors may be returned.

Originated in

Troi File Plug-in 8.5


FileMaker Pro 17 to FileMaker Pro 21 (2024)


To make it easier to find a file, folder, app, or disk, you can create an alias for it in an easy-to-find location. When you open an alias in the Finder or Windows explorer, the original item opens.
On Windows this is called a shortcut, and always has the extension .lnk.


Set Field [ $ErrorCode ; TrFile_CreateAlias ( "-Unused" ; "D:\myReport2016.pdf"; 
			"C:\workDir\currentReport.pdf" ) ]

This will create the shortcut currentReport.pdf.lnk in the folder workDir, which links to the original myReport2016.pdf file.

Example 2

We assume that in your FileMaker file the following fields are defined and filled with the paths to the source file (or folder) and destination alias:

  this::sourcePath	may contain something like "MacHD:Users:kip:Report folder" 
  this::destAlias_Path	may contain something like "MacHD:Users:kip:Desktop:AliasToFolder" 

This example will first set the variables from the paths stored in the two fields, and then create the alias. In a script add the following steps:

# Initialize: copy the fields into variables first:
Set Variable [ $SourcePath ;  this::sourcePath ]
Set Variable [ $DestAlias ;  this::destAlias_Path ]

# Now create the alias:
Set Variable [ $ErrorCode ;  TrFile_CreateAlias ( "-Unused"  ; $SourcePath ; $DestAlias ) ]

# Return the resulting error code:
Exit Script [ $ErrorCode ]

This will create the alias based on the field contents. With the sample data the alias AliasToFolder will be created on the desktop and link back to the Report Folder.

Used in example file


Related functionsFunction badge


Related script stepScript step badge

Create Alias

Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 17 to 2024 –> TrFile_CreateAlias (filep4306) 2024-0604 19:24:32