TrFile_CreateAlias (function reference)

By May 1, 2017May 20th, 2020Online 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 )


switchesmodifies the behavior of the function
sourcePaththe path to the file, folder or disk of which an alias (shortcut) must be created
destAliasSpecthe 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:

0no errorThe alias was created
$$-43fnfErrSource file/folder not found
$$-48dupFNErrDestination alias already exists

Other errors may be returned.

Originated in

Troi File Plug-in 8.5


FileMaker Pro 15 to 19


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

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 15 to 19 –> TrFile_CreateAlias (filep4306) 2020-0520 15:53:46