Login  Register

Re: JavaScript macro recorder issues?

Posted by Rasband, Wayne (NIH/NIMH) [E] on Mar 24, 2010; 6:07pm
URL: http://imagej.273.s1.nabble.com/JavaScript-macro-recorder-issues-tp3688738p3688739.html

On Mar 23, 2010, at 4:19 PM, Adam Goode wrote:

> Hi,
>
> I am testing out the macro recorder to make a JavaScript macro. Using
> 1.43s, I did a few steps and got this macro:
>
> imp = IJ.openImage("http://rsb.info.nih.gov/ij/images/embryos.jpg");
> IJ.run(imp, "8-bit", "");
> setAutoThreshold("Default");
> //run("Threshold...");
> setThreshold(0, 104);
> IJ.run(imp, "Convert to Mask", "");
> imp.show();
>
>
> When I did Auto Threshold, it inserted "setAutoThreshold", and
> "setThreshold", which are old macro commands and don't work in
> JavaScript. Is there a imp.setAutoThreshold() function or something that
> it should be recording instead?

This bug is fixed in the 1.43t1 daily build. This is the code that is now recorded:

   imp = IJ.openImage("http://rsb.info.nih.gov/ij/images/embryos.jpg");
   IJ.run(imp, "8-bit", "");
   //run("Threshold...");
   IJ.setAutoThreshold(imp, "Default");
   IJ.setThreshold(imp, 0, 104);
   IJ.run(imp, "Convert to Mask", "");
   imp.show();

-wayne