2020-07-24 01:32:44 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// VBScript API
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
var SHELL = require("lib/shell");
|
|
|
|
|
|
|
|
exports.VERSIONINFO = "VBScript (vbscript.js) version 0.1";
|
|
|
|
exports.global = global;
|
|
|
|
exports.require = global.require;
|
|
|
|
|
|
|
|
exports.execScript = function(scriptName, args) {
|
2020-07-26 11:40:25 +00:00
|
|
|
var cmd = [
|
|
|
|
"cscript",
|
|
|
|
scriptName + ".vbs"
|
|
|
|
];
|
2020-07-24 01:32:44 +00:00
|
|
|
|
2020-07-26 11:40:25 +00:00
|
|
|
if (typeof(args) !== "undefined") {
|
|
|
|
cmd = cmd.concat(args);
|
2020-07-24 01:32:44 +00:00
|
|
|
}
|
|
|
|
|
2020-07-26 11:40:25 +00:00
|
|
|
return SHELL.exec(cmd);
|
2020-07-24 01:32:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.execCommand = function(command) {
|
|
|
|
// MSScriptControl.ScriptControl
|
|
|
|
var ret, sc = new ActiveXObject("ScriptControl");
|
|
|
|
sc.language = "VBScript";
|
|
|
|
sc.addCode(command);
|
|
|
|
sc.allowUI = true;
|
|
|
|
//sc.eval(command);
|
|
|
|
ret = sc.run(command);
|
|
|
|
sc = null;
|
|
|
|
return ret;
|
|
|
|
};
|