DocumentPicker.SetTrigger
-------------------------

Sets trigger for document trigger.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [FileDialog](component_FileDialog.md) | [9.1](newinversion91.md) | ❌ No | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "DocumentPicker.SetTrigger"; FileName; ScriptName ) 

**MBS**( **"DocumentPicker.SetTrigger";** /\* Sets trigger for document trigger. \*/  
**$FileName**; /\* The file name of the script.e.g. Get(FileName) \*/   
**$ScriptName**) /\* The script to trigger.e.g. "FilesSelected" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| FileName | The file name of the script. | Get(FileName) |
| ScriptName | The script to trigger. | "FilesSelected" |

### Result

Returns OK or error.

### Description

Sets trigger for document trigger.  
### Examples

Import file with DocumentPicker:

 # set script to call later   
Set Variable \[ $r ; Value: MBS ( "DocumentPicker.SetTrigger"; Get(FileName); "Trigger" ) \]   
  
\# allowed list of file types:   
Set Variable \[ $Types ; Value: "public.jpeg¶public.png" \]   
  
\# show import dialog:   
Set Variable \[ $r ; Value: MBS ( "[DocumentPicker.Import](DocumentPickerImport.md)"; $Types ; 0 ) \]  
Sample trigger script:

 Set Field \[ PlaceHolder::Paths ; MBS ( "[DocumentPicker.Files](DocumentPickerFiles.md)" ) \]   
Set Variable \[ $path ; Value: GetValue(PlaceHolder::Paths ; 1) \]   
If \[ Length ( $path ) &gt; 0 \]   
 Set Field \[ PlaceHolder::Container ; MBS ( "[Container.ReadFile](ContainerReadFile.md)"; $path ; "auto") \]   
Else  
 Set Field \[ PlaceHolder::Container ; "" \]   
End If  
### See also

- [Container.ReadFile](ContainerReadFile.md)
- [DocumentPicker.File](DocumentPickerFile.md)
- [DocumentPicker.Files](DocumentPickerFiles.md)
- [DocumentPicker.Import](DocumentPickerImport.md)

### Example Databases

- [iOS/Examples/DocumentPicker iOS](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/iOS/Examples/DocumentPicker%20iOS.shtml#9ScriptAnchor_)
- [Mac and iOS/PDFKit/Printing iOS](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/Printing%20iOS.shtml#10ScriptAnchor_)

This function checks for a license.

Created 28th January 2019 , last changed 8th July 2020

  
[DocumentPicker.Open](DocumentPickerOpen.md) - [DragDrop.AttachToOverlay](DragDropAttachToOverlay.md)

[HTML Version](DocumentPickerSetTrigger.shtml)