DragDrop.GetPath
----------------

Queries the native path of a file drop.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DragDrop](component_DragDrop.md) | [2.4](newinversion24.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "DragDrop.GetPath"; droparea { ; Index } ) 

**MBS**( **"DragDrop.GetPath";** /\* Queries the native path of a file drop. \*/  
**$droparea**; /\* The reference ID for this drop area.e.g. $dropHandle \*/   
**$Index**) /\* Optional; Optional index for the file path. Index goes from 0 to [DragDrop.GetPathCount](DragDropGetPathCount.md)-1.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| droparea | The reference ID for this drop area. | $dropHandle |  |
| Index | Optional index for the file path. Index goes from 0 to [DragDrop.GetPathCount](DragDropGetPathCount.md)-1. | 0 | Optional |

### Result

The path or empty value.

### Description

Queries the native path of a file drop.   
Call this function in the drag action script.   
  
For an email drag from Apple Mail, this function may give the path to a copy of the email file in temporary folder.  
Use [Path.NativePathToFileMakerPath](PathNativePathToFileMakerPath.md) to convert to a FileMaker path if you plan to use "filemac:" for an insert file script step.   
Added Windows support for MBS Plugin 8.1.  
  
If a picture is dropped and it is not a file, but a picture itself, check [DragDrop.GetPicture](DragDropGetPicture.md) function for it.   
On Windows, drops may not include file as paths, but a file descriptor. You need to use [DragDrop.GetFileDescriptor](DragDropGetFileDescriptor.md) function to query data.  
### Examples

Process paths in Drag &amp; Drop:

 Set Variable \[ $count ; Value: MBS ("[DragDrop.GetPathCount](DragDropGetPathCount.md)"; $dropview ) \]   
If \[ $count &gt; 0 \]   
 Set Variable \[ $index ; Value: 0 \]   
 Loop  
 Pause/Resume Script \[ Duration (seconds): ,1 \]   
 Set Variable \[ $path ; Value: MBS ("DragDrop.GetPath"; $dropview ; $index ) \]   
 If \[ Length ( $path ) &gt; 0 \]   
 If \[ MBS ("[Files.FileExists](FilesFileExists.md)"; $path ) = 0 \]   
 # File not yet written? Wait a bit  
 Pause/Resume Script \[ Duration (seconds): 1 \]   
 End If  
 New Record/Request  
 Set Field \[ DragTest::field ; MBS ("[Files.ReadFile](FilesReadFile.md)"; $path ; "auto") \]   
 Set Field \[ DragTest::Text ; $path \]   
 Set Field \[ DragTest::Description ; "Got via path list" \]   
 Commit Records/Requests \[ With dialog: Off \]   
 End If  
 # next  
 Set Variable \[ $index ; Value: $index +1 \]   
 Exit Loop If \[ $index = $count \]   
 End Loop  
End If  
Stores files in records:

 Set Variable \[ $dropview ; Value: Get(ScriptParameter) \]   
Set Variable \[ $count ; Value: MBS ("[DragDrop.GetPathCount](DragDropGetPathCount.md)"; $dropview ) \]   
// Show Custom Dialog \[ "Number of files: " &amp; $count \]   
Set Variable \[ $index ; Value: 0 \]   
If \[ $count &gt; 0 \]   
 Loop  
 Set Variable \[ $OSPfad ; Value: MBS ("DragDrop.GetPath"; $dropview ; $index ) \]   
 Set Variable \[ $FMPfad ; Value: MBS ( "[Path.NativePathToFileMakerPath](PathNativePathToFileMakerPath.md)"; $OSPfad ) \]   
 #   
 If \[ MBS ("[Files.FileExists](FilesFileExists.md)"; $OSPfad ) \]   
 Go to Layout \[ “MIX” ; Animation: None \]  
 New Record/Request  
 #   
 Set Field \[ MIX::Path ; $OSPfad \]   
 Set Field \[ MIX::Name ; MBS ( "[Path.LastPathComponent](PathLastPathComponent.md)"; $OSPfad ) \]   
 #   
 Go to Field \[ MIX::Image \]   
 Insert Picture \[ Reference ; “$FMPfad ” \]   
 #   
 Commit Records/Requests \[ With dialog: Off \]   
 Go to Layout \[ original layout ; Animation: None \]  
 End If  
 #   
 Set Variable \[ $index ; Value: $index +1 \]   
 Exit Loop If \[ $index = $count \]   
 End Loop  
End If  
### See also

- [DragDrop.GetLeft](DragDropGetLeft.md)
- [DragDrop.GetPathList](DragDropGetPathList.md)
- [DragDrop.GetPicture](DragDropGetPicture.md)
- [DragDrop.GetSVG](DragDropGetSVG.md)
- [DragDrop.GetText](DragDropGetText.md)
- [DragDrop.GetTop](DragDropGetTop.md)
- [DragDrop.SetTag](DragDropSetTag.md)
- [Files.FileExists](FilesFileExists.md)
- [Path.LastPathComponent](PathLastPathComponent.md)
- [Path.NativePathToFileMakerPath](PathNativePathToFileMakerPath.md)

### Release notes

- **Version 15.0**
    - Added [DragDrop.GetPathList](https://www.mbsplugins.eu/DragDropGetPathList.shtml) function.

### Example Databases

- [Drag and Drop/DragTest Popover](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Drag%20and%20Drop/DragTest%20Popover.shtml#3ScriptAnchor_)
- [Drag and Drop/DragTest](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Drag%20and%20Drop/DragTest.shtml#3ScriptAnchor_)
- [Drag and Drop/for Mac/DragTest multiple picture files](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Drag%20and%20Drop/for%20Mac/DragTest%20multiple%20picture%20files.shtml#3ScriptAnchor_)
- [Mac and iOS/Machine Learning/Core ML Photos](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Machine%20Learning/Core%20ML%20Photos.shtml#5ScriptAnchor_)
- [Mac and iOS/PDFKit/PDF Merge Shrink Tool](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/PDF%20Merge%20Shrink%20Tool.shtml#3ScriptAnchor_)

### Blog Entries

- [New in MBS FileMaker Plugin 15.0](https://www.mbsplugins.de/archive/2025-01-21/New_in_MBS_FileMaker_Plugin_15/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 3 - Drag &amp; Drop](https://www.mbsplugins.de/archive/2024-12-03/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [Drag and drop in combination with overlays](https://www.mbsplugins.de/archive/2024-08-05/Drag_and_drop_in_combination_w/monkeybreadsoftware_blog_filemaker)
- [Adding Drag and Drop receiver to a layout](https://www.mbsplugins.de/archive/2018-10-08/Adding_Drag_and_Drop_receiver_/monkeybreadsoftware_blog_filemaker)
- [Accept file drops in Filemaker with MBS Plugin](https://www.mbsplugins.de/archive/2012-08-20/Accept_file_drops_in_Filemaker/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.4pr8](https://www.mbsplugins.de/archive/2011-07-04/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 4/2025, Seite 31 bis 32](https://filemaker-magazin.de/neuigkeit/4297-Appetithappen-FMM_202504)
- [Ausgabe 2/2020, Seite 38](https://filemaker-magazin.de/neuigkeit/4089-Appetithappen-FMM_202002)

This function checks for a license.

Created 18th August 2014 , last changed 8th June 2020

  
[DragDrop.GetMouseY](DragDropGetMouseY.md) - [DragDrop.GetPathCount](DragDropGetPathCount.md)

[HTML Version](DragDropGetPath.shtml)