I was wondering if there was a way to comment the macro to make it easy to remember what it is doing for future reference and editing?
Thanks
Comment Macro
Moderators: Dorian (MJT support), JRL
Hi rjseastrand,
Have you looked in the Help file?
------------------------------------------------------------------------------------------------------------------
Remark
Remark>Some Comment
The remark statement is ignored by the interpreter. It exists simply to allow comments to be placed in the code. In fact, any text that is not a recognised command can be used for this purpose.
Several lines of code can also be commented out in one go by using /* before and */ after the lines to be commented. E.g.:
/*
Let>r=5
Repeat>r
DDERequest>Excel,efile.xls,R%r%C2,Name,60
Let>r=r+1
Until>r=5
*/
------------------------------------------------------------------------------------------------------------------
The Complete Script
So let's review the script. I have added comments to document the script – to make it more readable and easy to follow. You can use almost anything that isn't a recognised script command for comments. There is a reserved word called Remark which can be used:
Remark>This is a comment
But I've used // to indicate my comments. Some people like to use **. Use what you feel comfortable with – as long as it isn't a recognised script command – or it will try to execute your comments. Which could be interesting!
...it continues... check the help file to read the whole thing...
------------------------------------------------------------------------------------------------------------------
Also, try the Block Comment feature recently added to the Advanced Editor...
Have you looked in the Help file?
- From the Macro Scheduler Main Window, Click Help/Contents to open the Help file.
- Click the "Search" tab if it is not already highlighted.
- In the "word(s) to search for" field, type in: comments
- Click the "List Topics" button.
------------------------------------------------------------------------------------------------------------------
Remark
Remark>Some Comment
The remark statement is ignored by the interpreter. It exists simply to allow comments to be placed in the code. In fact, any text that is not a recognised command can be used for this purpose.
Several lines of code can also be commented out in one go by using /* before and */ after the lines to be commented. E.g.:
/*
Let>r=5
Repeat>r
DDERequest>Excel,efile.xls,R%r%C2,Name,60
Let>r=r+1
Until>r=5
*/
------------------------------------------------------------------------------------------------------------------
The Complete Script
So let's review the script. I have added comments to document the script – to make it more readable and easy to follow. You can use almost anything that isn't a recognised script command for comments. There is a reserved word called Remark which can be used:
Remark>This is a comment
But I've used // to indicate my comments. Some people like to use **. Use what you feel comfortable with – as long as it isn't a recognised script command – or it will try to execute your comments. Which could be interesting!
...it continues... check the help file to read the whole thing...
------------------------------------------------------------------------------------------------------------------
Also, try the Block Comment feature recently added to the Advanced Editor...
- Open a script in the Advanced Editor.
- Highlight a couple lines you'd like to "comment out".
- Click Edit/Block Comment... and the lines will be commented out.
- If you do not wish these lines commented out, you could manually delete the /* and */ lines that have been inserted or... click Edit/Undo to reverse your last action (/* and */ lines will be removed) or just press CTRL-Z which is the keyboard shortcut for Undo.
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -