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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ProjectSky
committed
Mar 9, 2017
1 parent
2294001
commit 5ed716c
Showing
4 changed files
with
131 additions
and
64 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
### Factorio Chat Tool (Autohotkey) | ||
|
||
##### 功能说明 | ||
* 基于 [AHK](https://autohotkey.com/) | ||
* 该脚本用于处理 Factorio 中文聊天的问题。 | ||
|
||
#### 示例 | ||
* ![效果示例](https://img.vim-cn.com/31/7d54115eff90c58d78bee7f4886bc78c6eb7e4.gif) | ||
|
||
##### 使用说明 | ||
* 打开该程序,自动运行于后台,无需其他设置。 | ||
* 按下 ~ 键即可打开外部输入窗口,输入你想发送的信息按下回车发送。 | ||
* 如需取消输入按下 ESC 即可关闭输入菜单。 | ||
|
||
##### 注意事项 | ||
* 只能运行于窗口模式,不会与其他游戏 & 程序冲突,只对 Factorio 生效。 | ||
* 输入模式会占用游戏中 ~ 和 Entel 键,请不要与这两个键冲突,保持游戏默认键位。 |