Progressdialog.SetScript
------------------------

Sets the script to run when button is clicked.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Progressdialog](component_Progressdialog.md) | [7.1](newinversion71.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ✅ Yes |

MBS( "Progressdialog.SetScript"; FileName; ScriptName { ; Parameter } ) 

**MBS**( **"Progressdialog.SetScript";** /\* Sets the script to run when button is clicked. \*/  
**$FileName**; /\* The file name for the script.e.g. Get(FileName) \*/   
**$ScriptName**; /\* The script name to run.  
An empty name will disable the script calling.e.g. "CancelScript" \*/   
**$Parameter**) /\* Optional; The script parameter to pass. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| FileName | The file name for the script. | Get(FileName) |  |
| ScriptName | The script name to run.   An empty name will disable the script calling. | "CancelScript" |  |
| Parameter | The script parameter to pass. |  | Optional |

### Result

Returns OK or error.

### Description

Sets the script to run when button is clicked.  
  
  
With plugin version 6.0 or newer the script name can be a script ID number. In that case the plugin queries the script name for the given script ID. This allows to call scripts by ID and avoid problems if scripts are later renamed.  
  
Notice: FileMaker 19.2 adds a fmplugin extended privileges. If you have such an extended privileges to allow the plugin to trigger scripts, you need to grant permissions for it. If such a privilege is not defined, the plugin is allowed to trigger scripts. See FileMaker product documentation for details.  
### Examples

Set script to run

 MBS ("ProgressDialog.SetScript"; Get(FileName); "CancelScript"; "optional parameter")  
### See also

- [Progressdialog.GetScriptName](ProgressdialogGetScriptName.md)
- [ProgressDialog.SetCancel](ProgressDialogSetCancel.md)
- [Progressdialog.SetEvaluate](ProgressdialogSetEvaluate.md)
- [ProgressDialog.SetFont](ProgressDialogSetFont.md)
- [ProgressDialog.SetTopMost](ProgressDialogSetTopMost.md)
- [ProgressDialog.SetTopText](ProgressDialogSetTopText.md)

### Release notes

- **Version 7.1**
    - Added [Progressdialog.GetEvaluate](http://www.mbsplugins.eu/ProgressdialogGetEvaluate.shtml), [Progressdialog.GetFileName](http://www.mbsplugins.eu/ProgressdialogGetFileName.shtml), [Progressdialog.GetScriptName](http://www.mbsplugins.eu/ProgressdialogGetScriptName.shtml), [Progressdialog.SetEvaluate](http://www.mbsplugins.eu/ProgressdialogSetEvaluate.shtml), [Progressdialog.SetScript](http://www.mbsplugins.eu/ProgressdialogSetScript.shtml) to trigger script/evaluation when clicking cancel button.

### Blog Entries

- [MBS Plugin Advent calendar: 14 - Progress Dialog](https://www.mbsplugins.de/archive/2023-12-14/MBS_Plugin_Advent_calendar_14_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 7.1pr3](https://www.mbsplugins.de/archive/2017-02-22/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 14th February 2017 , last changed 15th October 2022

  
[Progressdialog.SetEvaluate](ProgressdialogSetEvaluate.md) - [Python.AddEvaluateFunction](PythonAddEvaluateFunction.md)

[HTML Version](ProgressdialogSetScript.shtml)