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 for Programming
 Forum for Origin C
 Load C files on opening project via command line
 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 - 01/07/2004 :  6:04:52 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I would like to load c files on opening an Origin project as specified in a command line. The OPJ file is the same always but the C file may be different. I have tried using def endopen as defined in different cnf files eg in testn.cnf

def EndOpen {

if(run.LoadOC(AZ\testn.C)!=0) type -b "Failed to load testn.C";

};

then opening via a command line such as

...\origin75.exe -a testn.cnf Test.opj

The problem is that testn fails to compile but running endopen from script window after project has loaded works fine..

Cheers,

Pete

Mike Buess

USA
3037 Posts

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

Generally the system files have to be ready before you can compile anything else and it appears that EndOpen runs before the system files are compiled. You might need to use OEvents.ogs to compile your file. Assuming that you run on menu level 1 (Full Menus) you can try this...

1> Close Origin and open Origin.ini in notepad. Find this line...

; ogs1 = OEvents

under the [Config] section, remove the semicolon and save.

2> Open OEvents.ogs in notepad and add this line to the [AfterCompileSystem] section...

if( %1 ) EndOpen;

That will run EndOpen again after the system files have been (successfully) compiled. It's easy enough to try at least.

Mike Buess
Origin WebRing Member
Go to Top of Page

peter.cook

UK
356 Posts

Posted - 01/15/2004 :  12:40:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

Thanks for pointer.

Worked fine. I was confused that endopen runs / project is opened before system files compiled. I would have expected this to be the other way ie project BUT I have noticed a significant lag before AfterCompileSystem section runs. Is the project really opened before system files start compiling? Anyone?

Cheers,

Pete

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 01/15/2004 :  6:16:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Pete,

I ran a test with EndOpen and OEvents...

# Macros.cnf
def EndOpen { ty -a EndOpen; };

# OEvents.ogs
[BeforeUserCNF]
// This event is triggered before any user CNF file is executed.
// Execution of system CNF files takes place earlier
// so system.cnf, option.cnf, and orgsys.cnf are executed
// before this event is triggered.
ty -a BeforeUserCNF;

[AfterUserCNF]
// This event is triggered after all user CNF files are executed.
ty -a AfterUserCNF;

[BeforeCompileSystem]
// This event is triggered before Origin begins start up compilation of system folder.
ty -a BeforeCompileSystem;

[AfterCompileSystem]
// This event is triggered after Origin finishes startup compilation of system folder.
// Use this event for additional customization of Origin that requires Origin C functions
// that are compiled on startup.
// %1 = 1 if compilation is successful otherwise %1 = 0.
ty -a AfterCompileSystem;

[BeforeOpenDoc]
// This event is triggered before Origin project is opened.
// %1 = file path in quotes.
ty -a BeforeOpenDoc;

[AfterOpenDoc]
// This event is triggered after Origin project is opened.
// %1 = file path in quotes.
ty -a AfterOpenDoc;

After starting Origin by naming Origin.opj on the command line my script window looked like this after removing the line returns...

BeforeUserCNF
AfterUserCNF
BeforeOpenDoc
AfterOpenDoc
BeforeCompileSystem
EndOpen
AfterCompileSystem

The AfterOpenDoc, BeforeCompileSystem and EndOpen messages appear almost simultaneously, but always in that order and there is the significant lag you spoke of before AfterCompileSystem appears. In any case, it certainly looks like the project is opened before the system files start compiling.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/15/2004 6:19:19 PM
Go to Top of Page

peter.cook

UK
356 Posts

Posted - 01/16/2004 :  10:03:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

Thanks. One problem I had was that the origin event handlers only work with menu level 1 - in the past our customised menus have always been set with level 3. Have found another problem (http://www.originlab.com/forum/topic.asp?TOPIC_ID=2828 with attached files.

Cheers,

pete

Go to Top of Page

Mike Buess

USA
3037 Posts

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

If by event handlers you mean OEvents, you can use it on menu level 3 by adding the line 'ogs3=OEvents' to the Config section of Origin.ini.

Mike Buess
Origin WebRing Member
Go to Top of Page

peter.cook

UK
356 Posts

Posted - 01/22/2004 :  05:28:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

Apologies for late eacknowledgement - I have used now as you described. Seems a bit daft now I think of it...why else have multiple system events?

Cheers,

Pete

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