Adobe 23101764 Scripting Guide - Page 31

AppleScript debugging

Page 31 highlights

Scripting basics 2 Debugging and Error Handling 2.10.1 AppleScript debugging While the basic syntax of your script will be checked when compiled, it is possible to create and compile scripts in AppleScript that will not run properly. The Script Editor Application doesn't have extensive debugging tools, but it does have the an Event Log window. To watch the commands your script sends and the results it receives, choose "Controls > Open Event Log". The Script Editor displays the Event Log window. Check the "Show Events" and "Show Events Results" options at the top of the "Event Log" window and run your script. As the script executes, you'll see the commands sent to Photoshop, and the Photoshop responses. You can display the contents of one or more variables in the log window by using the log command. log {myVariable, otherVariable} In addition, the Result window (choose Controls > Show Result) will display the value from the last script statement evaluated. Third-party editors offer additional debugging features. For more information on using AppleScript, see the AppleScript Reference Guide on the installation CD. Photoshop CS 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
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105

Photoshop CS Scripting Guide
27
Scripting basics
Debugging and Error Handling
2
2.10.1
AppleScript debugging
While the basic syntax of your script will be checked when compiled, it is possible to create
and compile scripts in AppleScript that will not run properly. The Script Editor Application
doesn’t have extensive debugging tools, but it does have the an Event Log window.
To watch the commands your script sends and the results it receives, choose “Controls > Open
Event Log”. The Script Editor displays the Event Log window. Check the “Show Events” and
“Show Events Results” options at the top of the “Event Log” window and run your script. As
the script executes, you’ll see the commands sent to Photoshop, and the Photoshop responses.
You can display the contents of one or more variables in the log window by using the log
command.
log {myVariable, otherVariable}
In addition, the Result window (choose Controls > Show Result) will display the value from
the last script statement evaluated. Third-party editors offer additional debugging features.
For more information on using AppleScript, see the AppleScript Reference Guide on the
installation CD.