I am looking for a way to launch multiple scripts in a separate process from my main script, but in such a way that they can access copies of variables I've declared. Consider the following example:
Serializable.js:
// Represents serializable data.
function Serializable() { /* ... */ }
SecondaryScript.wsf
// Serializable is not defined here!
FakeMoney.prototype = new Serializable();
function FakeMoney(amount) { /* ... */ }
MainScript.wsf:
<job>
<script language="JScript" src="Serializable.js"></script>
<script language="JScript">
var WshShell = new ActiveXObject("WScript.Shell");
// `Serializable` is defined here...
var oExec = WshShell.Exec("cscript SecondaryScript.js");
WScript.Echo(oExec.Status);
</script>
</job>
Is there a way to define Serializable
for the code in SecondaryScript.js
while running SecondaryScript.js
in a separate process?