Shell.SetCompletedScript
------------------------

Sets which script to call when shell is done.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Shell](component_Shell.md) | [7.5](newinversion75.md) | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | ❌ No |

MBS( "Shell.SetCompletedScript"; ShellRef; FileName; ScriptName ) 

**MBS**( **"Shell.SetCompletedScript";** /\* Sets which script to call when shell is done. \*/  
**$ShellRef**; /\* The reference number from the shell.e.g. $shell \*/   
**$FileName**; /\* The database file name where the script is located.e.g. "test.fmp12" \*/   
**$ScriptName**) /\* The script name.e.g. "MyScript" \*/ 

(old name: Shell.SetScript)

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ShellRef | The reference number from the shell. | $shell |
| FileName | The database file name where the script is located. | "test.fmp12" |
| ScriptName | The script name. | "MyScript" |

### Result

Returns OK or error.

### Description

Sets which script to call when shell is done.  
The script parameter passed with the script call is the reference number of the shell object.  
  
  
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.  
### See also

- [Shell.GetCompletedScriptName](ShellGetCompletedScriptName.md)
- [Shell.SetCompletedEvaluate](ShellSetCompletedEvaluate.md)

### Release notes

- **Version 10.0**
    - Renamed [Shell.SetScript](https://www.mbsplugins.eu/ShellSetCompletedScript.shtml) to [Shell.SetCompletedScript](https://www.mbsplugins.eu/ShellSetCompletedScript.shtml), [Shell.GetScriptName](https://www.mbsplugins.eu/ShellGetCompletedScriptName.shtml) to Shell.SetCompletedScriptName and [Shell.GetScriptFileName](https://www.mbsplugins.eu/ShellGetCompletedScriptFileName.shtml) to Shell.SetCompletedScriptFileName.

### Example Databases

- [Shell/Shell](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Shell/Shell.shtml#3ScriptAnchor_)
- [Shell/Terminal](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Shell/Terminal.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 9.6pr1](https://www.mbsplugins.de/archive/2019-12-02/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th November 2017 , last changed 9th November 2021

  
[Shell.SetCompletedEvaluate](ShellSetCompletedEvaluate.md) - [Shell.SetCurrentDirectory](ShellSetCurrentDirectory.md)

[HTML Version](ShellSetCompletedScript.shtml)