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
 All Forums
 Origin Forum
 Origin Forum
 Calling Origin from command line and Java run time

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
newuser_ca Posted - 06/06/2012 : 2:58:41 PM
OriginPro 8.6 in Win7

I have a user interface written in Java. There is a button to call Origin. The button can open Origin window and load project but it didn't run the script after "-r".

However, I have no problem running this in Command Prompt.

Here is the function call:
“c:\Program Files\OriginLab\Origin\origin86_64.exe" -r (import(CSVFILE);) c:\TDV\import.opj

where import.opj is Origin project and "import" is the function in the project.

Java runtime didn't run the script "import(CSVFILE);". It worked well in the Command Prompt.

Can anybody tell me what is wrong?

Thanks.
1   L A T E S T    R E P L I E S    (Newest First)
Sophy Posted - 06/06/2012 : 10:25:26 PM
Hi, We check the code and it works fine with Java, and I'd like to share the code that works(Tested in NetBeans IDE 7.0).


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package launcho;
/**
 *
 * @author OriginLab
 */
public class LaunchO {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        System.out.println("---This is demo project from OriginLab---");
        
        String strCmd = "K:\\OriginPro86\\Origin86_64.exe -r (import(K:\\data.csv);) K:\\importCSS.opj";
        try
        {
            String strRet = exec(strCmd);
        }
        catch(Exception e)
        {
            System.out.println("Exception while execute DOS command");
        }
    }
    public static String exec(String strCmd) throws Exception
    {
        Runtime rt = Runtime.getRuntime();
        Process proc = rt.exec(strCmd);
        int nRet = proc.waitFor();
        if ( nRet != 0 )
        {
            return "Exit code not right";
        }
        return "Successfully executed";
    }
}

and the Origin C code which is attached to the project is like the following:

#include <Origin.h>
////////////////////////////////////////////////////////////////////////////////////

//#pragma labtalk(0) // to disable OC functions for LT calling.

////////////////////////////////////////////////////////////////////////////////////
// Include your own header files here.


////////////////////////////////////////////////////////////////////////////////////
// Start your functions here.
void	import(string lpcszFileName)
{
	string strCmd;
	strCmd.Format("impcsv %s;", lpcszFileName);
	LT_execute(strCmd);
}


Hope it will help.

If there is any further problem, would you please send you sample Java code together with your sample project and CSV files to our Technique Support team, so we can do more checking.

You could follow the instructions below to send your file.
http://www.originlab.com/index.aspx?go=Support&pid=752



Best Regards.

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000