2
Acrobat JavaScript Tools
Exercise: Calculator
Click Interrupt
Open the debugger window and click the
Interrupt
button, which displays in red. At this
point, performing any action that runs a script causes execution to stop at the beginning of
the script.
Unlike
Debug From Start,
the
Interrupt
button is automatically deactivated after being
used. To stop at the beginning of a new script, you must reactivate it by clicking it again.
Debugging From an Arbitrary Point in the Script
Define a Breakpoint
To start debugging from a specific point in your script, you can set a breakpoint. See
for details on how to set a breakpoint.
Using the debugger keyword
You can also insert the
debugger
keyword in any line of your code to stop execution and
enter the debugger when that particular line is reached.
N
OTE
:
Breakpoints created using the
debugger
keyword are not listed in the
Inspect
details window when you select Breakpoints from the
Inspect
drop-down list.
Exercise: Calculator
N
OTE
:
To complete the following exercises, unzip the file
TestDebugger.zip
and open
Calc.pdf
.
In this exercise, you will set breakpoints in a script and create watches to view how a
variable changes as the script executes. At the end of this exercise you will be able to:
●
●
●
●
●
Start the debugger from a location within a script.
Interpret the contents of the
Inspect
details window.
Create, edit, and delete watches.
Set and clear breakpoints.
Use the debugger buttons to control how the interpreter executes the code in the script.
Calculator
Calc.pdf
uses document-level and form field-level scripts to simulate the behavior of a
simple calculator. The keypad consists of numeric and function keys, the period (.), the
equals sign (=), and Cancel (C) and Cancel Entry (CE) keys.
60
Acrobat JavaScript Scripting Guide