Macro call function defined in another file?

imagej
macro

#1

Hi there,

I’m putting together a set of scripts (ijm files) and would like call the same function in each of those.

So to make maintenance/updating etc easier, I’d like to put the function in a separate file by itself.

So I’m wondering how, from an ijm macro/script file do you call an ijm function defined in another file?


#2

Good day!

I’d just call another ImageJ macro instead of a function, i.e. I’d use the other macro as the desired function.

From your main macros you call another macro by using the ImageJ-function:

runMacro("name of the external macro", "string with parameters to pass");

The external macro should look like this:

macro "name of the external macro" {
	print( getArgument() ); // do what you need to do here with the parameters returned by getArgument()
	exit();
}

HTH

Herbie