Skip to main content

Create Alias (script step reference)

Troi File Plug-in for FileMaker Pro

Create Alias

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

SyntaxScript step badge

Create Alias [ Select ; Result (error) ; Source path ;
               Destination aliasPath ]


Select entire contents replaces the contents of a field with the result. If not checked the result replaces the currently selected portion of the field
Result (error) an error code
Source path the path to the file, folder or disk of which an alias (shortcut) must be created
Destination aliasPath 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 9.0


FileMaker Pro 16 to FileMaker Pro 2023


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.


Create Alias [ Select ; $ErrorCode ; "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:
Create Alias [ Select ; $ErrorCode ; $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 script stepScript step badge

Create File

Related functionsFunction badge


Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 16 to 2023 –> Create Alias (filep7306) 2023-0601 16:19:05