#pragma rtGlobals=1 // Use modern global access method. Menu "Macros" "Prepare for Record Cursor", pPrepareForRecordCursor() "Record Cursor", RecordCursorNow() end Proc pPrepareForRecordCursor(RecordBaseName) String RecordBaseName = "CursorPositions" Prompt RecordBaseName, "Base name for recording cursor positions" PrepareForRecordCursor(RecordBaseName) end Function PrepareForRecordCursor(RecordBaseName) String RecordBaseName String/G RecordCursorBaseName = RecordBaseName Wave xw = $(RecordCursorBaseName+"_X") Wave yw = $(RecordCursorBaseName+"_Y") if (WaveExists(xw) %| WaveExists(yw)) DoAlert 1, "Waves already exist.\rOverwrite them?" if (V_flag != 1) return 0 endif endif Make/O/N=0 $(RecordCursorBaseName+"_X") Make/O/N=0 $(RecordCursorBaseName+"_Y") Edit $(RecordCursorBaseName+"_Y"),$(RecordCursorBaseName+"_X") end Function RecordCursorNow() SVAR RecordCursorBaseName = RecordCursorBaseName Wave xw = $(RecordCursorBaseName+"_X") Wave yw = $(RecordCursorBaseName+"_Y") if (!WaveExists(xw) %| !WaveExists(yw)) abort "One of the recording waves could not be found. Maybe you need to select Prepare for Record Cursor from the Macros menu." endif Variable thePoint = numpnts(xw) Wave wa = CsrWaveRef(A) Wave wb = CsrWaveRef(B) if (WaveExists(wa)) InsertPoints thePoint, 1, xw, yw xw[thePoint] = hcsr(A) yw[thePoint] = vcsr(A) endif if (WaveExists(wb)) InsertPoints thePoint, 1, xw, yw xw[thePoint] = hcsr(B) yw[thePoint] = vcsr(B) endif end