WaitForUser problem
Posted by Ben G on Nov 05, 2008; 6:41pm
URL: http://imagej.273.s1.nabble.com/WaitForUser-problem-tp3694321.html
I made up two macro files a) and b). They are separate files.
I open them both in IJ and run them one at a time. I decided to put them sequentially into a single file - maco a) and macro b). When I install the macro and run it, macro a) works fine and macro b) crashes with a nonsensical error message that expects a ")" in the middle of a P=nSlice kind of statement.
After spending a week fighting with this bug (and using the pgms separately), I tried again and found the bug. For trouble shooting my code, I wrote a simply Pause function shown below.
function P(){waitForUser("Press any key to continue");}
located inside the end of each macro.
The function works fine in the separate macros. After getting the macros working OK, I removed all calls to the function, but left the functions sitting there in a) and b).
The fix to all the problems was to delete the code from a), then everything worked fine.