The Files section in the Script Step list contains some of the least often used script steps in all of FileMaker. But if you work in a school, say, the day may come when you need to automate the process of formatting files or saving backup copies for every student in a class. You can also script the process of converting older databases to FileMaker 7/8 format and recovering damaged databases, but these are sensitive processes that are better handled manually.
14.7.1. Opening and Closing Files
The Open File script step lets you open another FileMaker file. You can pick any of your previously defined file references (see Section 8.5.1) or define a new file reference if necessary. When the step runs, the specified file opens and appears in a new window. If the file has a script set to run when it opens, it runs.
If you want the file to open, but you don't want to see a window on the screen, turn on the "Open hidden" option for this step. The file opens, but it's listed in the Show Window submenu of the Window menu, with its name in parentheses.
The Close File script step closes an already open file. When you add the step, you get to pick any file reference or add a new one. You can also choose Current File to close the file the script is in. If the file is open when the script runs, all its windows close and its closing script runs.
Note: In general, FileMaker is very smart about when to open and close files. It opens a file when it needs to and closes it again when it no longer needs it. You usually don't need to open and close files from a script, but there's one important exceptionwhen the file has an opening script that should run before the user can see the file. If you jump directly to a related record in another file, FileMaker bypasses the opening script, so use an Open File script step to ensure that the open script runs.
14.7.2. Save a Copy As
If you have a database you don't want to close, but you want to make a copy of it, you can do so with the Save a Copy As script step. It works just like the File images/U2192.jpg border=0> Save a Copy As command. You might want to script this command if you want to automatically back up several files at once without closing them.
14.7.3. Other File-Related Script Steps
The rest of the file-related script steps are almost never used…but that doesn't mean you won't find a good reason to use them.
Part I: Introduction to FileMaker Pro
Your First Database
Organizing and Editing Records
Building a New Database
Part II: Layout Basics
Layout Basics
Creating Layouts
Advanced Layouts and Reports
Part III: Multiple Tables and Relationships
Multiple Tables and Relationships
Advanced Relationship Techniques
Part IV: Calculations
Introduction to Calculations
Calculations and Data Types
Advanced Calculations
Extending Calculations
Part V: Scripting
Scripting Basics
Script Steps
Advanced Scripting
Part VI: Security and Integration
Security
Exporting and Importing
Sharing Your Database
Developer Utilities
Part VII: Appendixes
Appendix A. Getting Help