Skip to main content

Unmount Disk (script step reference)

By June 1, 2024June 4th, 2024Online Help, Troi File Plug-in
Troi File Plug-in for FileMaker Pro

Unmount Disk

Unmounts and ejects a remote or removable disk.

SyntaxScript step badge

Unmount Disk [ Select ; Result (error) ; Disk name ]

Options

Select entire contents replaces the entire 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
Disk name 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 9.0

Compatibility

FileMaker Pro 17 to FileMaker Pro 21 (2024)

Considerations

On macOS it is possible to have multiple disks with the same name. In this case the function will unmount the first disk that matches the disk name parameter.

Example

Unmount Disk [ Select ; $ErrorCode ; "Mac HD:" ]

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

Unmount Disk [ Select ; $ErrorCode ; "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 OS). In a script add the following script step, which will eject the disk specified by gDiskName:

Unmount Disk [ Select ;  gErrorCode ; gDiskName ]

Related script stepScript step badge

Mount Disk

Related functionFunction badge

TrFile_UnmountDisk

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 17 to 2024 –> Unmount Disk (filep7290) 2024-0604 19:43:37