Skip to main content
13-Aquamarine
February 15, 2024
Solved

start an external exe via ACL with return value

  • February 15, 2024
  • 1 reply
  • 1920 views

Hi together,

 

we would like send some elements as string to an external .exe Tool, and want to get the result as a return value back in acl. So we need a interaction between acl and the external exe.
Do you have an idea how we can do this via ACL? 
We know the "sh" command, which starts the exe, but we cannot get a return value from this.


Best regards

Best answer by GarethOakes

I see three other options: system(), javascript() and java_static().

 

Here are some untested example ideas for each:

system("my.exe arg1 arg2")
javascript('runCommand("my.exe", "arg1", "arg2")')
java_static("MyClass", "MyMethod", "args")

 

Java works because it is built in to Arbortext. Javascript works because Arbortext uses Rhino, which is itself spawned from Java.

 

The Java method should use Runtime.getRuntime().exec("my.exe arg1 arg2") which returns a Process object from which you can gather the output and return values.

 

1 reply

16-Pearl
February 15, 2024

I see three other options: system(), javascript() and java_static().

 

Here are some untested example ideas for each:

system("my.exe arg1 arg2")
javascript('runCommand("my.exe", "arg1", "arg2")')
java_static("MyClass", "MyMethod", "args")

 

Java works because it is built in to Arbortext. Javascript works because Arbortext uses Rhino, which is itself spawned from Java.

 

The Java method should use Runtime.getRuntime().exec("my.exe arg1 arg2") which returns a Process object from which you can gather the output and return values.

 

hbestler13-AquamarineAuthor
13-Aquamarine
February 19, 2024

Hi GarethOakes,

 

thanks for your help. After many tests  with java (unfortunately not our preferred programming language) we were successfull with using java_static.
We could get a return value back from java to acl. Now we must implement our operations with C# and call the exe via Java and path is through ACL 🙂

 

Thank you. 
Greetings from germany

16-Pearl
February 21, 2024

Yes, there is no direct binding to the CLR available from Arbortext, so any heavy lifting must be done via Java. The only Microsoft bindings are for JScript and VBScript which allow access to Windows COM objects. If you don't wish to use Java then you can use Javascript (Rhino interpreter) which runs inside the JRE.

FWIW, our standard approach these days is to use a minimal amount of ACL and code all business logic inside Java classes.