Adobe 23101335 Scripting Guide - Page 11

Documenting scripts, multiple line comment

Page 11 highlights

Scripting basics 2 Documenting scripts When you identify an object in this fashion, you're creating an object reference. While AppleScript, Visual Basic and JavaScript use different syntax for object references, each gives the script a way of finding the object you want. 2.3 Documenting scripts 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 runtime 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. Photoshop 7.0 Scripting Guide 11

  • 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

Photoshop 7.0 Scripting Guide
11
Scripting basics
Documenting scripts
2
When you identify an object in this fashion, you’re creating an
object reference
. While
AppleScript, Visual Basic and JavaScript use different syntax for object references, each gives
the script a way of finding the object you want.
2.3 Documenting scripts
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.