← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #253810]: calling runPyhton function from javascript

 

Question #253810 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/253810

    Status: Open => Answered

RaiMan proposed the following answer:
this works with version 1.0.1:

you need sikuli-script.jar on the class path.

    import org.sikuli.scriptrunner.JythonScriptRunner;

// get and init the Jython script runner
    JythonScriptRunner runner = new JythonScriptRunner();
    runner.init(null); // now the runner is reusable and should be reused if needed (but only one run at a time)

    File script = new File("test.sikuli"); // in working folder otherwise absolute path needed
// run the script
//runner.runScript(pyfile to run, image path for stored images, prameter 3, parameter 4)
    runner.runScript(new File(script,"test.py"), script, new String[]{"", ""}, null);

parameter 3 can be used to give parameters to the script as sys.args (if not used this way it MUST be new String[]{"", ""} )
parameter 4 should be null

In version 1.1.0 this will be more comfortable (but not yet fully
implemented).

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.