Comments are the best method to provide more information to script readers. Also we can comment-out the unwanted code parts for later use. The comments are ignored by the script compiler.
We have two methods to add comments in script - Line comment and Block comment.
Line comment: The semicolon (;) is the comment character and all the text in the line after semicolon is ignored by the script compiler; unless it is within a string.
Block comment: It is used to comment a section of script. The keywords are, #comments-start to start the comment and #comments-end to end the comment. Abbreviated keywords #cs and #ce also can be used.
Examples are provided below.
; Display a message box
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 1")
#comments-start
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 2")
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 3")
#comments-end
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 4"); Display another message box
#cs
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 5")
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 6")
#ce
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 1")
#comments-start
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 2")
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 3")
#comments-end
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 4"); Display another message box
#cs
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 5")
MsgBox($MB_ICONINFORMATION, "Automation Developers", "Message Box - 6")
#ce
- How to easily open an Include file?
- AutoIt Hello World
- AutoIt Software License
- AutoIt Download and Installation
- AutoIt Basics
Interesting? Share and Let Others Know.
Post a Comment