Shell.SetDataAvailableScript
----------------------------

Sets the script to run when new data arrived.

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

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

**MBS**( **"Shell.SetDataAvailableScript";** /\* Sets the script to run when new data arrived. \*/  
**$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" \*/ 

### 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 the script to run when new data arrived.  
Please call [Shell.ReadOutputText](ShellReadOutputText.md) and [Shell.ReadErrorText](ShellReadErrorText.md) in the trigger script.  
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.GetDataAvailableEvaluate](ShellGetDataAvailableEvaluate.md)
- [Shell.GetDataAvailableScriptName](ShellGetDataAvailableScriptName.md)
- [Shell.ReadErrorText](ShellReadErrorText.md)
- [Shell.ReadOutputText](ShellReadOutputText.md)
- [Shell.SetDataAvailableEvaluate](ShellSetDataAvailableEvaluate.md)

### Release notes

- **Version 10.0**
    - Added [Shell.SetDataAvailableEvaluate](https://www.mbsplugins.eu/ShellSetDataAvailableEvaluate.shtml), [Shell.GetDataAvailableEvaluate](https://www.mbsplugins.eu/ShellGetDataAvailableEvaluate.shtml), [Shell.SetDataAvailableScript](https://www.mbsplugins.eu/ShellSetDataAvailableScript.shtml), [Shell.GetDataAvailableScriptName](https://www.mbsplugins.eu/ShellGetDataAvailableScriptName.shtml) and [Shell.GetDataAvailableScriptFileName](https://www.mbsplugins.eu/ShellGetDataAvailableScriptFileName.shtml) functions.

### Example Databases

- [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 17th November 2019 , last changed 9th November 2021

  
[Shell.SetDataAvailableEvaluate](ShellSetDataAvailableEvaluate.md) - [Shell.SetDomain](ShellSetDomain.md)

[HTML Version](ShellSetDataAvailableScript.shtml)