iOSApp.SetWillEnterForegroundScript
-----------------------------------

Sets the script to be run when comes back to foreground.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [iOSApp](component_iOSApp.md) | [7.4](newinversion74.md) | ❌ No | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "iOSApp.SetWillEnterForegroundScript"; FileName; ScriptName { ; Parameter } ) 

**MBS**( **"iOSApp.SetWillEnterForegroundScript";** /\* Sets the script to be run when comes back to foreground. \*/  
**$FileName**; /\* The database file name where the script is located.e.g. "test.fmp12" \*/   
**$ScriptName**; /\* The script name.e.g. "MyScript" \*/   
**$Parameter**) /\* Optional; The script parameter. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| FileName | The database file name where the script is located. | "test.fmp12" |  |
| ScriptName | The script name. | "MyScript" |  |
| Parameter | The script parameter. |  | Optional |

### Result

Returns OK or error.

### Description

Sets the script to be run when comes back to foreground.  
Posted shortly before an app leaves the background state on its way to becoming the active app.  
  
Version 10.2 and newer stores this in preferences, so it is restored if app when app starts again after being killed in background.  
### Examples

Install trigger:

 Set Variable \[ $r ; Value: MBS ( "iOSApp.SetWillEnterForegroundScript"; Get(FileName); "Trigger"; "WillEnterForegroundScript" ) \]  
### See also

- [iOSApp.GetDidEnterBackgroundScript](iOSAppGetDidEnterBackgroundScript.md)
- [iOSApp.GetWillEnterForegroundEvaluate](iOSAppGetWillEnterForegroundEvaluate.md)
- [iOSApp.GetWillEnterForegroundScript](iOSAppGetWillEnterForegroundScript.md)
- [iOSApp.SetDidEnterBackgroundScript](iOSAppSetDidEnterBackgroundScript.md)
- [iOSApp.SetWillEnterForegroundEvaluate](iOSAppSetWillEnterForegroundEvaluate.md)

### Blog Entries

- [Additional iOS Script Triggers](https://www.mbsplugins.de/archive/2022-12-24/Additional_iOS_Script_Triggers/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 23th September 2017 , last changed 16th March 2020

  
[iOSApp.SetWillEnterForegroundEvaluate](iOSAppSetWillEnterForegroundEvaluate.md) - [iOSApp.SetWillResignActiveEvaluate](iOSAppSetWillResignActiveEvaluate.md)

[HTML Version](iOSAppSetWillEnterForegroundScript.shtml)