macro 'Align-at-Capture [A]'; { Toggles between the live camera window and a reference image allowing user to rotate and transform the stage or camera for alignment of serial sections. To start, save the first reference section. Open the first reference section. Run the macro. Align sections. Hit mouse button to stop and average 4 camera frames. The resulting image will saved into the folder you specify in the first dialog box. To terminate, press command "." . } var x,y,width,height,pid,n,p:integer; begin n:=1; pid:=PidNumber; startcapturing; SelectWindow('Camera'); if nPics=1 then begin PutMessage('Open reference image and restart macro'); exit; end; REPEAT REPEAT ChoosePic(pid); SelectAll; Copy; SelectWindow('Camera'); startcapturing Paste; Paste; Paste; Paste; Undo; UNTIL button; AverageFrames('Average',4); saveAs(n:2); ChoosePic(pid); Close; Open(n:2); ShowMessage('Saved ',n); pid:=PidNumber; n:=n+1; UNTIL button; end;