-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNodeAHK.cs
52 lines (47 loc) · 1.21 KB
/
NodeAHK.cs
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
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Reflection;
#r "System.Windows.Forms.dll"
using System.Windows.Forms;
using System.Threading.Tasks;
using Core = IronAHK.Rusty.Core;
using Common = IronAHK.Rusty.Common;
public class Startup
{
public async Task<object> GetMousePosition(object input)
{
int x, y;
long win;
string control;
int mode = 0;
Core.MouseGetPos(out x, out y, out win, out control, mode);
return new { x = x, y = y };
}
public async Task<object> MouseClickDrag(dynamic input)
{
Core.MouseClickDrag(input.button, input.x1, input.y1, input.x2, input.y2, input.duration);
return 0;
}
public async Task<object> AddHotkey(dynamic input)
{
Func<object, Task<object>> callback = input.callback;
string sequence = input.hotkey;
Core.GenericFunction proc = (object[] args) => callback(new {foo="bar"});
//var hkdef = Common.Keyboard.HotkeyDefinition.Parse(sequence);
//Core.InitKeyboardHook();
//Common.Keyboard.KeyboardHook.Add(hkdef);
return 0;
}
public async Task<object> SendInput(object input)
{
Core.Send(input.ToString());
return 0;
}
}
static class Random
{
public static int GetRandomNumber()
{
return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
}