Author |
Topic  |
|
peter.cook
UK
356 Posts |
Posted - 12/13/2007 : 10:56:23 AM
|
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
|
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 |
 |
|
peter.cook
UK
356 Posts |
Posted - 12/18/2007 : 06:16:11 AM
|
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
|
 |
|
easwar
USA
1965 Posts |
Posted - 12/18/2007 : 12:40:01 PM
|
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
|
 |
|
peter.cook
UK
356 Posts |
Posted - 12/19/2007 : 03:32:56 AM
|
Hi Easwar,
Thanks.
Can you pleasae confirm if my code will do the job correctly, for now?
Cheers,
Pete
|
 |
|
cpyang
USA
1406 Posts |
Posted - 12/19/2007 : 07:51:00 AM
|
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
|
 |
|
peter.cook
UK
356 Posts |
Posted - 12/19/2007 : 09:14:59 AM
|
Hi CP.
Thanks,
This is of course better coding.
Cheers,
pete
|
 |
|
|
Topic  |
|
|
|