Example backup script
You can use the following script to save automated backup copies of a FileMaker Pro database.
This script saves a copy of your database on the fifth close and every fifth close thereafter. To make the script work, you need to define a global field called Count Field in one of the tables in your database. If you do not define a global number field, FileMaker Pro may increment a different record each time you close the application. You should define this script in all solution files that require backups.
To create the script:
1.
Choose Scripts menu > Manage Scripts. Or, choose File menu > Manage > Scripts.
2.
3.
In the Edit Script window, for Script Name, type Backup.
4.
Set Field [<table name>::Count Field; <table name>::Count Field + 1]
If [<table name>::Count Field > 4]
Save a copy as ["Backup Copy.fp7"; copy]
Set Field [<table name>::Count Field; 0]
End if
5.
When you are finished, choose Scripts menu > Save Script. Close the Edit Script window.
6.
7.
Choose File menu > File Options.
8.
In the Open/Close tab, under When Closing this File, select Perform script.
9.
10.
11.
This script will create a backup of your file every fifth time you close the file.