When you write a script using FileMaker Pro, your testing and troubleshooting routine is pretty simple. You perform the script and wait to see what happens at the end. In a simple script, like one that prints a report, you can easily enough see what went wrong, and fix it: your script just went to the wrong layout, perhaps. But when you're creating a complex script that sets variables and works with different sets of records that you can't verify before the next script step whizzes past, it's devilishly hard to figure out where your script veers off course. Even simple scripts can go wrong in puzzling ways that you can't detect by reading over your steps.
That's where Script Debugger comes in. When you run scripts with Script Debugger turned on, FileMaker performs scripts at human speed, so you can see exactly what's happening, each step of the way.
To run Script Debugger, it's best to be logged into the file with a password that has script editing privileges (see Understanding Privilege Sets). But if you need to figure out how a script runs for lesser accounts, then you can log in as someone else, and then use the Authenticate/Deauthenticate button (see Controlling Script Execution).
To see the Script Debugger, choose Tools→Script Debugger. When you do, the Script Debugger window appears on the screen (Figure 12-2). Left to its own devices, the Script Debugger window doesn't do much. It consists of a couple of blocks of empty space, and several buttons you can't click.
But it shows its true colors when you run a script. As soon as you do, it swings into action. It shows the name of the script you're running near the top, and the complete contents of that script just below. You can even see the value of any parameter that was passed to the script. But more important than all this, you can control the script as it runs. You can run just...