Login  Register

Re: Macro run problem?

Posted by Juanjo Vega on Apr 05, 2011; 1:33pm
URL: http://imagej.273.s1.nabble.com/Macro-run-problem-tp3685127p3685131.html

Trying to help you I ran a macro from the plugins>macros>run menu while recording, and it wrote "runMacro(<macrofile>)" instead of "runMacroFile(<macrofile>, <args>)".

Maybe there are two methods and you are calling a different one than the menu.

If your macro is not so long, it might help if you paste it in your next email, so we can run it by ourselves :)

On Apr 5, 2011, at 2:50 PM, Amelie Marzin wrote:

> Hi everyone,
>
> I have a problem I really don't understand.
>
> For a project, I created a toolbar (like ActionBar_ plugin) to launch some macros and plugins. To launch my macros, I used
> IJ.runMacroFile(macroFile, arguments);
>
> My problem is: I have one macro which works perfectly when I do Plugins>Macros>Run. But doesn't work when I launch it from my toolbar.
> This macro helps to select a precise point of an image. It creates an other image as a "zoom", and copies (in the zoom frame) an area around the cursor (I hope I'm clear enough...).
> To get the cursor position, I used
> getCursorLoc(x, y, z, flags);
> in a loop. I have a condition to stop when flags!=0 and leftButton!=0 : the user clicked somewhere, I open a window to confirm his selection.
>
> Like I said, when I launch my macro from ImageJ menu, it works perfectly. But when I launch it from my toolbar, it seems to be in a infinite loop. After some debug, I think that 'flags' is always at 0 in my macro...
>
> [I don't know if my explanation is really clear... I'll try to copy my macro if you need it.]
>
>
> What could cause this problem? Is there a notion of threads?
>
> Thanks,
>
> Amelie Marzin

------------------------------------------------------------
Juanjo Vega ([hidden email])

Unidad de Biocomputación. Laboratorio B-13.
Centro Nacional de Biotecnología. CNB-CSIC.
C\ Darwin, 3. Campus de Cantoblanco.
Universidad Autónoma de Madrid.
28049, Madrid, Spain.

http://www.cnb.csic.es
http://www.biocomp.cnb.csic.es

+34 91 585 4510

"Las mejores almas son capaces de los mayores vicios como de las mayores
virtudes, y aquellos que caminan despacio por el camino recto pueden
llegar más lejos que los que corren pero se apartan de él." - Discurso
del Método, René Descartes.