Execute script from a script

rbarbout

Member
Hello all,

Is it possible to execute a third party script from within a script and if yes, how ?
(I searched in the forum but searching for "script" in a forum dedicated to scripting returned too much :rolleyes: !)

Is see a Script object in the Object Explorer that inherits from ProcessInstance so my guess was that I could use something like script.executeOn().
But each time I get an error "Attempt to execute a Script instance recursively".

Thanx in advance for any answer.

Robert.
 
Sorry, I have got an answer, but I have the same question! If the answer turns out to be "yes, it is possible," could the responder provide a code example, please?
Alex
 
Hi Robert and Alex,

Unfortunately, the JavaScript engine is not reentrant. This means that you cannot execute nested scripts (a script from a script from a script...), and that's why you're getting the "recursively" error. You cannot execute a Script instance from a script because it would lead to a catastrophic crash. Maybe we'll be able to overcome this limitation in a future version, but that's what we have for now.

Is it possible to execute a third party script from within a script and if yes, how ?

Nothing stops you from including the 3rd party script's source code in your script with an #include directive. Of course, this is not always possible, and in general only works if the script in question has been designed to work in a modular way. You can also modify the 3rd party script or excerpt portions of its source code to use them in your work, provided that the 3rd party script's license allows you to do that.
 
Hi Robert and Alex,

Unfortunately, the JavaScript engine is not reentrant. This means that you cannot execute nested scripts (a script from a script from a script...), and that's why you're getting the "recursively" error. You cannot execute a Script instance from a script because it would lead to a catastrophic crash. Maybe we'll be able to overcome this limitation in a future version, but that's what we have for now.



Nothing stops you from including the 3rd party script's source code in your script with an #include directive. Of course, this is not always possible, and in general only works if the script in question has been designed to work in a modular way. You can also modify the 3rd party script or excerpt portions of its source code to use them in your work, provided that the 3rd party script's license allows you to do that.
Hi Juan,

OK, I understand.
I will try to integrate the third party script in mine then.
Thank you for the answer.

Robert.
 
Back
Top