mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-12 00:45:14 +00:00
Create virtualinput.js
This commit is contained in:
parent
d8dc4e99d4
commit
6fc3c7b508
31
lib/virtualinput.js
Normal file
31
lib/virtualinput.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// VirtualInput API
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var VirtualInputObject = function() {
|
||||||
|
this.oShell = null;
|
||||||
|
this.oAutoIt = null;
|
||||||
|
|
||||||
|
this.create = function() {
|
||||||
|
try {
|
||||||
|
this.oShell = CreateObject("WScript.Shell");
|
||||||
|
this.oAutoIt = CreateObject("AutoItX.Control");
|
||||||
|
} catch (e) {
|
||||||
|
console.error("VirtualInputObject.create() -> " + e.message);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
this.moveMouse = function(x, y) {
|
||||||
|
this.oAutoIt.MouseMove(x, y);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.sendKeys = function(s) {
|
||||||
|
this.oShell.SendKeys(s);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.create();
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.create = function() {
|
||||||
|
return (new VirtualInputObject()).create();
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user