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
 All Forums
 Origin Forum
 Origin Forum
 Automation and COM communication

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
peter.cook Posted - 04/20/2004 : 09:56:34 AM
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

3   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 04/20/2004 : 4:27:58 PM
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


peter.cook Posted - 04/20/2004 : 2:47:06 PM
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

easwar Posted - 04/20/2004 : 11:01:41 AM
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



The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000