Working with Files

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.

  • Convert File lets you convert an older FileMaker database to a FileMaker 7 database. There is very little reason to do this from a script.
  • Set User System Formats toggles the Use System Formats file option on or off. When you first create a database, FileMaker remembers how your system expects dates, times, and numbers to be formatted. If someone opens the file on a computer with different settings (usually a different language), FileMaker has to decide if it should use the original format settings for the file, or those specified by the new system. You usually set this choice in the Edit File Options window. Again, theres not much reason to change this from a script.
  • Recover File runs FileMaker's automatic file repair process on a selected database. Recovering a file is a rare thing in general since FileMaker is careful to avoid damaging databases even when your computer crashes. It's even more rare to do this on the same database so often you'd need a script to do it for you.

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


Exporting and Importing

Sharing Your Database

Developer Utilities

Part VII: Appendixes

Appendix A. Getting Help

FileMaker Pro 8. The Missing Manual
FileMaker Pro 8: The Missing Manual
ISBN: 0596005792
EAN: 2147483647
Year: 2004
Pages: 176

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: