MonkeybreadSoftware Posted June 11, 2023 Posted June 11, 2023 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 (with fix in 13.3), so it may prevent display or system sleep there, too. Let us know if you have questions about this.
Recommended Posts