Adobe 12001196 Scripting Guide - Page 27

Exercise: Working with the JavaScript Console, Enabling JavaScript

Page 27 highlights

Acrobat JavaScript Editor and Debugger Console 2 Exercise: Working with the JavaScript Console Saving and Closing a File with a Syntax Error If you save and close a file you have been editing and it contains a syntax error (on line 123, for example), Acrobat displays a dialog box with the following message prompting whether you want to fix the error: There is a JavaScript error at line 123. Do you want to fix the error? NOTE: If you click No, Acrobat discards your file. Always click Yes. Acrobat will expand the path to the editor to include the line number in the specified syntax. The editor will open and the cursor will be placed on line 123. Exercise: Working with the JavaScript Console To do this exercise, you must have Acrobat 6 Pro installed on your machine. In this exercise you will verify that JavaScript is enabled for Acrobat and then begin working with the Acrobat JavaScript console to edit and evaluate code. At the end of the exercise you will be able to: ● Enable or disable Acrobat JavaScript. ● Enable or disable the JavaScript debugger. ● Open the console in the debugger. ● Evaluate code in the console window. Enabling JavaScript To create and use JavaScript actions in Acrobat, you must have JavaScript enabled. To verify that JavaScript is enabled for your installation of Acrobat: 1. Launch the Acrobat application. 2. Select Edit > Preferences to open the Preferences dialog box. 3. Select JavaScript from the list of options on the left side of the dialog box. 4. Select Enable Acrobat JavaScript if it is not already selected. 5. Keep the Preferences dialog box open to enable the JavaScript debugger and the debugger console. Acrobat JavaScript Scripting Guide 27

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90

Acrobat JavaScript Scripting Guide
27
Acrobat JavaScript Editor and Debugger Console
Exercise: Working with the JavaScript Console
2
Saving and Closing a File with a Syntax Error
If you save and close a file you have been editing and it contains a syntax error (on line 123,
for example), Acrobat displays a dialog box with the following message prompting whether
you want to fix the error:
There is a JavaScript error at line 123.
Do you want to fix the error?
N
OTE
:
If you click
No
, Acrobat
discards
your file.
Always
click
Yes
. Acrobat will expand the path to the editor to include the line number in
the specified syntax. The editor will open and the cursor will be placed on line 123.
Exercise: Working with the JavaScript Console
In this exercise you will verify that JavaScript is enabled for Acrobat and then begin working
with the Acrobat JavaScript console to edit and evaluate code.
At the end of the exercise you will be able to:
Enable or disable Acrobat JavaScript.
Enable or disable the JavaScript debugger.
Open the console in the debugger.
Evaluate code in the console window.
Enabling JavaScript
To create and use JavaScript actions in Acrobat, you must have JavaScript enabled. To verify
that JavaScript is enabled for your installation of Acrobat:
1.
Launch the Acrobat application.
2.
Select
Edit > Preferences
to open the
Preferences
dialog box.
3.
Select
JavaScript
from the list of options on the left side of the dialog box.
4.
Select
Enable Acrobat JavaScript
if it is not already selected.
5.
Keep the
Preferences
dialog box open to enable the JavaScript debugger and the
debugger console.
To do this exercise, you must have Acrobat 6 Pro installed on your machine.