Hi GT,
There is an x-function named get_plot_sel which can be used to get ranges corresponding to the two selections. You may need to update your Origin to 8.0SR6 (free patch) for that to work.
Here is a script segment that does LR on the 1st selection. Was not very clear what you wanted stats on, I am assuming you wanted stats on the y data of the 2nd selection.
Easwar
OriginLab
// Assume graph is active with two ranges selected
// Get selection to string
string sel$;
get_plot_sel str:=sel$;
// Declare range using 1st selected range
range r1 = sel.gettoken(1,"|")$;
// Perform linear fit
fitlr r1;
type Linear fit results from 1st part:;
fitlr.=;
// Declare range of the y data for 2nd selected range
range -w r2 = sel.gettoken(2,"|")$;
// Compute stats
stats r2;
type %(CRLF)Stats results from 2nd part:;
stats.=;