Create an alias file (or shortcut) from the source file or source folder.
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|
Data type returned
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.
Troi File Plug-in 9.0
FileMaker Pro 16 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.
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.
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: 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 step