Login  Register

Re: Problem with Duplicate in batch macro

Posted by Rasband, Wayne (NIH/NIMH) [E] on Aug 18, 2010; 11:26pm
URL: http://imagej.273.s1.nabble.com/Problem-with-Duplicate-in-batch-macro-tp3687187p3687188.html

On Aug 18, 2010, at 5:21 PM, Adam Goode wrote:

> Hi,
>
> I have this macro:
>
>
> var z = getImageID();
> print(z);
> selectImage(z);
>
> run("Duplicate...", "title=item2");
> var z2 = getImageID();
> print(z2);
>
> selectImage(z);
> selectImage(z2);
>
>
>
> I if run like this it works:
> java -jar ij.jar test1.png test.txt
>
> I get this in the log:
> -2
> -3
>
>
> If I run in batch:
> java -jar ij.jar test1.png -batch test.txt
>
> I get this:
> -2
> -3
> Image -2 not found or no images are open.
>
>
> This happens with 1.44e and 1.44f11.
>
>
>
> Note that if I add the image to the macro directly and not on the
> command line:
>
> open("test.png");
>
> then everything works, in batch mode and not:
> java -jar ij.jar -batch test2.txt
>
> -2
> -3
>
>
>
> Any ideas?

It works if you add

    open(getArgument);

to the beginning of the macro and run it using

    java -jar ij.jar -batch test.txt test1.png

-wayne