Login  Register

Re: Run Measure after drawing a Line

Posted by Wayne Rasband on Dec 07, 2007; 9:33pm
URL: http://imagej.273.s1.nabble.com/Run-Measure-after-drawing-a-Line-tp3697825p3697826.html

Change the macro so it runs the Measure command when the user lets up  
the mouse button. Here is a macro tool that does this.

-wayne

  macro "Measure Line Tool -C00bL1de0L1ee1" {
         getCursorLoc(x, y, z, flags);
         xstart = x; ystart = y;
         x2=x; y2=y;
         while (true) {
             getCursorLoc(x, y, z, flags);
             if (flags&16==0) {
                  run("Measure");
                  exit;
             }
             if (x!=x2 || y!=y2)
                 makeLine(xstart, ystart, x, y);
             x2=x; y2=y;
             wait(10);
         };
     }

On Dec 7, 2007, at 3:40 PM, jsmith wrote:

> I'm new to writing Macros, and I'm trying to write one that will run  
> Measure
> each time I draw a line.  So far I have it so that Measure is running
> continuously while I draw the line, then stops measuring after I stop
> drawing.
>
> Is there a way I can make Measure only run after the mouse is released?
>
> Thanks for any advice you can give.
> --  
> View this message in context:  
> http://www.nabble.com/Run-Measure-after-drawing-a-Line- 
> tf4964297.html#a14220131
> Sent from the ImageJ mailing list archive at Nabble.com.
>