Origin Ver. and Service Release (Select Help-->About Origin): 9 Operating System:Windows 7x64
Good afternoon, With my beginning skills in Origin, I have been able to make a template that allows me to batch import csv files with a certain format. I am missing a few features that may require code.
1) Where can I plant code in a template file to add more features?
2) What code can I try to copy the name of a worksheet (i.e. "Sheet1") to the name seen in Project Explorer for that book?
3) What code can I try to copy a slope value from a "Linear Fit; Parameters" table to a Summary book containing values from each batch file?
It isn't clear from your post what's driving the batch import and how a template is involved so I cannot address question 1.
Question 2 is problematic. Project Explorer only shows Child Windows in Origin. A Workbook is an example of a Child Window, but it may contain more that one Worksheet and that information is not displayed in Project Explorer. For the special case of a Workbook containing only one Worksheet, you could set the Workbook Long Name to show the sheet name or some combination, as in: page.label$ = layer.name$; // Long name has only sheet name page.label$ = [%H]%(layer.name$); // Long name use formal range notation You can decide what to show as the page Title: page.title = 1; // Show just Long Name page.title = 3; // Show both Short and Long Names
For question 3, you should use the getresults X-Function as follows: // For Book3 with Report Sheet Linear Fit of Sheet1 C getresults tr:=mytr iw:=[Book3]"Linear Fit of Sheet1 C"!; slope = mytr.Parameters.Slope.Value; ty Value of slope is $(slope);
Hi Greg. Thanks for replying! 1) Right now I have one .opj file with raw data and columns with calculated formulae/graphs. Then I use a SaveTemplateAs command generating a .ogw file. With BatchProcessing... , I think it replaces the raw data for each csv file with this workbook template.
2) The first worksheet of each workbook always contains the name. Where would I feed the code lines you suggested? Into what window?
3) I tried range r2 = 2!Col(14); in the BeforeFormula Scripts with Col(x)= r2 because I don't quite know how to work with the code you suggested (yet!). I think it works.