Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
DragDrop.GetPath
Queries the native path of a file drop.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| DragDrop | 2.4 | Yes | Yes | No | No | No |
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| droparea | The reference ID for this drop area. Use functions like DragDrop.CreateWithControl to create a drop area. | $dropHandle | |
| index | Optional index for the file path. Index goes from 0 to DragDrop.GetPathCount-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 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 function for it.
On Windows, drops may not include file as paths, but a file descriptor. You need to use DragDrop.GetFileDescriptor function to query data.
Examples
Process paths in Drag & Drop:
Set Variable [ $count ; Value: MBS("DragDrop.GetPathCount"; $dropview) ]
If [ $count > 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 ) > 0 ]
If [ MBS("Files.FileExists"; $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"; $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"; $dropview) ]
// Show Custom Dialog [ "Number of files: " & $count ]
Set Variable [ $index ; Value: 0 ]
If [ $count > 0 ]
Loop
Set Variable [ $OSPfad ; Value: MBS("DragDrop.GetPath"; $dropview; $index) ]
Set Variable [ $FMPfad ; Value: MBS( "Path.NativePathToFileMakerPath"; $OSPfad) ]
#
If [ MBS("Files.FileExists"; $OSPfad) ]
Go to Layout [ “MIX” ; Animation: None ]
New Record/Request
#
Set Field [ MIX::Path ; $OSPfad ]
Set Field [ MIX::Name ; MBS( "Path.LastPathComponent"; $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
- DragDrop.GetPicture
- DragDrop.GetTag
- DragDrop.GetText
- DragDrop.GetURL
- DragDrop.GetWidth
- DragDrop.SetTag
- Files.FileExists
- Path.LastPathComponent
- Path.NativePathToFileMakerPath
Example Databases
- Drag and Drop/DragTest Popover
- Drag and Drop/DragTest
- Drag and Drop/for Mac/DragTest multiple picture files
- Mac and iOS/Machine Learning/Core ML Photos
Blog Entries
- Adding Drag and Drop receiver to a layout
- Accept file drops in Filemaker with MBS Plugin
- MBS Filemaker Plugin, version 2.4pr8
FileMaker Magazin
Created 18th August 2014, last changed 8th June 2020
DragDrop.GetMouseY - DragDrop.GetPathCount
Feedback: Report problem or ask question.
Links
MBS FileMaker Plugins