Adobe 27510753 Scripting Guide - Page 56

The JavaScript console, The call stack, dayOfWeek, Top Level]

Page 56 highlights

48 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide The JavaScript console The JavaScript console is a command shell and output window for the currently selected JavaScript engine. It connects you to the global namespace of that engine. JavaScript command line JavaScript output The command line entry field accepts any JavaScript code, and you can use it to evaluate expressions or call functions. Enter any JavaScript statement on the command line and execute it by pressing Enter. The statement executes within the stack scope of the line highlighted in the Call Stack tab, and the result appears in the output field. l The command line input field keeps a command history of 32 lines. Use the Up and Down Arrow keys to scroll through the previous entries. l Commands entered in this field execute with a timeout of one second. If a command takes longer than one second to execute, the Toolkit generates a timeout error and terminates the attempt. The output field is standard output for JavaScript execution. If any script generates a syntax error, the error is displayed here along with the file name and the line number. The Toolkit displays errors here during its own startup phase. The tab's flyout menu allows you to clear the contents of the output field and change the size of the font used for output. The call stack The Call Stack tab is active while debugging a program. When an executing program stops because of a breakpoint or runtime error, the tab displays the sequence of function calls that led to the current execution point. The Call Stack tab shows the names of the active functions, along with the actual arguments passed in to that function. For example, this stack pane shows a break occurring at a breakpoint in a function dayOfWeek: The function containing the breakpoint is highlighted in both the Call Stack and the Editor tabs. You can click any function in the call hierarchy to inspect it. In the Editor, the line containing the function call that led to that point of execution is marked with a green background. In the example, when you select the line [Top Level] in the call stack, the Editor highlights the line where the dayOfWeek function was called.

  • 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
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184

48
Using ExtendScript Tools and Features
Adobe InDesign CS2 Scripting Guide
The JavaScript console
The JavaScript console is a command shell and output window for the currently selected JavaScript engine. It
connects you to the global namespace of that engine.
JavaScript command line
JavaScript output
The command line entry field accepts any JavaScript code, and you can use it to evaluate expressions or
call functions. Enter any JavaScript statement on the command line and execute it by pressing Enter. The
statement executes within the stack scope of the line highlighted in the Call Stack tab, and the result appears
in the output field.
The command line input field keeps a command history of 32 lines. Use the Up and Down Arrow keys to
scroll through the previous entries.
Commands entered in this field execute with a timeout of one second. If a command takes longer than
one second to execute, the Toolkit generates a timeout error and terminates the attempt.
The output field is standard output for JavaScript execution. If any script generates a syntax error, the error is
displayed here along with the file name and the line number. The Toolkit displays errors here during its own
startup phase. The tab’s flyout menu allows you to clear the contents of the output field and change the size
of the font used for output.
The call stack
The Call Stack tab is active while debugging a program. When an executing program stops because of a
breakpoint or runtime error, the tab displays the sequence of function calls that led to the current execution
point. The Call Stack tab shows the names of the active functions, along with the actual arguments passed in
to that function.
For example, this stack pane shows a break occurring at a breakpoint in a function
dayOfWeek
:
The function containing the breakpoint is highlighted in both the Call Stack and the Editor tabs.
You can click any function in the call hierarchy to inspect it. In the Editor, the line containing the function call
that led to that point of execution is marked with a green background. In the example, when you select the
line
[Top Level]
in the call stack, the Editor highlights the line where the
dayOfWeek
function was called.
l
l