Author |
Topic  |
|
hauli
Austria
Posts |
Posted - 05/30/2006 : 01:56:51 AM
|
Origin Version (Select Help-->About Origin): 7.5 Operating System: windows XP
Dear all!
I got a few questions concerning automation of analysis: I got my data in MS Excel, want to import it in Origin, plot the data, perform a NLSF fit and save the results as a pdf file.
I already read through the help files and the automation examples, but I need some further hints:
- what would be the proper procedure to build up the code? That means: should I open the Code Builder, write down the code, compile it, save it? Please provide me a step by step procedure on how to do it. Where can I find code examples for my automation task?
- what are the possibilities to run the code? Is it possible to create a button in the toolbar that invokes the procedure, maybe by asking in a pop-up window which Excel data source to analize.
- in the help files it is suggested to use "Open Excel in Origin" rather then importing options, if the data source is Excel. I prefer to import the data to Origin and save data a results in an Origin project. What would be the code for importing data?
Thanks, Hauli
|
|
Deanna
China
Posts |
Posted - 05/30/2006 : 10:59:25 PM
|
Hi, Hauli.
quote:
- what would be the proper procedure to build up the code? That means: should I open the Code Builder, write down the code, compile it, save it? Please provide me a step by step procedure on how to do it. Where can I find code examples for my automation task?
Please refer to the Origin programming help file: Code Builder User Guide: Introduction. This chapter explains the basics of how to program with the code builder. If you think it is not clear, please let me know, and we will try to explain more.
quote:
- what are the possibilities to run the code? Is it possible to create a button in the toolbar that invokes the procedure, maybe by asking in a pop-up window which Excel data source to analize.
It is possible to create a button in the toolbar/workbook to invoke the procedure. The button can be used to run a Labtalk script, which could call your procedures.
The chapter that explains this is in programming help file: Programming Guide: User Interface Development: Label Buttons and programming help file: Programming Guide: User Interface Development: Toolbar Buttons
quote:
- in the help files it is suggested to use "Open Excel in Origin" rather then importing options, if the data source is Excel. I prefer to import the data to Origin and save data a results in an Origin project. What would be the code for importing data?
The Origin C function WorksheetPage::OpenExcel() can be used to import Excel.
void test_OpenExcel(string strWorkbookPathname) { WorksheetPage wpg;
BOOL bOK = wpg.OpenExcel(strWorkbookPathname, "Sheet1");
out_int("OK = ", bOK); if (!wpg) { out_str("Invalid page!"); }
out_str(wpg.GetName()); }
Compile and build this function, and run it like:
test_OpenExcel("d:\book1.xls")
Then the first sheet of the file, d:\book1.xls, will be imported.
Deanna OriginLab GZ Office |
 |
|
hauli
Austria
Posts |
Posted - 06/09/2006 : 02:04:07 AM
|
As mentioned above, it is possible to invoke a LabTalk skript (.ogs) by refering it to a user defined toolbar buttom.
I wrote a OriginC skript named "NRU.c" and can not refer or connect it to a toolbar buttom; what would be the possible procedure to this this? Do I need a LabTalk script that invokes "NRU.c"? And how would this look like?
Thanks, Hauli
|
 |
|
Deanna
China
Posts |
Posted - 06/09/2006 : 04:44:34 AM
|
Yes, it is possible to call an OC function from a label button.
There is detailed description and an example in programming help file: Programming Guide: User Interface Development: Label Buttons: Calling an Origin C Function from a Label Button
Deanna OriginLab GZ Office |
 |
|
|
Topic  |
|
|
|