Adobe 27510753 Scripting Guide - Page 50
Testing and troubleshooting, AppleScript debugging
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 50 highlights
42 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide Testing and troubleshooting Scripting environments provide tools for monitoring the progress of your script as it runs. This makes it easier to find problems that your script might encounter or cause. AppleScript debugging The Apple Script Editor application doesn't have extensive debugging tools, but it does have the AppleScript Event Log Window. To watch your script send commands to and receive information from InDesign: 1. Choose Controls > Open Event Log. The Script Editor displays the Event Log window. 2. Turn on the Show Events and Show Events Results options. 3. Run your script. As the script executes, you'll see the commands sent to InDesign, and the InDesign responses. In addition, the Result window (choose Controls > Show Result) displays the value returned from the most recent script statement. Third-party AppleScript editors, such as Script Debugger (from Late Night Software: www.latenightsw.com) offer more debugging features than the Apple Script Editor. If you will be writing more than a few simple scripts, we recommend that you acquire a script editor with better script debugging capabilities. VBScript debugging You can debug your VBScript using a Visual Basic debugger. In Visual Basic, you can stop your script at any point and step through the script one line at a time. You can also observe the values of variables defined in your script using the Watch and Locals windows-two valuable tool for debugging your scripts. To view a variable in the Watch window: 1. Select the variable and choose Debug > Quick Watch. Visual Basic displays the Quick Watch dialog box. 2. Click Add. Visual Basic displays the Watch window. 3. To stop your script at a particular line (so that you can look at the Watch window), select the line and choose Debug > Toggle Breakpoint. When you run the script, Visual Basic stops at the breakpoint you set, and you can look at the values in your variables (if you've hidden the Watch window, you can display it again by choosing View > Watch Window). 4. Choose one of the following continuation options: l To execute the next line of your script, choose Debug > Step Into (or press F8 in Visual Basic 6 or F11 in Visual Basic.NET). l To continue normal execution of the script, choose Run > Start (or press F5) in Visual Basic 6 or Debug > Start (or press F5) in Visual Basic.NET. JavaScript debugging JavaScript debugging is described in Chapter 4, "Using ExtendScript Tools and Features."