Hi lillt91,
You can invoke Integrate gadget from the script as described at:
https://www.originlab.com/doc/LabTalk/ref/Gadget-obj
Assuming your data is sorted by X values, and there is no rectangle object (thus newly
created ROI boxes are named as rect and rect1), the following snippet does something
similar to your sample screenshot:////////////////////////////////////////////////////////////////
///Calculation of ROI positions
sum(%C); //Calculate max Y and its row number(imax) of the plot
x1From=xof(%C)[1]; //X of 1st data point
pkindex=sum.imax; //Index of Peak
pky=sum.max; //Peak height
xPeak=xof(%C)[sum.imax]; //X of the peak
range rg=1; //1st plot in the graph
xLastTo=xof(%C)[rg.getSize()]; //X of the last point
xWidth1=xPeak-x1From; //Width of 1st half
xCenter1=(xPeak+x1From)/2; //Center of 1st half
xWidth2=xLastTo-xPeak; //Width of 2nd half
xCenter2=(xPeak+xLastTo)/2; //Center of 2nd half
///1st ROI
addtool_curve_integ; //Create gadget
gadget gg = rect; //1st rectangle for ROI
gg.dx=xWidth1; //Set the ROI width
gg.x=xCenter1; //Set the ROI center
///2nd ROI
addtool_curve_integ; //Create gadget
gadget gg2 = rect1; //1st rectangle for ROI
gg2.dx=xWidth2; //Set the ROI width
gg2.x=xCenter2; //Set the ROI center
Label -s Peak %C[$(pkindex)]: ($(xPeak,.3), $(pky,.3)); //Put a label
////////////////////////////////////////////////////////////////
Hope this helps.
--Hideo Fujii
OriginLab