-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYahooKeyKeyIMELayout.ahk
114 lines (106 loc) · 3.71 KB
/
YahooKeyKeyIMELayout.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
#SingleInstance ignore
#Include locale.ahk
Menu, Tray, Tip, %GuiTitle%
Menu, Tray, NoStandard
Menu, Tray, Add, %AboutItemMenuTray%, About
Menu, Tray, Default, %AboutItemMenuTray%
Menu, Tray, Click, 1
DvorakLayoutFile = kbddv.dll
USLayoutFile = kbdus.dll
Loop, HKLM, SYSTEM\CurrentControlSet\Control\Keyboard Layouts, 1, 1
{
if (A_LoopRegName = "Ime File") {
RegRead, CurrentImeFile
if (CurrentImeFile = "KEYKEY.IME") {
YKKRegSubKey = %A_LoopRegSubKey%
}
}
}
If (YKKRegSubKey = "") {
MsgBox, 16, %TitleYKKNotFound%, %MsgYKKNotFound%
ExitApp
}
RegRead, YKKLayoutFile, HKLM, %YKKRegSubKey%, Layout File
SplitPath, YKKLayoutFile, , , , YKKLayoutFileNoExt
YKKCurrentLayoutFile := %YKKLayoutFileNoExt%
If (YKKCurrentLayoutFile = "") {
YKKCurrentLayoutFile = %YKKLayoutFile%
}
Gui, Add, Button, x20 y200 w360 h30 gYKKGuiClose, %ButtonCancel%
Gui, Add, Text, x20 y10 w360 h60 Center, %TextCurrent%`n`n%YKKCurrentLayoutFile% %TextKeyboardLayout%
If (YKKLayoutFile = USLayoutFile) {
Gui, Add, Button, x20 y80 w360 h30 gSetDvorak, %ButtonSetDvorak%
Gui, Add, Button, x20 y120 w360 h30 gSetUS Disabled, %ButtonSetUS%
} else If (YKKLayoutFile = DvorakLayoutFile) {
Gui, Add, Button, x20 y80 w360 h30 gSetDvorak Disabled, %ButtonSetDvorak%
Gui, Add, Button, x20 y120 w360 h30 gSetUS, %ButtonSetUS%
} else {
;If (YKKLayoutFile != USLayoutFile and YKKLayoutFile != DvorakLayoutFile) {
Gui, Add, Button, x20 y80 w360 h30 gSetDvorak, %ButtonSetDvorak%
Gui, Add, Button, x20 y120 w360 h30 gSetUS, %ButtonSetUS%
}
Gui, Add, Button, x20 y160 w360 h30 gCustomize, %ButtonCustomize%
Gui +LabelYKKGui
Gui, Show, xCenter yCenter w400 h250, %GuiTitle%
Return
SetUS:
Gui, Submit
RegWrite, REG_SZ, HKLM, %YKKRegSubKey%, Layout File, %USLayoutFile%
RegRead, YKKLayoutFile, HKLM, %YKKRegSubKey%, Layout File
SplitPath, YKKLayoutFile, , , , YKKLayoutFileNoExt
YKKCurrentLayoutFile := %YKKLayoutFileNoExt%
If (YKKCurrentLayoutFile = "") {
YKKCurrentLayoutFile = %YKKLayoutFile%
}
MsgBox, 36, %TitleDone%, %TextCurrent%`n`n%YKKCurrentLayoutFile%`n`n`n%MsgNeedReboot%
IfMsgBox Yes
Shutdown, 6
ExitApp
SetDvorak:
Gui, Submit
RegWrite, REG_SZ, HKLM, %YKKRegSubKey%, Layout File, %DvorakLayoutFile%
RegRead, YKKLayoutFile, HKLM, %YKKRegSubKey%, Layout File
SplitPath, YKKLayoutFile, , , , YKKLayoutFileNoExt
YKKCurrentLayoutFile := %YKKLayoutFileNoExt%
If (YKKCurrentLayoutFile = "") {
YKKCurrentLayoutFile = %YKKLayoutFile%
}
MsgBox, 36, %TitleDone%, %TextCurrent%`n`n%YKKCurrentLayoutFile%`n`n`n%MsgNeedReboot%
IfMsgBox Yes
Shutdown, 6
ExitApp
Customize:
Gui, Submit
Select:
FileSelectFile, SelectLayoutFile, 1, %A_WinDir%\system32\kbdus.dll, %TitleSelectLayoutFile%, %FileTypeLayoutFile% (kbd*.dll)
If (SelectLayoutFile = "") {
ExitApp
}
SplitPath, SelectLayoutFile, SelectLayoutFileName, , , SelectLayoutFileNoExt
YKKNewLayoutFile := %SelectLayoutFileNoExt%
If (YKKNewLayoutFile = "") {
YKKNewLayoutFile = %SelectLayoutFile%
}
MsgBox, 35, %TitleConfirmLayout%, %MsgConfirmLayout% %YKKNewLayoutFile% %TextKeyboardLayout%?
IfMsgBox Yes
RegWrite, REG_SZ, HKLM, %YKKRegSubKey%, Layout File, %SelectLayoutFileName%
IfMsgBox No
Goto, Select
IfMsgBox Cancel
ExitApp
RegRead, YKKLayoutFile, HKLM, %YKKRegSubKey%, Layout File
SplitPath, YKKLayoutFile, , , , YKKLayoutFileNoExt
YKKCurrentLayoutFile := %YKKLayoutFileNoExt%
If (YKKCurrentLayoutFile = "") {
YKKCurrentLayoutFile = %YKKLayoutFile%
}
MsgBox, 36, %TitleDone%, %TextCurrent%`n`n%YKKCurrentLayoutFile%`n`n`n%MsgNeedReboot%
IfMsgBox Yes
Shutdown, 6
ExitApp
YKKGuiClose:
Gui, Destroy
ExitApp
About:
MsgBox, 64, %AboutItemMenuTray%, %ProjectHome%`n`n`n`n%Copyright%`n`n%License%`n%LicenseURL%`n
return