More about the macro language – basic syntax and operators
Until now, you have learned how to keep track of the menu options you select in order to create a program that executes all of them in a sequential way.
The ImageJ macro language is much richer than just the options output by the macro recorder. This section explains a bit more about the macro programming language.
Variables
You can define your own variables inside the macro language. A very simple example is as follows:
message = "Hello, World!"; print(message);
This macro simply causes the message, Hello, World! to appear on the ImageJ log window. The print(message)
command outputs its messages there. In this case, the text is contained in the message
variable. Variables in ImageJmacros may contain any type of data (numeric, strings, arrays) and they need not be declared, they are created when their values are assigned. Another example is as follows:
message1 = "Hello, World!"; message2 = 40 + 2; print(message1, message2); print(message1...