Adobe 23101335 Scripting Guide - Page 29
Script Breakpoints Window, toSource, debugger, parseBox, function getRatio docRef
UPC - 718659152833
View all Adobe 23101335 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 29 highlights
Scripting basics 2 Testing and troubleshooting Script Breakpoints Display (no keyboard shortcut) Clicking this button displays the Script Breakpoints Window shown in Figure 2.2. Using the JavaScript Command Line Entry Field You can use the Script Debugger window's command line entry field to enter and execute Javascript code interactively within a specified stack scope. Commands entered in this field execute with a timeout of one second. Command line entry field. Enter in this field a JavaScript statement to execute within the stack scope of the line highlighted in the Stack Trace view. When you've finished entering the JavaScript expression, you can execute it by clicking the command line entry button or pressing the Enter key. Command line entry button. Click this button or press Enter to execute the JavaScript code in the command line entry field. Photoshop executes the contents of the command line entry field within the stack scope of the line highlighted in the Stack Trace view. The command line entry field accepts any JavaScript code, making it very convenient to use for inspecting or changing the contents of variables. NOTE: To list the contents of an object as if it were JavaScript source code, enter the object.toSource() command. Setting Breakpoints In the Script Debugger Window When the Photoshop Script Debugger window is active, you can double-click a line in the source view to set or clear a breakpoint at that line. Alternatively, you can click the BP button to display the Script Breakpoints window and set or clear breakpoints in this window. Setting Breakpoints in JavaScript Code Adding the debugger statement to a script sets an unconditional breakpoint. For example, the following code causes Photoshop to halt and display the script debug window as soon as it enters the parseBox function. function getRatio( docRef ) { debugger; var theRatio = ( docRef.height ) / ( docRef.width ); return theRatio; } alert( getRatio( activeDocument ) ); Photoshop 7.0 Scripting Guide 29