TrFile_MountDisk |
Connect to a shared network volume, by mounting the disk. You can then for example read or save files on this disk.
Syntax
TrFile_MountDisk ( switches ; zone ; server ; disk ; { username ;
password } )
Parameters
switches | this modifies the behavior of the function |
zone | (optional) the name of the AppleTalk zone (on Windows this parameter is not used) |
server | on Mac the name of the Server, on Windows the UNC name of the share |
disk | on Mac the name of the disk, on Windows (optional) the drive letter to use |
username | (optional) the name of the user (if empty guest access is tried) |
password | (optional) the password of this user |
Switches
Switches can be empty or one of this on macOS :
-TwoWayEncryptPassword | (default) use a 2 way encrypted password to logon |
-OneWayEncryptPassword | use a 1 way encrypted password to logon |
-PlainPassword | send the password in plain text |
Switches can be empty or one of this on Windows:
-ReUseDriveLetter | (default) if the network disk already is mapped reuse that drive letter |
-AlwaysNewDriveLetter | always map a new drive letter |
Returned Result
Data type returned
Error code
Result
On Mac OS The returned result is an error code. If no error occurs a zero is returned.
On Windows the returned result is the drive letter or an error code. An example drive letter can be: “F:”
An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:
$$-35 | no such volume, disk not found | |
$$-50 | parameter error, check if the supplied parameters are correct | |
$$-5023 | the user is not authorized for this volume | |
$$-5000 | insufficient access privileges for operation | |
$$67 | (Windows) the specified UNC name is invalid or can not be found | |
$$1200 | (Windows) the specified drive letter is invalid. Enter a valid drive letter, like “K:” | |
$$2250 | (Windows) not connected to a network |
Originated in
Troi File Plug-in 2.6
Compatibility
FileMaker Pro 17 to FileMaker Pro 21 (2024)
Considerations
Due to differences in operating systems this function behaves a bit different on Mac compared to Windows. On Windows there is no zone name for example. See the platform specific examples below.
On macOS the plug-in also supports URL style AFP (AppleTalk File Protocol) servers. See also the examples below.
Regarding sending passwords on macOS: the plug-in always tries to use 2 way encrypted passwords. If, however, the server does not support this you can specify to use a one way encrypted password or a plain password, by giving the -OneWayEncryptPassword or -PlainPassword switch respectively.
On Windows the “server” parameter should be a UNC name, formatted like “\\servername\share”. Also on Windows the parameter “disk” indicates the drive letter to use, like “K:”. If empty the function picks a free drive letter.
IMPORTANT On some Windows implementations the username and password parameter have been switched. If you get a authorization error, try reversing the username and password!
After mounting the shared disk icon should appear on your desktop (on macOS) or in the My Computer folder (on Windows). Depending on your access privileges, you can copy files, create folders and use items on the shared disk as if they were on your local hard disk.
Example
Mac OS:
Set Field [ result ; TrFile_MountDisk ( "-Unused " ; "MacZone" ; "McServer" ; "Shared Disk" ; "George" ;
"secret" ) ]
Set Field [ result ; TrFile_MountDisk ("-Unused " ; "" ; "McServer" ; "Guest folder" ) ]
The first set field step will mount the hard disk “Shared Disk” of server “McServer” in zone “MacZone” using the user name “George” with password “secret”.
The second set field step will mount the volume “Guest folder” of server “McServer” using guest access. As the zone parameter is empty, the server can be in any zone.
The plug-in also supports URL style AFP servers names. For example a server on the intranet:
Set Field [ result ; TrFile_MountDisk ( "-Unused" ; "" ; "afp://192.168.1.55" ; "Shared Disk" ) ]
Starting with version 2.6.1 the plug-in also supports URL style WebDAV server names on Mac OS X 10.2 and later. For example an iDisk server:
Set Field [ result ; TrFile_MountDisk ( "-Unused" ; "" ; "http://idisk.mac.com/youridiskname" ; "" ) ]
You can also connect to servers on the public Internet, for example:
Set Field [ result ; TrFile_MountDisk ( "" ; "" ; "afp://tramp.tr.fh-hannover.de" ; "Oeffentliche_Software" ) ]
On Windows:
Set Field [ result ; TrFile_MountDisk ( "-ReUseDriveLetter" ; "unused zone" ; "\\Troi Server\Projects" ;
"" ; "George" ; "secret" ) ]
Set Field [ result ; TrFile_MountDisk ( "-Unused " ; "unused zone" ; "\\Troi Server\Projects" ; "Z:" ) ]
The first set field step will mount the share “Projects” of server “Troi Server”. using the user name “George” with password “secret”. The second set field step will mount the same share using guest access, and mounting it as drive “Z:”.
Used in example file
DiskMount.fmp12
Related functions
TrFile_DiskInfo |
TrFile_UnmountDisk |
Related script step
Mount Disk |
Related topics
Troi File Plug-in online help (overview)