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
 LabTalk Forum
 Testing for X-Function Existance
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cdrozdowski111

USA
247 Posts

Posted - 07/25/2013 :  07:21:30 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 9.0.0 SR2 64-bit, Win7 64-bit, running in VMware Fusion 5.0.3


Let's say I have developed a LT script in Origin 9 but want it to be able to run the script in an earlier version of Origin. How can I test if a given X-Function exists in the earlier version?

For example, the "insert_graph_to_layer" X-Function was introduced in 9. What can I add to my script to make the script not stumble in Origin 8.x?

What would be the most elegant/classy way too?

greg

USA
1378 Posts

Posted - 07/25/2013 :  11:33:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Script within braces runs in a new context - the same as script running in a called OGS. Errors within these new contexts do not stop a script (or even output an error message) they simply return.

You can use this information in the following way:

flag = 0;
{
insert_graph_to_layer;
flag = 1; // If an error occurs, this never runs
}
if(flag == 1)
continue; // No problem
else
{
ty -a An Error has occurred.;
// Uncomment following line to stop script completely
// break;
// or execute error handling which lets script continue
// your handling here
}
ty -a Continuing ...;

Edited by - greg on 07/25/2013 11:34:20 AM
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