TrFile_UnmountDisk (function reference)

By January 1, 2021January 26th, 2021Online Help, Troi File Plug-in
Troi File Plug-in > Functions reference > TrFile_UnmountDisk
Troi File Plug-in for FileMaker Pro

TrFile_UnmountDisk

Unmounts and ejects a remote or removable disk.

SyntaxFunction badge

TrFile_UnmountDisk ( switches ; diskname )

Parameters

switches not used, reserved for future use. Leave blank or put "-Unused"
diskname the name of the disk to be unmounted or ejected

Returned Result

Data type returned

Error code

Result

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 disk was ejected.
$$-35 nsVolErr No such volume (Wrong disk name or not mounted).
$$-47 fBsyErr The disk is in use.
$$-5010 afpFileBusy Can’t eject as the disk is being shared.

Other errors may be returned.

Originated in

Troi File Plug-in 2.0

Compatibility

FileMaker Pro 16 to 19

Considerations

Best to use only on Ejectable Disks or remote servers.

Since version 2.6 this function is also available on Windows. However it does not eject removable media, like a CD-ROM.

Example

Set Field [ result ; TrFile_UnmountDisk ( "-Unused"; "Mac HD:" ) ]

This will eject the hard disk “Mac HD”, provided it is not the startup disk. On Windows an example is:

Set Field [ result ; TrFile_UnmountDisk ( "-Unused"; "K:" ) ]

This will unmount the mapped drive “K:”

Example 2

We assume that in your FileMaker file the following fields are defined:

  gErrorCode		Global, number
  gDiskName		Global, text

gFilePath should contain the path to the disk, for example “Archive CD:” (Mac). In a script add the following script step, which will eject the disk specified by gDiskName:

Set Field [ gErrorCode ; TrFile_UnmountDisk ( "-Unused" ; gDiskName ) ]

Used in example file

DiskMount.fmp12

Related functionsFunction badge

TrFile_DiskInfo
TrFile_MountDisk

Related script stepScript step badge

Unmount Disk

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 16 to 19 –> TrFile_UnmountDisk (filep4290) 2021-0126 11:05:08