The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Automation and COM communication
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

peter.cook

UK
356 Posts

Posted - 04/20/2004 :  09:56:34 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I have an excel application that launches an instance of Origin and successfully passes data to a customised application which then analyses the data. I can manually prompt Excel to then retrieve the results via GetWorksheet, but what I want to do is to automatically pass the results back to Excel and close the Origin instance. This step could be either done by Origin code (post analysis) or by Excel (presumably knowing when the analysis is finished?). Any help would be appreciated.

Cheers,

pete

easwar

USA
1964 Posts

Posted - 04/20/2004 :  11:01:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Pete,

We are adding an example in the upcoming SR3 release for 7.5 that shows how to perform curve fitting of Excel data using Orign as a COM server. This example may address what you are looking for.

The files that will be added in SR3 are in the following OPK that you can download and try now:
http://www.OriginLab.com/ftp/forum_and_kbase/files/DoseResponseCurveFitting.OPK

The above OPK will unpack to two files by the same name, and extensions of .XLS and .OPJ. The unpacking will be done to your user files folder area under \Samples\Automation Server\Excel
You may then want to move those to the Origin EXE area under the same subfolder (which is where they will appear in SR3).

Or you can place the two files in any subfolder - the XLS and OPJ file just need to be in the same subfolder because the XLS looks for the OPJ in the folder in which it exists.

This example does the following:
-> The Excel client starts Origin - gives you choice to connect to existing Origin or launch a new one
-> Excel loads a custom OPJ in Origin which has worksheets, graph, and Origin C code attached to the OPJ, that is all set up to perform the analysis (in this case, curve fitting)
-> Excel pushes data into the worksheet of this custom OPJ
-> Origin starts the computation
-> Excel waits for the computation to finish by using the Run() method of Automation Server
-> Origin places a text message in one of the wks cells on finishing the computation
-> Excel fetches this text message and checks if the computation was successful, or an error message was placed

Easwar
OriginLab


Go to Top of Page

peter.cook

UK
356 Posts

Posted - 04/20/2004 :  2:47:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Easwar,

Many thanks for quick reply.
The last two lines outline a good approach....my Origin application can pass something to an Excel app which will wait for this. I guess Excel can pass the name of the workbook to origin so origin then passes the 'finish' value back to the correct instance? I will look at the OPK (maybe identifying the excel app is covered here?)...this is of particular interest in itself re curve fitting too.

Cheers,

Pete

Go to Top of Page

easwar

USA
1964 Posts

Posted - 04/20/2004 :  4:27:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

I guess Excel can pass the name of the workbook to origin so origin then passes the 'finish' value back to the correct instance?


Hi Pete,

When you use Origin as a COM server, the client has to send the data over to Origin as well as fetch the results back from Origin - there is no method for Origin to take over and then send the data back to the (appropriate) Excel client.

Also, it sounds like what you want to do is to have multiple Excel clients access the same Origin server application? If yes, you will need to use OriginPro as the server application, and not standard Origin.

In OriginPro, a particular client can issue a BeginSession command to Origin when the client establishes connection. This makes sure other clients cannot communicate with the Origin session until this first client issues a subsequent EndSession command to release the connection. Each client then needs to poll and see if Origin is available and so wait for its turn to communicate. And each client then has to also get its results back (using GetWorksheet method etc) from the Origin server.

An example of using Begin/EndSession commands is available in the product under the \Samples\Automation Server\VB\BeginEndSession subfolder. There are two apps, FirstApp.exe and SecondApp.exe that act as two clients trying to communicate with the same Origin session. You can see that if they do not issue Begin/End Session commands (if the check box is unchecked), then the data from the two clients "run into each other" in the Origin session. If the "Use Begin/End Session" checkbox is checked, then one client has to wait till the other is done.

Hope this helps.

Easwar
OriginLab


Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000