-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathiohook_test.js
40 lines (26 loc) · 1.06 KB
/
iohook_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict';
const ioHook = require('iohook');
// ioHook.on("mousedown",function(msg){console.log(msg);});
// ioHook.on("keypress",function(msg){console.log(msg);});
// ioHook.on("keydown",function(msg){console.log(msg);});
// ioHook.on("keyup",function(msg){console.log(msg);});
// ioHook.on("mouseclick",function(msg){console.log(msg)});
// ioHook.on("mousewheel",function(msg){console.log(msg)});
// ioHook.on("mousemove",function(msg){console.log(msg)});
// ioHook.on("mousedrag",function(msg){console.log(msg)});
//start ioHook
ioHook.start();
// ioHook.setDebug(true); // Uncomment this line for see all debug information from iohook
// Key constants
const CTRL = 29;
const ALT = 56;
const F7 = 65;
// Registers shortcut
ioHook.registerShortcut([CTRL, F7], (keys) => {
console.log('Shortcut pressed with keys:', keys);
});
// let shId = ioHook.registerShortcut([ALT, F7], (keys) => {
// console.log('This shortcut will be called once. Keys:', keys);
// ioHook.unregisterShortcut(shId);
// })
// console.log('Hook started. Try type something or move mouse');