Macro run problem?
Posted by Amelie Marzin on Apr 05, 2011; 12:50pm
URL: http://imagej.273.s1.nabble.com/Macro-run-problem-tp3685127.html
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