http://imagej.273.s1.nabble.com/Possible-to-call-a-javascript-script-or-function-w-arguments-from-a-macro-tp5006888p5006901.html
> On Mar 12, 2014, at 4:36 PM, Christophe Leterrier wrote:
>
> > Hi,
> >
> > I'd like to know if it is possible to call some javascript from a macro
> in
> > ImageJ. What I want to do is call the javascript, passing some arguments
> to
> > it (like a filepath), let it run, and return to the macro for further
> > processing. How should I proceed ?
>
> You can call a JavaScript file and pass it an argument using the
> runMacro(path,arg) macro function. For example, the macro
>
> rtn = runMacro("test.js", "string argument");
> print("return="+rtn);
>
> outputs
>
> arg=string argument
> return=this is the return value
>
> when the file "test.js" (assumed to be in the Image/macros folder) contains
>
> print("arg="+getArgument());
> "this is the return value";
>
> The JavaScript code retrieves the argument by calling getArgument() and
> the value of the last expression evaluated ("this is the return value") is
> returned to the calling macro.
>
> -wayne
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>