Loop/repeat part of the macro script



Hi all. I’m wondering whether it’s possible for me to only repeat part of the macro script for a bunch of pictures. My script asks for the directory to save pictures at the beginning into a variable, but I don’t want it to ask every time after the first time. So I want to “loop” only on how to process the picture, not where to save the pictures.

I searched the page for Built-in Macro Functions, but didn’t find any function like that. I’m pretty familiar with the autohotkey script, which has a “loop” function and only the loop part is repeated. I’m not sure whether ImageJ macro can also do that.

Thank you~


Dear @Fijipuff
I think you can start opening the script editor in Fiji and load the Process Folder Imagej 1 Macro example.
It’s a good start to start to implement a “loop” just for some tasks and understand how you can get parameters such as saving and input directory (http://imagej.net/Script_Parameters)

have a nice day,


You are correct. Loops are not listed on the Built-Ins page because they are considered statements rather than functions. It may help to review more of the macro language documentation. In particular, you may want to read about loops.