ProcessActivity.beginActivity
-----------------------------

Begins an activity.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Process](component_Process.md) | [5.2](newinversion52.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ✅ Yes |

MBS( "ProcessActivity.beginActivity"; activity { ; Reason } ) 

**MBS**( **"ProcessActivity.beginActivity";** /\* Begins an activity. \*/  
**$activity**; /\* The activity as a number or a text. The plugin allows you to pass texts like IdleDisplaySleepDisabled, IdleSystemSleepDisabled, UserInitiated, UserInitiatedAllowingIdleSystemSleep, Background and LatencyCritical. Those texts can be combined.e.g. "IdleDisplaySleepDisabled" \*/   
**$Reason**) /\* Optional; The reason text.  
May appear in a log for macOS.e.g. "Doing backup" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| activity | The activity as a number or a text. The plugin allows you to pass texts like IdleDisplaySleepDisabled, IdleSystemSleepDisabled, UserInitiated, UserInitiatedAllowingIdleSystemSleep, Background and LatencyCritical. Those texts can be combined. | "IdleDisplaySleepDisabled" |  |
| Reason | The reason text.   May appear in a log for macOS. | "Doing backup" | Optional |

### Result

Returns reference number or error.

### Description

Begins an activity.  
Pass in an activity to this function, and a non-empty reason string. Indicate completion of the activity by calling the corresponding [ProcessActivity.endActivity](ProcessActivityendActivity.md) function with the result of this function. The reason string is used for debugging.  
Requires macOS 10.9 and newer.  
This function allows to deactivate App Nap for FileMaker. So when a script has to do some work, you can disable system/display sleep here which also disables app nap.  
  
Added Windows support with version 13.0. Supported flags are IdleDisplaySleepDisabled, IdleSystemSleepDisabled, UserInitiated and UserInteractive.  
  
See also [iOSApp.SetIdleTimerDisabled](iOSAppSetIdleTimerDisabled.md) function.  
### Examples

Start an activity:

 MBS ( "ProcessActivity.beginActivity"; "IdleSystemSleepDisabled UserInitiated"; "Doing Backup in FileMaker" )  
Avoid display sleep:

 MBS ( "ProcessActivity.beginActivity"; "IdleDisplaySleepDisabled UserInitiated"; "Showing animation" )  
### See also

- [iOSApp.SetIdleTimerDisabled](iOSAppSetIdleTimerDisabled.md)
- [ProcessActivity.endActivity](ProcessActivityendActivity.md)
- [ProcessActivity.Options](ProcessActivityOptions.md)
- [ProcessActivity.Reason](ProcessActivityReason.md)

### Release notes

- **Version 16.3**
    - Fixed a bug in ProcessActivity.beginActivity function not passing display sleep correctly.
- **Version 13.3**
    - Changed reason parameter in [ProcessActivity.beginActivity](https://www.mbsplugins.eu/ProcessActivitybeginActivity.shtml) function to be optional.
    - Fixed problem with [ProcessActivity.beginActivity](https://www.mbsplugins.eu/ProcessActivitybeginActivity.shtml) not working well on Windows.
- **Version 13.0**
    - Added Windows support for [ProcessActivity.beginActivity](https://www.mbsplugins.eu/ProcessActivitybeginActivity.shtml) function.

### Example Databases

- [Utility functions/Process Activity](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Utility%20functions/Process%20Activity.shtml#2ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 16.3pr2](https://www.mbsplugins.de/archive/2026-06-15/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.3pr2](https://www.mbsplugins.de/archive/2023-06-13/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.3pr1](https://www.mbsplugins.de/archive/2023-06-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Caffeinate FileMaker Pro](https://www.mbsplugins.de/archive/2023-05-27/Caffeinate_FileMaker_Pro/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 13.0 für Claris FileMaker](https://www.mbsplugins.de/archive/2023-01-17/Neues_MBS_Plugin_130_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 13.0 for Claris FileMaker](https://www.mbsplugins.de/archive/2023-01-17/MBS_Plugin_130_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.6pr4](https://www.mbsplugins.de/archive/2022-12-21/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.2pr2](https://www.mbsplugins.de/archive/2015-06-08/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)
- [Disable App Nap, System and Screen Sleep in FileMaker](https://www.mbsplugins.de/archive/2015-06-03/Disable_App_Nap_System_and_Scr/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 2nd June 2015 , last changed 19th June 2023

  
[ProcessActivity.Reason](ProcessActivityReason.md) - [ProcessActivity.endActivity](ProcessActivityendActivity.md)

[HTML Version](ProcessActivitybeginActivity.shtml)