Caffeinate FileMaker Pro
Did you know that FileMaker Pro or the whole computer can go to sleep while doing a longer script?
On macOS there is a feature called App Nap to save energy by sleeping applications. And of course on Windows and macOS the display gets to sleep after some time and sometimes even the whole PC or Mac goes to sleep.
With MBS FileMaker Plugin, you can add a script line on the start of your script and then a second line on the end of the script.
The start of the script calls the ProcessActivity.beginActivity function like this:
Set Variable [ $activity ; Value: MBS( "ProcessActivity.beginActivity"; "IdleSystemSleepDisabled UserInitiated"; "Doing Backup in FileMaker" ) ]
On the end of the script, you have a line to end the activity:
Set Variable [ $r ; Value: MBS( "ProcessActivity.endActivity"; $activity ) ]
All activities are cleared when you exit the application.
For complicated scripts with multiple "Exit Script" steps, it may be easier to have a wrapper script like this:
# DoBackup script
# Start activity
Set Variable [ $activity ; Value: MBS( "ProcessActivity.beginActivity"; "IdleSystemSleepDisabled UserInitiated"; "Doing Backup in FileMaker" ) ]
# call the backup script
Perform Script [ Specified: From list ; “DoBackup Internal” ; Parameter: Get(ScriptParameter) ]
# Stop activity
Set Variable [ $r ; Value: MBS( "ProcessActivity.endActivity"; $activity ) ]
# pass on the script result
Exit Script [ Text Result: Get(ScriptResult) ]
Windows support was added in v13.0, so it may prevent display or system sleep there, too.
Let us know if you have questions about this.