mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 06:54:58 +00:00
fix
This commit is contained in:
parent
db94c4ae13
commit
5f6489f6ac
|
@ -18,7 +18,7 @@ var applications = [];
|
|||
var localApplications = [];
|
||||
|
||||
var assign = function() {
|
||||
SHELL.runWindow("cscript app.js shadow");
|
||||
SHELL.runVisibleWindow("cscript app.js shadow");
|
||||
};
|
||||
|
||||
var pingtest = function() {
|
||||
|
|
26
lib/shell.js
26
lib/shell.js
|
@ -20,6 +20,7 @@ var ShellObject = function() {
|
|||
this.workingDirectory = null;
|
||||
this.isElevated = false;
|
||||
this.isFork = false;
|
||||
this.isVisibleWindow = false;
|
||||
|
||||
this.create = function() {
|
||||
try {
|
||||
|
@ -40,6 +41,11 @@ var ShellObject = function() {
|
|||
return this;
|
||||
};
|
||||
|
||||
this.setVisibleWindow = function(visible) {
|
||||
this.isVisibleWindow = visible;
|
||||
return this;
|
||||
};
|
||||
|
||||
this.build = function(cmd) {
|
||||
if (typeof(cmd) === "string") {
|
||||
return cmd;
|
||||
|
@ -90,21 +96,13 @@ var ShellObject = function() {
|
|||
var fork = (typeof(fork) !== "undefined") ? fork : true;
|
||||
var c = "%comspec% /q /c (" + this.build(cmd) + ")";
|
||||
console.info("ShellObject.run() -> " + c);
|
||||
this.interface.Run(c, 0, !fork);
|
||||
};
|
||||
|
||||
this.runWindow = function(cmd, fork) {
|
||||
var fork = (typeof(fork) !== "undefined") ? fork : true;
|
||||
var c = "%comspec% /q /c (" + this.build(cmd) + ")";
|
||||
console.info("ShellObject.runWindow() -> " + c);
|
||||
this.interface.Run(c, 1, !fork);
|
||||
this.interface.Run(c, (!this.isVisibleWindow ? 0 : 1), !fork);
|
||||
};
|
||||
|
||||
this.runAs = function(FN, args) {
|
||||
var c = FN + " " + args.join(' ');
|
||||
var oShell = CreateObject("Shell.Application");
|
||||
console.info("ShellObject.runAs() -> " + c);
|
||||
oShell.shellExecute(FN, args, null, "runas", 0);
|
||||
console.info("ShellObject.runAs() -> " + FN);
|
||||
oShell.shellExecute(FN, args, this.workingDirectory, "runas", (!this.isVisibleWindow ? 0 : 1));
|
||||
return oShell;
|
||||
};
|
||||
|
||||
|
@ -143,8 +141,8 @@ exports.run = function(cmd, fork) {
|
|||
return (new ShellObject()).run(cmd, fork);
|
||||
};
|
||||
|
||||
exports.runWindow = function(cmd, fork) {
|
||||
return (new ShellObject()).runWindow(cmd, fork);
|
||||
exports.runVisibleWindow = function(cmd, fork) {
|
||||
return (new ShellObject()).setVisibleWindow(true).run(cmd, fork);
|
||||
}
|
||||
|
||||
exports.createProcess = function(cmd, workingDirectory) {
|
||||
|
@ -162,6 +160,6 @@ exports.createDesktopIcon = function(filename, workingDirectory) {
|
|||
return (new ShellObject()).createDesktopIcon(filename, workingDirectory);
|
||||
};
|
||||
|
||||
exports.VERSIONINFO = "Shell Lib (shell.js) version 0.1";
|
||||
exports.VERSIONINFO = "Shell interface (shell.js) version 0.2";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user