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
 Button for my attached scriptfile
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Chris2

20 Posts

Posted - 10/07/2010 :  03:36:47 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Windows Vista
Origin 8.1

Hello,

I have a Origin Project and attached a Origin C-Script to this project so everbody has the opportunity to see the script whether he has the script on his pc or not (of course if he has the projectfile). Now my question is, if it is possible to create my own button which executes functions of the attached scriptfile without any ogs-files.

Hope you can help me

larry_lan

China
Posts

Posted - 10/07/2010 :  11:43:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Chris:

Are you saying you attached an .c file in the OPJ? When talking about script, we mean .ogs files in Origin.

So, currently, you have a .c file, which attached in an OPJ. Then you share this OPJ. And you want to run the .c file by a single click in another computer. Right?

If so, you can:

  • As you mentioned, you need an .ogs file and a custom button. And then associate this .ogs with the button settings. The draw back is you should also share this .ogs file.


  • Make a button by:

    Add a test on worksheet, right-click and select Programming Control.



    And then call the c function



  • Beside buttons, you can also turn you .c functions into an X-Function, and shared this X-Function with others. X-Functions can easily run from command window or custom menu item. It just need to compile once, and it doesn't need to attached with an OPJ. Please look at "Help -> Programming -> X-Function" to see how to create one.


Thanks
Larry
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 10/08/2010 :  01:48:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
However, to ensure that the OriginC finction is compiled when you activate the button, you will need to do a bit more than indicated by Larry above ....
The following is an example of a button script that I use to ensure compilation and execution of an OriginC function called "MassNormalizeMCVPDSC" which is located in an OriginC file called "MicroCalDSC.c"


%P=System.Path.Program$;
%Z=OriginC\System\rnahl\ImportSpecial\MicrocalDSC\MicroCalDSC.c;
if(run.loadOC(%P%Z)!=0)
{
     ty -q Cannot Load Origin Support File MicroCalDSC.c;
     ty -b;
}
 else
{
     ty -q Loading Origin Support File MicroCalDSC.c;
     MassNormalizeMCVPDSC();
};
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