2021-06-19 21:08:19 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// VirtualInput API
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
var VirtualInputObject = function() {
|
|
|
|
this.oShell = null;
|
|
|
|
this.oAutoIt = null;
|
|
|
|
|
|
|
|
this.create = function() {
|
|
|
|
try {
|
|
|
|
this.oShell = CreateObject("WScript.Shell");
|
2021-06-22 21:51:48 +00:00
|
|
|
this.oAutoIt = CreateObject("AutoItX3.Control");
|
2021-06-19 21:08:19 +00:00
|
|
|
} catch (e) {
|
|
|
|
console.error("VirtualInputObject.create() -> " + e.message);
|
|
|
|
}
|
2021-06-22 21:51:48 +00:00
|
|
|
};
|
2021-06-19 21:08:19 +00:00
|
|
|
|
|
|
|
this.moveMouse = function(x, y) {
|
|
|
|
this.oAutoIt.MouseMove(x, y);
|
|
|
|
};
|
|
|
|
|
|
|
|
this.sendKeys = function(s) {
|
|
|
|
this.oShell.SendKeys(s);
|
|
|
|
};
|
|
|
|
|
|
|
|
this.create();
|
|
|
|
};
|
|
|
|
|
2021-06-22 21:51:48 +00:00
|
|
|
exports.VERSIONINFO = "VirtualInput Lib (virtualinput.js) version 0.1";
|
|
|
|
exports.global = global;
|
|
|
|
exports.require = global.require;
|
|
|
|
|
2021-06-19 21:08:19 +00:00
|
|
|
exports.create = function() {
|
2021-06-19 21:08:55 +00:00
|
|
|
return new VirtualInputObject();
|
2021-06-19 21:08:19 +00:00
|
|
|
};
|
2021-06-22 21:51:48 +00:00
|
|
|
|
|
|
|
exports.moveMouse = function(x, y) {
|
|
|
|
return (new VirtualInputObject()).moveMouse(x, y);
|
|
|
|
};
|