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
 Trap Execute error with Origin COM
 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 - 12/13/2007 :  10:56:23 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 SR6
Operating System: Win 2000

Hi,

Using a .NET application that launches Origin I would like to be able to trap when the code I wish to run via eg myOBj.Execute doesn't work.

For this example I wish to have the application trap when I run myObj.Execute(PeteCode.ogs, PeteSection) but the file or section doesn't exist.

Any ideas?

Thanks,

Cheers,

pete

joseph_king

China
Posts

Posted - 12/14/2007 :  03:17:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Peter,

Could you give us the detail in your .Net application? Maybe we can supply more infomation. It can only get "true"(for success) or "false"(for failing) return value in Execute function. Do you want to catch the error code for different cases? We don't support this now.

OriginLab Technical Services
Go to Top of Page

peter.cook

UK
356 Posts

Posted - 12/18/2007 :  06:16:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I'm not asking for the Execute function to return anything other than false. The problem is that it only appears to return TRUE whether or not the required code section / file exists.

myObj.Execute("run.section(filename.ogs,section)") will always return TRUE.

I assume this is because the run.section has worked. What I need is a way to trap if the section and / or file exists. I would have liked for example to have tried :

if myObj.Execute("run.section(filename1,section1)")="FALSE" then
myObj.Execute("run.section(filename2,section2)
end if

Is it enough / correct to do something like (VBA):

myObj.Execute("
CheckScript=run.section(filename1,section1);
if(CheckScript!=0) CheckScript=run.section(filename1,section1);
")
if myObj.ltvar("CheckScript")<>0 then
// trap script not found
end if

Regards,

pete

Go to Top of Page

easwar

USA
1965 Posts

Posted - 12/18/2007 :  12:40:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Pete,

This capability does not exist currently and a tracker item has been added to implement this in the future. Tracker number QA 10832

Thanks,

Easwar
OriginLab

Go to Top of Page

peter.cook

UK
356 Posts

Posted - 12/19/2007 :  03:32:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Easwar,

Thanks.

Can you pleasae confirm if my code will do the job correctly, for now?

Cheers,

Pete

Go to Top of Page

cpyang

USA
1406 Posts

Posted - 12/19/2007 :  07:51:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I just tried in LT and if ogs filename or its section not found, a missing value is returned. So testing for !=0 should be good enough, but to ensure proper interpretation of missing value back to VB, maybe

CheckScript=run.section(filename1,section1);
if(CheckScript ==0/0) CheckScript=-1;

such that
0 = success
1 = LT error
-1 = not found


CP




Go to Top of Page

peter.cook

UK
356 Posts

Posted - 12/19/2007 :  09:14:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi CP.

Thanks,

This is of course better coding.

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