On Jun 12, 2014, at 10:58 AM, ben.s.carlson wrote:You can cancel a waitForUser dialog and abort the macro by pressing the esc key.
> Hello,
>
> I have two questions regarding the macro language. After some searching and
> experimentation, I can't find the answer so I'm wondering if anybody can
> provide assistance.
>
> I have a somewhat interactive macro in which there are several waitForUser
> prompts that request that the user takes some action.
>
> 1) I'm wondering if there is some way to add a Cancel button to the
> waitForUser prompt. I'd like to do this because if the user makes a mistake
> and has to start over, there is no way for them to do so. Instead, they
> just have to click "OK" on the many prompts that appear until the macro
> finishes.
>
> Here is a small snippet. Can I add Cancel buttons to these prompts?
>
> waitForUser( "Pause","Focus on the ruler");
> setTool("line");
> waitForUser( "Pause","Draw a line and set scale");
> 2) The second is related to the request to "set the scale" above. Is it
> possible to automate this so that the user is not required to click Analyze
> -> Set Scale? The "Distance in Pixels" value is always the length of the
> line the user just drew, "Known distance" is 1.0, and "Unit of length" is
> cm. This seems like it is something that can be automated.
This should do it:
getLine(x1, y1, x2, y2, lineWidth);
if (x1==-1)
exit("Stright line selection required");
dx=x2-x1; dy=y2-y1;
length = sqrt(dx*dx+dy*dy);
setVoxelSize(1/length, 1/length, 1, "cm");
-wayne> Sent from the ImageJ mailing list archive at Nabble.com.
>
> Thank you for the help!
>
> Ben
>
>
>
>
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Macro-cancel-button-set-scale-tp5008166.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
If you reply to this email, your message will be added to the discussion below:http://imagej.1557.x6.nabble.com/Macro-cancel-button-set-scale-tp5008166p5008180.html
Free forum by Nabble | Disable Popup Ads | Edit this page |