// This is a macro version of the polyline tool. // Click in the box at the starting point, or // right-click, to finalize the polyline. var segmentLength = 80; macro "Polyline Tool -C00bB12Pf6b21213792e0" { toolName = IJ.getToolName(); size = 6/getZoom; x = newArray(2000); y = newArray(2000); getCursorLoc(x2, y2, z2, flags); x[0] = x2; y[0] = y2; x[1] = x2; y[1] = y2; n = 2; setOption("DisablePopupMenu", true); Overlay.drawRect(x[0]-size, y[0]-size, size*2, size*2); Overlay.show; while (flags&20!=0) // left and right click getCursorLoc(x2, y2, z2, flags); while (true) { getCursorLoc(x2, y2, z2, flags); if (flags&20!=0) { modKey = flags&14!=0; //right-click, control or alt while (flags&16!=0) getCursorLoc(x2, y2, z2, flags); inBox = x2>x[0]-size&&x2y[0]-size&&y2