Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
FileDialog.SelectFolderDialog
Shows dialog to select a folder.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
FileDialog | 2.7 | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |
Parameters
none
Result
Returns "OK", "Cancel" or an error.
Description
Shows dialog to select a folder.If dialog finishes well, you can query paths.
Added support for multiple selection on Windows with plugin version for 6.4.
Examples
Run Select Folder Dialog:
Delete All Records [No dialog]
Set Variable [$r; Value:MBS("FileDialog.Reset")]
Set Variable [$r; Value:MBS("FileDialog.SetShowHidden"; FileDialog::ShowHidden)]
Set Variable [$r; Value:MBS("FileDialog.SetAllowMulti"; FileDialog::AllowMulti)]
Set Variable [$r; Value:MBS("FileDialog.SetResolvesAliases"; FileDialog::ResolvesAliases)]
Set Variable [$r; Value:MBS("FileDialog.SetTreatsFilePackagesAsDirectories"; FileDialog::TreatsFilePackagesAsDirectories)]
Set Variable [$r; Value:MBS("FileDialog.SetCanSelectHiddenExtension"; FileDialog::CanSelectHiddenExtension)]
Set Variable [$r; Value:MBS("FileDialog.SetWindowTitle"; FileDialog::WindowTitle)]
Set Variable [$r; Value:MBS("FileDialog.SetInitialDirectory"; FileDialog::InitialDirectory)]
Set Variable [$r; Value:MBS("FileDialog.SetNameFieldLabel"; FileDialog::NameFieldLabel)]
Set Variable [$r; Value:MBS("FileDialog.SetPrompt"; FileDialog::Prompt)]
Set Variable [$r; Value:MBS("FileDialog.SetMessage"; FileDialog::Message)]
Set Variable [$r; Value:MBS("FileDialog.SetNameFieldStringValue"; FileDialog::NameFieldStringValue)]
Set Variable [$r; Value:MBS("FileDialog.SelectFolderDialog")]
If [$r = "OK"]
Set Variable [$index; Value:0]
Set Variable [$count; Value:MBS("FileDialog.GetPathCount")]
Loop
New Record/Request
Set Field [FileDialog::Path; MBS("FileDialog.GetPath"; $index)]
Commit Records/Requests []
Set Variable [$index; Value:$index + 1]
Exit Loop If [$index = $count]
End Loop
End If
Export all containers to one folder:
#Ask for folder?
Set Variable [$r; Value:MBS("FileDialog.Reset")]
Set Variable [$r; Value:MBS("FileDialog.SetMessage"; "Export folder?")]
Set Variable [$r; Value:MBS("FileDialog.SelectFolderDialog")]
If [$r = "OK"]
#get path from dialog:
Set Variable [$npath; Value:MBS( "FileDialog.GetPath"; 0 )]
#convert to FileMaker path for Export Field Contents
Set Variable [$fpath; Value:MBS( "Path.NativePathToFileMakerPath"; $npath )]
#Loop over all records:
Go to Record/Request/Page [First]
Loop
#Export files from this record
#figure out file name
Set Variable [$name; Value:GetAsText ( Container Batch Export::Test1 )]
Set Variable [$name; Value:GetValue($name; 1)]
Set Variable [$name; Value:MBS( "Path.LastPathComponent"; $name )]
Set Variable [$dpath; Value:MBS( "Path.AddPathComponent"; $fpath; $name )]
Export Field Contents [Container Batch Export::Test1; “$dpath”]
#Next record
Go to Record/Request/Page [Next; Exit after last]
End Loop
End If
Select folder in one expression:
Let([
r = MBS("FileDialog.Reset");
r = MBS("FileDialog.SelectFolderDialog");
folder = If ( r = "OK" ; MBS("FileDialog.GetPath"; 0); "" )
]; folder)
See also
- FileDialog.SelectItemDialog
- FileDialog.SetCanSelectHiddenExtension
- FileDialog.SetInitialDirectory
- FileDialog.SetMessage
- FileDialog.SetNameFieldLabel
- FileDialog.SetPrompt
- FileDialog.SetShowHidden
- FileDialog.SetTreatsFilePackagesAsDirectories
- FileDialog.SetWindowTitle
- Path.NativePathToFileMakerPath
Release notes
- Version 10.3
- Added create folder button for FileDialog.SelectFolderDialog function on MacOS.
- Version 9.4
- Added check to FileDialog.OpenFileDialog, FileDialog.SaveFileDialog, FileDialog.SelectFolderDialog and FileDialog.SelectItemDialog to ignore invalid initial directory for Mac.
- Version 8.3
- Upgraded FileDialog.OpenFileDialog, FileDialog.SelectFolderDialog and FileDialog.SaveFileDialog to use newer API on Windows to get newer dialog.
Example Databases
- Containers/Container Batch Export
- DynaPDF/Batch Preview
- Files/FileDialog
- Mac and iOS/PDFKit/Pictures to PDF
- SQL in FileMaker/ImageGallery
Blog Entries
- Tips and tricks with MBS
- MBS FileMaker Plugin, version 10.3pr10
- MBS FileMaker Plugin, version 9.4pr7
- MBS FileMaker Plugin, version 8.3pr1
- Open Dialog upgraded
- Comparing Base Elements Plugin to MBS FileMaker Plugin
- MBS FileMaker Plugin, version 6.4pr9
- MBS Filemaker Plugin, version 4.3pr3
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 21st June 2017