Schedule.StartScriptAfterDelay
------------------------------

Runs a script in any open FileMaker file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Schedule](component_Schedule.md) | [5.2](newinversion52.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ✅ Yes |

MBS( "Schedule.StartScriptAfterDelay"; DelaySeconds; FileName; ScriptName { ; ScriptParameter; RepeatDelay } ) 

**MBS**( **"Schedule.StartScriptAfterDelay"** /\* Runs a script in any open FileMaker file. \*/  
**$DelaySeconds**; /\* The Number of Seconds to wait before running the script. e.g. 10 \*/   
**$FileName**; /\* The name of the file that contains the script to be run. e.g. Get(Filename) \*/   
**$ScriptName**; /\* The exact name of the script to run. e.g. "TestScript" \*/   
**$ScriptParameter**; /\* Optional; Optional, the Script Parameter to pass to the script. \*/   
**$RepeatDelay**) /\* Optional; The number of seconds after which to repeat the script call. e.g. 30 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| DelaySeconds | The Number of Seconds to wait before running the script. | 10 |  |
| FileName | The name of the file that contains the script to be run. | Get(Filename) |  |
| ScriptName | The exact name of the script to run. | "TestScript" |  |
| ScriptParameter | Optional, the Script Parameter to pass to the script. |  | Optional |
| RepeatDelay | The number of seconds after which to repeat the script call. | 30 | Optional |

### Result

Returns reference number or error.

### Description

Runs a script in any open FileMaker file.   
You can also pass a text string to the Script as a Parameter. The parameter can be retrieved by using Get(ScriptParameter) in the script that plugin is calling.  
Please use [Schedule.Release](ScheduleRelease.md) later to remove schedule from list. Non repeating scheduled items are free automatically for you.   
Our plugin does not provide persistence. You need to schedule things in your scripts if you need them. When FileMaker quits, the plugin forgets the list of schedules.  
  
  
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

Start a script once in 10 seconds:

 MBS ( "Schedule.StartScriptAfterDelay"; 10; Get(FileName); "testScript"; "Hello World" )  
Start a script once in 10 seconds and repeat every 20 seconds:

 MBS ( "Schedule.StartScriptAfterDelay"; 10; Get(FileName); "testScript"; "Hello World"; 20 )  
### See also

- [FM.RunScriptLater](FMRunScriptLater.md)
- [Schedule.Release](ScheduleRelease.md)
- [Schedule.StartScriptAtTime](ScheduleStartScriptAtTime.md)
- [Schedule.StartScriptAtTimeStamp](ScheduleStartScriptAtTimeStamp.md)

### Example Databases

- [Registration/Registration](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Registration/Registration.shtml#8ScriptAnchor_)
- [Schedules/Schedules](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Schedules/Schedules.shtml#1GroupButton6.0000000123.000000031.0000000322.0000000LayoutObjectAnchor_)
- [Window/Flash Window and Jump Dock](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Window/Flash%20Window%20and%20Jump%20Dock.shtml#1ScriptAnchor_)

This function is free to use.

Created 20th May 2015 , last changed 27th January 2016

  
[Schedule.SetURL](ScheduleSetURL.md) - [Schedule.StartScriptAtTime](ScheduleStartScriptAtTime.md)

[HTML Version](ScheduleStartScriptAfterDelay.shtml)