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 server problem

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
AtiLaw Posted - 05/11/2004 : 10:52:51 AM
Hi,

I have recently decided to change a VB6 application which I used DDE to load data into an open origin application through script commands. Now I want to not bother with the user having to open origin and just use the automation server to do what I was doing with the DDE. I can get the automation server working, declare my applicationSI and stuff, but for some reason the instance of origin stays open in the background when i endsession and close the VB app.

I am guessing it is something to do with me having changed the project so it stays open as it needs saving or something, but for the minute I just want to be able to close all existing sessions of origin when closing the session.

Probably a very easy answer to this so sorry if its a silly question!

Laurence
5   L A T E S T    R E P L I E S    (Newest First)
AtiLaw Posted - 05/17/2004 : 05:31:02 AM
I started to realised problems with my plan when I actually got time to sit down and think properly about the problem and noticed a few things about COM! Thanks for the link to vba code, its going to be really helpful I think.

I am going to do what I was doing with my DDE version, which is close every instance of origin on execution of the code, and just make sure users dont start any new sessions whilst my software is running.

Thanks again,
Laurence
easwar Posted - 05/14/2004 : 09:56:00 AM
quote:

...have neven seen the exit command before so I will give this a try...

I could possibly just try and connect to use the existing open origin instances, closing each one I connect to until I have closed them all?



Hi Laurence,

Note that the Exit command is not part of the COM methods and properties.
OriginApp.Execute("exit;")
is just sending a LabTalk command string called "exit" to Origin, which ends the Origin session (provided the IsModified is reset so that no prompt is brought up).

Regarding connecting to each existing session and closing them all, the issue is that if you try to connect using ApplicationSI, if a session does not exist, then a new one is launched! So using ApplicationSI you will not be able to connect only to existing sessions and close them.

Alternative would be to write special VB code to use Windows functions to check for existing instances of Origin application. See this post for a sample VB code:
http://www.originlab.com/forum/topic.asp?TOPIC_ID=3006

This is a general COM issue. As long as your client application launches a unique instance and cleanly handles the closing of that instance when the client is done, and as long as the user is not independantly launching other instances and killing them etc. at the same time the client is running, things will work out well. Otherwise, the problem is more complicated in my opinion.

Easwar
OriginLab


AtiLaw Posted - 05/14/2004 : 05:11:17 AM
Thanks Easwar. I have used the ismodified flag, but have neven seen the exit command before so I will give this a try. I had written VB code before in VB.NET which searched through procid strings for origin then ended the process, but in VB6 its nearly impossible without knowing the process id number (I don't know of a way to use the process id string anyway). Its more a VB problems when tackling it from that angle though. I could possibly just try and connect to use the existing open origin instances, closing each one I connect to until I have closed them all?

Ah well.. will let you know how I get on!

Thanks again.
Laurence
easwar Posted - 05/11/2004 : 12:00:51 PM
Hi Laurence,

It could be that the "IsModified" property of Origin is set, which means that your client app made a change to Origin that is "worth" saving the project. So Origin may be waiting for you to decide whether to save the OPJ or not.

So at the end of the client app, you could do the following:
OriginApp.IsModified=false
OriginApp.Execute("exit;")

The first line resets the "IsModified" flag so that Origin does not wait for user to decide on saving the project or not, when the "exit" command is issued to close the Origin session.

By the way, if the above is the case, and Origin was really waiting for you to decide whether to save or not, even if the Origin session was hidden, this should still have poppued up the "save yes/no" dialog.

As for closing all existing sessions, typically from the client you close only the one you connect to. In order to query and see if there are other sessions, you may need to write some special VB code to call Windows functions to look for apps with name "Origin" and then close them, or something along those lines. But this may not be required if the client cleanly manages the session that it connects to, or launches by itself.

Easwar
OriginLab

AtiLaw Posted - 05/11/2004 : 11:07:37 AM
Forgot to mention I am using OriginPro 7.5.
Thanks.

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