-
Notifications
You must be signed in to change notification settings - Fork 0
/
caps.ahk
83 lines (73 loc) · 1.75 KB
/
caps.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
;AutoHotKeyVersion:1.0
;功能:中、英、大小写输入状态提示
;环境:win10+搜狗输入法正式版,输入法状态切换用默认的shift键。
;作者:傲慢与偏见zxc, 837449776@qq.com
;时间:20210407
; 按下 Shift 键切换输入法
; EN-英文, CN-中文, A-Caps On
CN := chr(20013)
EN := chr(33521)
~CapsLock::
{
If GetKeyState("CapsLock","T")
ToolTip, Caps_On
Else
ToolTip, Caps_Off
SetTimer, RemoveToolTip, -1000
return
}
Shift::
{
mainAction("A", EN, CN)
return
}
; 鼠标左键按下,且为工形图标,判定为文本输入模式
~LButton::
{
mainAction("A", CN, EN)
return
}
; 按下Ctrl键查询当前状态
~Ctrl::
{
mainAction("A", CN, EN)
return
}
mainAction(p_caps, p_status1, p_status2)
{
If (A_Cursor = "IBeam")
{
If (IME_GET()=1)
{
If GetKeyState("CapsLock","T")
ToolTip, %p_caps%
Else
ToolTip, %p_status1%
}
else
{
If GetKeyState("CapsLock","T")
ToolTip, %p_caps%
Else
ToolTip, %p_status2%
}
}
SetTimer, RemoveToolTip, -1000
}
RemoveToolTip:
ToolTip
return
IME_GET(WinTitle="")
;-----------------------------------------------------------
; “获得 Input Method Editors 的状态”
;-----------------------------------------------------------
{
ifEqual WinTitle,, SetEnv,WinTitle,A
WinGet,hWnd,ID,%WinTitle%
DefaultIMEWnd := DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hWnd, Uint)
DetectSave := A_DetectHiddenWindows
DetectHiddenWindows,ON
SendMessage 0x283, 0x005,0,,ahk_id %DefaultIMEWnd%
DetectHiddenWindows,%DetectSave%
Return ErrorLevel
}