file print text in script area

1 year 1 week ago #6301 by joset
Hi,

I'm using Modelio.getInstance().getScriptService().getScriptEngine(None) to retrieve script so to display (print) messages in the script window of Modelio.

Anyone ever did that ?

Thank you, José

Please Log in or Create an account to join the conversation.

1 year 1 week ago #6307 by cma
Hello,

Modules don't have access to the "Script" view.

You may capture the output of the script with a java code like this:
ScriptEngine engine = Modelio.getInstance().getScriptService().getScriptEngine(getClass().getClassLoader());
StringWriter out = new StringWriter();
engine.getContext().setWriter(out);

engine.eval("print 'Hello world!'");

// Get the result with
out.toString();

You may then create a SWT dialog to display the output.

Regards,

CMA

Please Log in or Create an account to join the conversation.

1 year 2 days ago #6325 by joset
Hi,

I implemented this code excatly in my module but it does not print

:-(

Please Log in or Create an account to join the conversation.

Moderators: tmachmaab
Time to create page: 0.034 seconds
^ Back to Top