mirror of
				https://github.com/gnh1201/welsonjs.git
				synced 2025-10-31 04:51:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			942 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			942 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| //////////////////////////////////////////////////////////////////////////////////
 | |
| // VirtualInput API
 | |
| /////////////////////////////////////////////////////////////////////////////////
 | |
| 
 | |
| var VirtualInputObject = function() {
 | |
| 	this.oShell = null;
 | |
| 	this.oAutoIt = null;
 | |
| 
 | |
| 	this.create = function() {
 | |
| 		try {
 | |
| 			this.oShell = CreateObject("WScript.Shell");
 | |
| 			this.oAutoIt = CreateObject("AutoItX3.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.VERSIONINFO = "VirtualInput Lib (virtualinput.js) version 0.1";
 | |
| exports.global = global;
 | |
| exports.require = global.require;
 | |
| 
 | |
| exports.create = function() {
 | |
| 	return new VirtualInputObject();
 | |
| };
 | |
| 
 | |
| exports.moveMouse = function(x, y) {
 | |
| 	return (new VirtualInputObject()).moveMouse(x, y);
 | |
| };
 |