Re: Scripting IJ with javascript
Posted by
Wayne Rasband on
Feb 22, 2009; 6:42pm
URL: http://imagej.273.s1.nabble.com/Scripting-IJ-with-javascript-tp3693611p3693614.html
The JavaScript code contains 5 invalid hidden characters. You can
remove them using the Edit>Zap Gremlins command in the macro editor.
-wayne
On Feb 22, 2009, at 8:44 AM, Gabriel Landini wrote:
> Strangely, the same js below does not execute when run from the menu:
>
> Error: missing ; before statement (<Unknown source>#9) in <Unknown
> source> at
> line number 9
>
> but executes OK from a macro window.
>
> ----8<----
> erodeExact();
>
> function erodeExact() {
> var imp = IJ.getImage();
> var ip = imp.getProcessor();
> ip.snapshot();
> Undo.setup(Undo.FILTER, imp);
> ip.invert();
> if (Prefs.blackBackground)
> ip.erode();
> else
> ip.dilate();
> ip.invert();
> imp.updateAndDraw();
> }
> ----8<----
>
> I tried adding { } after the "if" but makes no difference
> Cheers
>
> Gabriel