Adobe 23101764 Scripting Guide - Page 21

Documenting scripts

Page 21 highlights

Scripting basics 2 Documenting scripts 2.4 Documenting scripts It's recommended that you use comments within your scripts to explain what procedures are taking place. It's a quick way to document your work for others and an important element to remember when writing scripts. Comments are ignored by the scripting system as the script executes and cause no run-time speed penalty. AppleScript To enter a single-line comment in an AppleScript, type "--" to the left of your description. For multiple line comments, start your comment with the characters "(*" and end it with "*)". - this is a single-line comment (* this is a multiple line comment *) Visual Basic In Visual Basic, enter "Rem" (for "remark") or " ' " (a single straight quote) to the left of the comment. Rem this is a comment ' and so is this JavaScript In JavaScript, use the double forward slash to comment a single line or a /* */ notation for multi-line comments // This comments until the end of the line /* This comments this entire block of text */ About long script lines In some cases, individual script lines are too long to print on a single line in this guide. AppleScript AppleScript uses the special character (¬) to show that the line continues to the next line. This continuation character denotes a "soft return" in the script. You can enter this character in the script editor by pressing Option-Return at the end of the line you wish to continue. Visual Basic In Visual Basic, you can break a long statement into multiple lines in the Code window by using the line continuation character, which is a space followed by an underscore ( _). Photoshop CS Scripting Guide 17

  • 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
17
Scripting basics
Documenting scripts
2
2.4 Documenting scripts
It’s recommended that you use comments within your scripts to explain what procedures are
taking place. It’s a quick way to document your work for others and an important element to
remember when writing scripts. Comments are ignored by the scripting system as the script
executes and cause no run-time speed penalty.
AppleScript
To enter a single-line comment in an AppleScript, type “--” to the left of your description.
For multiple line comments, start your comment with the characters “(*” and end it with “*)”.
- this is a single-line comment
(* this is a
multiple line comment *)
Visual Basic
In Visual Basic, enter “Rem” (for “remark”) or “ ' ” (a single straight quote) to the left of the
comment.
Rem this is a comment
' and so is this
JavaScript
In JavaScript, use the double forward slash to comment a single line or a /* */ notation for
multi-line comments
// This comments until the end of the line
/* This comments
this entire
block of text */
About long script lines
In some cases, individual script lines are too long to print on a single line in this guide.
AppleScript
AppleScript uses the special character (¬) to show that the line continues to the next line.
This continuation character denotes a “soft return” in the script. You can enter this character in
the script editor by pressing Option-Return at the end of the line you wish to continue.
Visual Basic
In Visual Basic, you can break a long statement into multiple lines in the Code window by
using the line continuation character, which is a space followed by an underscore ( _).