Forum Discussion
On a Groundplex you should be able to use the Script Snap to execute a command line, and in that invoke any OS command. If the Operating system supports remote execution of commands, then you should be able to achieve your task.
Hi CStewart
Do you know the exact commands or can guide me to an online resource to execute a command line in javascript? I was trying to edit the default code in the script snap.
var impl = {
/*
* These variables (input, output, error, log) are defined by the
* ExecuteScript snap when evaluating this script.
*/
input : input,
output : output,
error : error,
log : log,
/**
* The "execute()" method is called once when the pipeline is started
* and allowed to process its inputs or just send data to its outputs.
*
* Exceptions are automatically caught and sent to the error view.
*/
execute : function () {
this.log.info("Executing Transform Script");
**var wshShell = new ActiveXObject("WScript.Shell");**
wshShell.Run(“D:\dir\user.bat”);
while (this.input.hasNext()) {
try{
// Read the next document, wrap it in a map and write out the wrapper
var doc = this.input.next();
var wrapper = new java.util.HashMap();
wrapper.put(“original”, doc);
this.output.write(doc, wrapper);
this.log.info(“Transform Script finished”);
}
catch(err) {
var wrapper = new java.util.HashMap();
wrapper.put("errorMsg", err);
this.log.error(err);
this.error.write(wrapper);
}
}
}
};