#jarchi - how to run a system command inside a script

Started by Xavier Mayeur, November 08, 2019, 15:19:45 PM

Previous topic - Next topic

Xavier Mayeur

Hello,

Is it any possibility to run a system command inside a jarchi script, like invoking an external program ?

Thanks

Thomas Rischbeck (ITMC.ch)

Dear all - I'm also looking for an answer to this. Can I call a .exe file on a Windows system directly from an Archi script? Kind regards, Thomas.
ITMC AG • Bahnhofstrasse 10 • CH-8001 Zürich
Dr. Thomas Rischbeck
PhD in Computer Science
Managing Partner   
rischbeck@itmc.ch
www.itmc.ch

Jean-Baptiste Sarrodie

Hi,

Short answer: no

Long answer: jArchi doesn't expose this feature through its API, but jArchi is based on Nashorn which is a JAVA based implementation of Javascript with some extensions. One of these extensions is the ability to use Java classes from JS, so it should be possible to run a system command through Java through JS.

Regards,

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Phil Beauvoir

// Launch Notepad on Windows from a jArchi script
var runtime = Java.type("java.lang.Runtime").getRuntime();
runtime.exec("notepad.exe");
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.