This repository has been archived by the owner on Nov 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Factorio.ahk
114 lines (107 loc) · 2.07 KB
/
Factorio.ahk
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
DetectHiddenWindows, On
chartTitle = Factorio input tools
gameTitle = ahk_exe factorio.exe
IME_STARTCOMPOSITION := 0
IME_ENDCOMPOSITION := 0
WM_IME(wParam, lParam, msg, hwnd)
{
global IME_STARTCOMPOSITION, IME_ENDCOMPOSITION
if msg = 269
{
IME_STARTCOMPOSITION := 1
IME_ENDCOMPOSITION := 0
}
else if msg = 270
{
IME_ENDCOMPOSITION := 1
IME_STARTCOMPOSITION := 0
}
}
loop
{
WinWaitNotActive, %chartTitle%
IfWinExist, %chartTitle%
{
IfWinNotActive, %gameTitle%
Gui, Hide
else
Gui, Show
}
}
#IfWinActive, Factorio input tools
ESC::
IfWinExist, %chartTitle%
{
Gui, Destroy
IME_STARTCOMPOSITION := 0
IME_ENDCOMPOSITION := 0
ControlSend, ,{ESC}, %gameTitle%
Return
} else
{
ControlSend, ,{ESC}, %gameTitle%
Return
}
Enter::
IfWinActive, %chartTitle%
{
If(IME_STARTCOMPOSITION > 0 && IME_ENDCOMPOSITION < 1)
{
IME_STARTCOMPOSITION := 0
IME_ENDCOMPOSITION := 0
SendInput, {Shift}
SendInput, {Shift}
return
}
Gui, submit
if(ChartText != "")
{
current_clipboard = %Clipboard%
clipboard = ""
clipboard = %ChartText%
Sleep, 50
;Send ^v
SendMessage, 0x100, 17, 0, , %gameTitle%
SendMessage, 0x100, 86, 0, , %gameTitle%
SendMessage, 0x101, 86, 0, , %gameTitle%
SendMessage, 0x101, 17, 0, , %gameTitle%
ControlSend, ,{Enter}, %gameTitle%
clipboard = ""
clipboard = %current_clipboard%
}
else
{
Sleep, 50
ControlSend, ,{Enter}, %gameTitle%
}
Gui, Destroy
IME_STARTCOMPOSITION := 0
IME_ENDCOMPOSITION := 0
return
} else {
ControlSend, ,{Enter}, %gameTitle%
return
}
#IfWinActive, ahk_exe factorio.exe
`::
WinGetPos, X, Y, W, H, %gameTitle%
chartX := X + 40
chartY := Y + H - 30
IfWinNotExist, %chartTitle%
{
current_clipboard = %Clipboard%
clipboard := "Factorio chart"
PostMessage, 0x100, 17, 0, , %gameTitle%
clipboard := "Factorio chart1"
if clipboard = Factorio chart1
{
ControlSend, ,~, %gameTitle%
}
clipboard = %current_clipboard%
Gui, Add, Edit, x1 y1 w300 h20 vChartText
Gui,-Caption +Owner
Gui, Show, x%chartX% y%chartY% h21 w303, %chartTitle%
OnMessage(0x10D, "WM_IME")
OnMessage(0x10E, "WM_IME")
Return
}