-
Notifications
You must be signed in to change notification settings - Fork 0
/
shortcutWithContext.ahk
116 lines (83 loc) · 2.9 KB
/
shortcutWithContext.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
115
116
#Requires AutoHotkey v2.0-a
; 在vscode中使用vim键位,通过esc切换到normal模式的时候,希望输入法切换到英文。
#HotIf WinActive("ahk_exe Code.exe")
!j::NumpadDown
!k::NumpadUp
~Esc:: ToEnglishWithSoug()
CapsLock:: {
Send "{Esc}"
ToEnglishWithSoug()
}
#HotIf WinActive("ahk_exe idea64.exe")
~Esc:: ToEnglishWithSoug()
CapsLock:: {
Send "{Esc}"
ToEnglishWithSoug()
}
#HotIf WinActive("ahk_exe uTools.exe")
;; 切换翻译窗口。在utool上快捷键设置的为ctrl+alt+q,然后其没有提供最小化的功能
;; 在google上,进行crtl+n/p, 切换
^!q::!Esc
^n:: Send "{Down}"
^p:: Send "{Up}"
Esc:: Send "{Esc 3}" ;
#HotIf WinActive("ahk_exe chrome.exe") ;配合地址栏,和搜索栏,以及surfingkeys。使用ctrl+n 和p 来切换下拉菜单
^n:: Send "{Down}"
^p:: Send "{Up}"
~Esc:: Send "{Esc 2}" ; 两次Esc,从地址栏回到页面选中
#HotIf
; https://www.autohotkey.com/boards/viewtopic.php?style=19&t=123198
#HotIf WinActive("ahk_class XamlExplorerHostIslandWindow")
*j:: Send("{Alt Down}{Down}")
*k:: Send "{Alt Down}{Up}"
*h:: Send "{Alt Down}{Left}"
*l:: Send "{Alt Down}{Right}"
~*Alt Up:: Send("{Enter}")
#HotIf
; #IfWinActive ahk_exe chrome.exe ; 配合地址栏,和搜索栏,以及surfingkeys。使用ctrl+n 和p 来切换下拉菜单
; ^n::yyy()
; ^p::Send , {Up}
; ~Esc::Send, {Esc 2} ; 两次Esc,从地址栏回到页面选中
; #IfWinActive ; 关闭上下文敏感
; 完全不可行。controlgetfocus无法获取chrome内的东西。
; xxx(){
; activeWindow := WinExist("A")
; ControlGetFocus, focusedControl, ahk_id %activeWindow%
; if(ErrorLevel) {
; MsgBox, Couldn't get focusedControl
; } else {
; ControlGetText, focusText, %focusedControl%
; if(ErrorLevel) {
; ControlGetText, focusText,, ahk_id %activeWindow%
; Msgbox, Focused window text: %focusText%
; } else {
; Msgbox, Focused control text: %focusText%
; }
; }
; return
; }
; 无障碍服务看似可行,实际上感觉。。。。不太行。
; #Include %A_ScriptDir%\Acc.ahk
; GetElementByName(AccObj, name) {
; if (AccObj.accName(0) = name)
; return AccObj
; for k, v in Acc_Children(AccObj)
; if IsObject(obj := GetElementByName(v, name))
; return obj
; }
; GetElementByText(AccObj, text) {
; try
; if (AccObj.accValue(0) = text)
; return AccObj
; for k, v in Acc_Children(AccObj)
; if IsObject(obj := GetElementByText(v, text))
; return obj
; }
; ; https://www.autohotkey.com/board/topic/103178-how-to-get-the-current-url-in-google-chrome/#entry637687
; ; https://stackoverflow.com/questions/66246503/how-to-detect-whether-a-text-writeable-field-is-focused
; yyy(){
; hwndChrome := WinExist("A")
; AccChrome := Acc_ObjectFromWindow(hwndChrome)
; AccAddressBar := GetElementByText(AccChrome, "地址和搜索栏")
; MsgBox % AccAddressBar.accValue(0)
; }