├── language
├── .keep
├── English.ahk
├── Traditional_Chinese.ahk
├── lang_func.ahk
└── Simplified_Chinese.ahk
├── userAHK
├── UserFunction.ahk
└── UserKeySet.ahk
├── CapsLockPlusIcon.ico
├── loadScript
├── debug.html
└── scriptDemo.js
├── .gitignore
├── lib
├── lib_mouseSpeed.ahk
├── lib_init.ahk
├── lib_winTransparent.ahk
├── lib_loadAnimation.ahk
├── lib_mathBoard.ahk
├── lib_clTab.ahk
├── lib_jsEval.ahk
├── lib_ydTrans.ahk
├── lib_winJump.ahk
├── lib_keysSet_Old.ahk
├── lib_settings.ahk
├── lib_json.ahk
├── lib_keysFunLogic.ahk
├── lib_functions.ahk
├── lib_bindWins.ahk
└── lib_keysFunction.ahk
├── README.md
└── CapsLockPlus.ahk
/language/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/language/English.ahk:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/userAHK/UserFunction.ahk:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/language/Traditional_Chinese.ahk:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CapsLockPlusIcon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PatrickShieh/CapsLockPlus/HEAD/CapsLockPlusIcon.ico
--------------------------------------------------------------------------------
/loadScript/debug.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/userAHK/UserKeySet.ahk:
--------------------------------------------------------------------------------
1 | /*
2 | 函数与函数直接别换行,好像会调用不了
3 | */
4 |
5 | ; 各种IDE的删除行
6 | userKeyFunc_IDEDeleteLine()
7 | {
8 | SendInput, ^{d}
9 | return
10 | }
11 | userKeyFunc_IDECopyCurLineUp()
12 | {
13 | SendInput, !+{up}
14 | return
15 | }
16 | userKeyFunc_IDECopyCurLineDown()
17 | {
18 | SendInput, !+{Down}
19 | return
20 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # =========================
2 | # Add myself
3 | # =========================
4 |
5 | /CapsLock+run
6 | /CapsLock icon
7 | /old_version
8 | /img
9 | /clgif
10 | /.vscode
11 | /wb/node_modules
12 | # ignore files
13 | CapsLock+hotString.ini
14 | CapsLock+winsInfo.ini
15 | CapsLock+settings.ini
16 | CapsLock+winsInfosRecorder.ini
17 | youdaoApiKey.ahk
18 | gain.md
19 |
20 | # Windows image file caches
21 | Thumbs.db
22 | ehthumbs.db
23 |
24 | # Folder config file
25 | Desktop.ini
26 |
27 | # Recycle Bin used on file shares
28 | $RECYCLE.BIN/
29 |
30 | # Windows Installer files
31 | *.cab
32 | *.msi
33 | *.msm
34 | *.msp
35 |
36 | # Windows shortcuts
37 | *.lnk
38 |
39 | # =========================
40 | # Operating System Files
41 | # =========================
42 |
43 | # OSX
44 | # =========================
45 |
46 | .DS_Store
47 | .AppleDouble
48 | .LSOverride
49 |
50 | # Thumbnails
51 | ._*
52 |
53 | # Files that might appear on external disk
54 | .Spotlight-V100
55 | .Trashes
56 |
57 | # Directories potentially created on remote AFP share
58 | .AppleDB
59 | .AppleDesktop
60 | Network Trash Folder
61 | Temporary Items
62 | .apdisk
63 | .gitattributes
64 | /CapsLockPlusSettings.ini
65 | /CapsLockPlusSettingsDemo.ini
66 | /CapsLockPlusWinsInfosRecorder.ini
67 |
--------------------------------------------------------------------------------
/lib/lib_mouseSpeed.ahk:
--------------------------------------------------------------------------------
1 | mouseSpeedInit:
2 | global mouseSpeed,OrigMouseSpeed,SPI_GETMOUSESPEED,SPI_SETMOUSESPEED
3 | SPI_GETMOUSESPEED = 0x70
4 | SPI_SETMOUSESPEED = 0x71
5 |
6 |
7 | mouseSpeed:=CLSets.Global.mouseSpeed!=""?CLSets.Global.mouseSpeed:10
8 | if(mouseSpeed<1)
9 | {
10 | mouseSpeed:=1
11 | setSettings("Global","mouseSpeed",mouseSpeed)
12 | }
13 | else if(mouseSpeed>20)
14 | {
15 | mouseSpeed:=20
16 | setSettings("Global","mouseSpeed",mouseSpeed)
17 | }
18 | return
19 |
20 | ; 软件启动时改变鼠标速度
21 | changeMouseSpeedOnStart:
22 | {
23 | DllCall("SystemParametersInfo", UInt, SPI_SETMOUSESPEED, UInt, 0, Ptr, mouseSpeed, UInt, 0)
24 | return
25 | }
26 |
27 | ; 改变鼠标速度
28 | ; changeMouseSpeed:
29 | ; {
30 | ; if(GetKeyState("LAlt", "P"))
31 | ; {
32 | ; ; 获取鼠标当前的速度以便稍后恢复:
33 | ; DllCall("SystemParametersInfo", UInt, SPI_GETMOUSESPEED, UInt, 0, UIntP, OrigMouseSpeed, UInt, 0)
34 | ; settimer, stopChangeMouseSpeed, 50
35 | ; ; 在倒数第3个参数中设置速度 (范围为 1-20):
36 | ; ; sendinput, % origmouseSpeed
37 | ; DllCall("SystemParametersInfo", UInt, SPI_SETMOUSESPEED, UInt, 0, Ptr, mouseSpeed, UInt, 0)
38 | ; settimer, changeMouseSpeed, off
39 | ; }
40 | ; ;如果Capslock松开
41 | ; if(!Capslock)
42 | ; {
43 | ; settimer, changeMouseSpeed, off
44 | ; }
45 | ; return
46 | ; }
47 |
48 | ; stopChangeMouseSpeed:
49 | ; if(!GetKeyState("LAlt", "P") || !Capslock)
50 | ; {
51 | ; settimer, stopChangeMouseSpeed, off
52 | ; ; sendinput, aaa%OrigMouseSpeed%
53 | ; DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, Ptr, OrigMouseSpeed, UInt, 0) ; 恢复原来的速度.
54 | ; if(Capslock) ;如果放开alt的时候caps还没放开,就再回去changeMouseSpeed继续监视Alt有没再次按下
55 | ; {
56 | ; settimer, changeMouseSpeed, 50
57 | ; }
58 | ; }
59 | ; return
--------------------------------------------------------------------------------
/lib/lib_init.ahk:
--------------------------------------------------------------------------------
1 | ;~ 初始化段,也就是自动运行段,所有需要自动运行的代码放这里,然后放到程序最开头
2 | SetTimer, initAll, -400 ;等个100毫秒,等待其他文件的include都完成
3 |
4 | return
5 |
6 | initAll:
7 | Suspend, On ;挂起所有热键
8 |
9 | IniRead, loadingAnimation, CapsLockPlusSettings.ini, Global, loadingAnimation, 1
10 | IniRead, language, CapsLockPlusSettings.ini, Global, language, 0
11 |
12 | if(loadingAnimation != "0")
13 | gosub, showLoading
14 |
15 | ;------------ language -----------
16 | ; language:=CLsets.global.language
17 |
18 | ; 字符串初始化,这个要第一个运行
19 | ; if(language and IsLabel("language_" . language))
20 | ; gosub, language_%language%
21 | ; else if(getSystemLanguage() == "Chinese_PRC")
22 | ; gosub, language_Simplified_Chinese
23 | ; else if(getSystemLanguage() == "Chinese_Hong_Kong" or getSystemLanguage() == "Chinese_Taiwan")
24 | ; gosub, language_Traditional_Chinese
25 | ; else
26 | ; gosub, language_English
27 | gosub, language_Simplified_Chinese
28 | ;------------ /language -----------
29 |
30 | gosub, settingsInit ;初始化设置
31 |
32 |
33 | gosub, bindWinsInit
34 |
35 | gosub, jsEval_init
36 | setTimer, youdaoApiInit, -1 ;初始化翻译api
37 | gosub, getDefaultBrowser
38 |
39 | global needInitQ:=1 ;+q初始化标志位
40 | CLq() ;初始化+q
41 |
42 | setTimer, mouseSpeedInit, -1
43 | Suspend, Off
44 |
45 | if(loadingAnimation != "0")
46 | gosub, hideLoading
47 |
48 | return
49 |
50 | getDefaultBrowser:
51 | global defaultBrowser
52 | ;获取默认浏览器图标,QWeb的listview用
53 | RegRead, defaultBrowser, HKCU, SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice, ProgId
54 | RegRead, defaultBrowser, HKLM, SOFTWARE\Classes\%defaultBrowser%\shell\open\command
55 | RegExMatch(defaultBrowser, "[a-zA-Z]:\\[\s\S]*\.exe", defaultBrowser)
56 | ;~ MsgBox, % defaultBrowser
57 | if(defaultBrowser="")
58 | defaultBrowser:="C:\Program Files (x86)\Internet Explorer\IExplore.exe"
59 | return
60 |
--------------------------------------------------------------------------------
/lib/lib_winTransparent.ahk:
--------------------------------------------------------------------------------
1 | winTransparentInit:
2 | global winTranSetting, transpWinId, allowWinTranspToggle, transp
3 |
4 | ; 窗口透明度
5 | ; transp:=CLSets.Global.mouseSpeed
6 |
7 | return
8 |
9 | winTransparent(){
10 | if(!winTranSetting){ ; 按下按下后只有第一次生效
11 | winTranSetting:=true
12 | allowWinTranspToggle:=true
13 |
14 | transpWinId:=WinExist("A")
15 |
16 | WinGet, transp, Transparent, ahk_id %transpWinId%
17 |
18 | setTimer, winTranspKeyCheck, 50
19 |
20 | setTimer, checkIfTranspToggle, -300 ; 快速短按的话反转窗口的透明度
21 | }
22 |
23 | return
24 | }
25 |
26 |
27 | checkIfTranspToggle:
28 | allowWinTranspToggle:=false
29 | return
30 |
31 | winTranspReduce:
32 | ; if(!transp)
33 | ; WinGet, transp, Transparent, ahk_id %transpWinId%
34 | if(!transp)
35 | transp:=245
36 | transp-=10
37 | if(transp<15)
38 | transp:=15
39 |
40 | WinSet, Transparent, %transp%, ahk_id %transpWinId%
41 | return
42 |
43 |
44 | winTranspAdd:
45 | ; if(!transp)
46 | ; WinGet, transp, Transparent, ahk_id %transpWinId%
47 | if(!transp or transp=255)
48 | return
49 |
50 | transp+=10
51 | if(transp>255){
52 | transp:=255
53 | WinSet, Transparent, off, ahk_id %transpWinId%
54 | WinSet, Redraw
55 | return
56 | }
57 |
58 | WinSet, Transparent, %transp%, ahk_id %transpWinId%
59 | return
60 |
61 |
62 |
63 | winTranspKeyCheck:
64 | if(!GetKeyState("f4", "P") || !Capslock){
65 | setTimer, checkIfTranspToggle, off ; 关闭短按切换透明度
66 | setTimer, winTranspKeyCheck, off
67 |
68 | if(allowWinTranspToggle){
69 |
70 | ; WinGet, transp, Transparent, ahk_id %transpWinId%
71 | if(transp){
72 | WinSet, Transparent, off, ahk_id %transpWinId%
73 | WinSet, Redraw
74 | }
75 | else
76 | WinSet, Transparent, 170, ahk_id %transpWinId%
77 | ; msgbox, 0
78 | }
79 | ; msgbox,1
80 | winTranSetting:=false
81 | ; transp:=""
82 | }
83 | return
84 |
85 | #if winTranSetting
86 |
87 | WheelUp::
88 | ; send, 1
89 | gosub, winTranspAdd
90 | return
91 |
92 | WheelDown::
93 | ; send, 2
94 | gosub, winTranspReduce
95 |
96 | #if
--------------------------------------------------------------------------------
/lib/lib_loadAnimation.ahk:
--------------------------------------------------------------------------------
1 | showLoading:
2 | ;~ global
3 | ;~ LoadingChar:=["—","/","|","\"]
4 | ;~ LoadingChar:=["1","2","3","4","5","6","7","8"]
5 | LoadingChar:=[ "_('<------"
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 | ; LoadingChar:=[ "=---------"
38 | ; ,"-=--------"
39 | ; ,"--=-------"
40 | ; ,"---=------"
41 | ; ,"----=-----"
42 | ; ,"-----=----"
43 | ; ,"------=---"
44 | ; ,"-------=--"
45 | ; ,"--------=-"
46 | ; ,"---------="
47 | ; ,"--------=-"
48 | ; ,"-------=--"
49 | ; ,"------=---"
50 | ; ,"-----=----"
51 | ; ,"----=-----"
52 | ; ,"---=------"
53 | ; ,"--=-------"
54 | ; ,"-=--------"]
55 | Gui, LoadingGui:new, HwndLoadingGuiHwnd -Caption +AlwaysOnTop +Owner
56 | Gui, Font, S12 C0x555555, Lucida Console ;后备字体
57 | Gui, Font, S12 C0x555555, Fixedsys ;后备字体
58 | Gui, Font, S12 C0x555555, Courier New ;后备字体
59 | Gui, Font, S12 C0x555555, Source Code Pro ;后备字体
60 | Gui, Font, S12 C0x555555, Consolas
61 | Gui, Add, Text, HwndLoadingTextHwnd H20 W100 Center,% LoadingChar[1]
62 | Gui, Color, ffffff, ffffff
63 | Gui, LoadingGui:Show, Center NA
64 | ;~ WinSet, TransColor, ffffff, ahk_id %LoadingGuiHwnd%
65 | WinSet, Transparent, 230, ahk_id %LoadingGuiHwnd%
66 | charIndex:=1
67 | loadingCharMaxIndex:=LoadingChar._MaxIndex()
68 | SetTimer, changeLoadingChar, 250, 777 ;优先级777
69 | return
70 |
71 |
72 | hideLoading:
73 | SetTimer, changeLoadingChar, Off
74 | Gui, LoadingGui:Destroy
75 | settimer, changeMouseSpeedOnStart, 50 ;暂时修改鼠标速度
76 | ReadKeysFile() ; 加载本地热键配置
77 | MonitorProgressChange() ; 启动窗口监听
78 | return
79 |
80 |
81 | changeLoadingChar:
82 | charIndex:=Mod(charIndex, loadingCharMaxIndex)+1
83 | ControlSetText, , % LoadingChar[charIndex], ahk_id %LoadingTextHwnd%
84 | return
85 |
86 |
87 |
--------------------------------------------------------------------------------
/lib/lib_mathBoard.ahk:
--------------------------------------------------------------------------------
1 | /*
2 | 计算板
3 | */
4 | keyFunc_mathBoard(){
5 | ClipboardOld:=ClipboardAll
6 | Clipboard:=""
7 | SendInput, ^{c} ;
8 | ClipWait, 0.1
9 | if(!ErrorLevel)
10 | {
11 | result:=clCalculate(Clipboard,res, , 1)
12 | if(res="?")
13 | result:=""
14 | }
15 | IfWinExist, Math Board
16 | {
17 | ControlSetText, , %result%, ahk_id %CalcEditHwnd%
18 | WinActivate, ahk_id %CalcGui%
19 |
20 | sendinput, {end}
21 | }
22 | else
23 | {
24 | Gui, mathBoard:new, hwndCalcGui, Math Board
25 | Gui mathBoard:+LabelmathBoard_
26 | Gui, +AlwaysOnTop -Border +Caption -Disabled -LastFound -MaximizeBox -OwnDialogs +Resize +SysMenu -Theme -ToolWindow
27 | Gui, Font, s12 w400, consolas
28 | ; Gui, Font, s12 w400, Source Code Pro
29 | Gui, Add, Edit, x-2 y0 h403 w604 -Wrap hwndCalcEditHwnd, %result%
30 | Gui, Show, h400 w600
31 | sendinput, {end}
32 | }
33 |
34 | Sleep, 200
35 |
36 | Clipboard:=ClipboardOld
37 | CapsLock2:=""
38 | return
39 | }
40 | mathBoard_Size:
41 | WinGetPos, , ,mathBoard_W , mathBoard_H, ahk_id %CalcGui%
42 | ; msgbox, % mathBoard_W . "#" . mathBoard_H
43 | edit_w:=mathBoard_W-12
44 | edit_h:=mathBoard_H-37
45 | GuiControl, Move, %CalcEditHwnd%, w%edit_w% h%edit_h%
46 | return
47 |
48 | mathBoard_Close:
49 | mathBoard_Escape:
50 | Gui, Cancel
51 | return
52 |
53 | ;-----------------------in calculator GUI start-------------
54 | #if WinActive("Math Board") && GetKeyState("CapsLock","T")
55 | u::sendinput, {7}
56 | i::sendinput, {8}
57 | o::sendinput, {9}
58 | j::sendinput, {4}
59 | k::sendinput, {5}
60 | l::sendinput, {6}
61 | m::sendinput, {1}
62 | ,::sendinput, {2}
63 | .::sendinput, {3}
64 | space::sendinput, {0}
65 | RAlt::sendinput, {U+002e}
66 | `;::sendinput, {U+002b}
67 | '::sendinput, {U+002d}
68 | p::sendinput, {U+002a}
69 | /::
70 | [::
71 | sendinput, {U+002f}
72 | return
73 |
74 | #IF WinActive("Math Board")
75 | NumpadEnter::
76 | enter::
77 | ClipboardOld:=ClipboardAll
78 | Clipboard:=""
79 |
80 | SendInput, +{Home}
81 | Sleep, 10
82 | SendInput, ^{c}
83 | ClipWait, 0.1
84 | if(!ErrorLevel)
85 | {
86 | if(RegExMatch(Clipboard,"(?<=:\=).*;$",calResult))
87 | {
88 | clCalculate(Clipboard,calResult,0,1)
89 | SendInput, {End}{Enter}
90 | }
91 | else if(RegExMatch(Clipboard,"(?<=\=)[\deE\+\-\.a-fA-f]+$",calResult))
92 | {
93 | sendinput, {End}{Enter}
94 | }
95 | else
96 | {
97 | Clipboard := clCalculate(Clipboard,calResult,0,1)
98 | SendInput, ^{v}
99 | Sleep, 200
100 | }
101 | }
102 | ; }
103 |
104 |
105 | Clipboard:=ClipboardOld
106 | return
107 |
108 | ^NumpadEnter::
109 | ^enter::
110 | sendinput, {enter}
111 | return
112 |
113 | +NumpadEnter::
114 | +enter::
115 | ClipboardOld:=ClipboardAll
116 | Clipboard:=""
117 | SendInput, +{Home}
118 | Sleep, 10
119 | SendInput, ^{c}
120 | ClipWait, 0.1
121 | if(!ErrorLevel)
122 | {
123 | if(RegExMatch(Clipboard,"(?<=\=)(?<|&\s%\.]*$"
13 | ; this RegEx is for jsEval
14 | strRegEx:="\S*$"
15 | foundPos:=RegExMatch(inputStr, "(``)(.*)", calStr)
16 | if(!foundPos)
17 | foundPos:=RegExMatch(inputStr, strRegEx, calStr)
18 | else
19 | calStr:=LTrim(calStr, "``")
20 |
21 | if(foundPos){
22 | inputStr:=SubStr(inputStr,1,foundPos-1)
23 |
24 | }else{
25 | return inputStr
26 | }
27 |
28 | }else{
29 | calStr:=inputStr
30 | inputStr:=""
31 | }
32 |
33 | eqSignPos:=RegExMatch(calStr, " ?= ?$", eqSign)
34 | if(eqSignPos)
35 | StringMid, calStr2, calStr, % eqSignPos-1, , L
36 | else
37 | calStr2:=calStr
38 |
39 |
40 |
41 | ; 如果在计算板,则修复js的浮点计算错误
42 | ; e.g. 0.1+0.2=0.30000000000000004
43 | ; 函数体在 lib/lib_jsEval.ahk
44 |
45 | if(isScratch)
46 | result:=eval("fixFloatCalcRudely(" . calStr2 . ")")
47 | else if(CLSets.global.javascriptOriginalReturn) ; 如果.ini设置了javascriptOriginalReturn=1,则返回原js结果
48 | result:=eval(calStr2)
49 | else
50 | result:=eval("fixFloatCalcRudely(" . calStr2 . ")")
51 |
52 |
53 | if(result="")
54 | result:="?"
55 |
56 | if(isScratch){
57 | if(eqSignPos){
58 | inputStr .= calStr2 . eqSign . result
59 | }else{
60 | inputStr .= calStr2 . "=" . result
61 | }
62 | }else if(eqSignPos){
63 | inputStr .= calStr2 . eqSign . result
64 | }else{
65 | inputStr .= result
66 | }
67 |
68 | return inputStr
69 | }
70 |
71 | tabAction()
72 | {
73 | ClipboardOld:=ClipboardAll
74 | selText:=getSelText()
75 |
76 | if(selText)
77 | {
78 | ; 让caps+tab支持这样:
79 | ; o.type = obj.type||'';
80 | ; ->sort()
81 | ; 选中以上两行再caps+tab,等价于:
82 | ;sort("o.type = obj.type||'';")
83 | selText:=strSelected2Script(selText)
84 |
85 | Clipboard := clCalculate(selText,calResult)
86 | }
87 | else
88 | {
89 | Clipboard:=""
90 | SendInput, +{Home}
91 | sleep, 10 ;make sure text is selecting
92 | SendInput, ^{c}
93 | ClipWait, 0.1
94 | if(!ErrorLevel)
95 | {
96 | if(!CLhotString())
97 | {
98 | ; text2Script:=strSelected2Script(Clipboard)
99 | ; if(text2Script != Clipboard)
100 | ; Clipboard := clCalculate(text2Script,calResult)
101 | ; else
102 | Clipboard := clCalculate(Clipboard,calResult,1)
103 | }
104 | }
105 | }
106 | SendInput, ^{v}
107 | Sleep, 200
108 | Clipboard:=ClipboardOld
109 | return calResult
110 | }
111 |
112 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## 前言 ##
3 | CapsLockPlus是根据CapsLock+[(原作者版本)](https://github.com/wo52616111/capslock-plus)修改的,因为原版本不再更新了,并且功能不能满足本人的需求,所以对其进行改动。本人是个键盘党,还是个程序猿,非常不喜欢敲代码敲得嗨时,还要去碰鼠标、右手移动一段距离去操作方向键,删除键等等。
4 | 噢,对了,还很讨厌Ctrl键,因为使用Ctrl组合键时,左手要离开键盘一段距离,神烦~~。试想下,双手不用离开字母区,是不是很爽,嘿嘿~~
5 |
6 | >CapsLockPlus:[下载地址](https://github.com/PatrickShieh/CapsLockPlus)
7 |
8 | ## 概述 ##
9 | CapslockPlus是一个加强 Capslock 键的功能,以提高效率的工具。让你拥有更多的组合键,例如:
10 |
11 | - CapsLock + 全键
12 | - CapsLock + Alt + 全键
13 | - CapsLock + Shift + 全键
14 | - CapsLock + Ctrl + 全键
15 |
16 | ## 与原版区别 ##
17 | >CapsLock按键省略为Caps,Key为各种按键,下面对比的是大功能模块,后面再详细介绍各种小功能,QBar,QWeb,QSearch不太喜欢,所以没加上,但是原来的代码还在,想要的话自己改下。
18 |
19 | 功能| CapsLock+(原版) | CapsLockPlus(新版)
20 | :-: | :-: | :-:
21 | Caps + Key | ✔ | ✔
22 | Caps + Alt + Key | ✔ | ✔
23 | Caps + Shift + Key | ✘ | ✔
24 | Caps + Ctrl + Key | ✘ | ✔
25 | TabScript | TabScript | TabSnippet
26 | WinBind | ✔ | ✔
27 | QBar | ✔ | ✘
28 | TransplatePanel | ✔ | ✔
29 | DAAS | ✘ | ✔
30 |
31 |
32 |
33 | ## 按键说明 ##
34 | #### 1.Caps + Key ####
35 | >以下省略了CapsLock键,默认是要加上的,灰色表示未设置功能键,可自行设置
36 | >
37 | 
38 |
39 | CapsLock + 鼠标
40 |
41 | 按键| 功能说明
42 | :-:| :-:
43 | 鼠标左键|✘
44 | 鼠标中键|✘
45 | 鼠标右键|✘
46 | 鼠标滚轮向前|音量加
47 | 鼠标滚轮向后|音量减
48 |
49 | #### 2.Caps + Alt + Key
50 | >以下省略了CapsLock键,默认是要加上的,灰色表示未设置功能键,可自行设置
51 | >
52 | 
53 |
54 | CapsLock + Alt + 鼠标
55 |
56 | 按键| 功能说明
57 | :-:| :-:
58 | 鼠标左键|双显示器有效,将当前软件移动到另外显示器
59 | 鼠标中键|记录当前鼠标灵敏度(Dpi)
60 | 鼠标右键|✘
61 | 鼠标滚轮向前|鼠标灵敏度(Dpi)增加
62 | 鼠标滚轮向后|鼠标灵敏度(Dpi)减少
63 |
64 | #### 3.Caps + Shift + Key
65 | >以下省略了CapsLock键,默认是要加上的,灰色表示未设置功能键,可自行设置
66 | >
67 | 
68 |
69 | CapsLock + Shift + 鼠标
70 |
71 | 按键| 功能说明
72 | :-:| :-:
73 | 鼠标左键|显示/关闭 AutohotKey窗口信息
74 | 鼠标中键|✘
75 | 鼠标右键|✘
76 | 鼠标滚轮向前|✘
77 | 鼠标滚轮向后|✘
78 |
79 | #### 4.Caps + Ctrl + Key
80 | >以下省略了CapsLock键,默认是要加上的,灰色表示未设置功能键,可自行设置
81 | >
82 | 
83 |
84 | CapsLock + Ctrl + 鼠标
85 |
86 | 按键| 功能说明
87 | :-:| :-:
88 | 鼠标左键|✘
89 | 鼠标中键|记录当前鼠标灵敏度(Dpi)
90 | 鼠标右键|✘
91 | 鼠标滚轮向前|✘
92 | 鼠标滚轮向后|✘
93 |
94 | ## TabSnippet 热字符串 ##
95 | #### 按键
96 | CapsLock + Tab
97 |
98 | #### 说明
99 | >举个例子,在CapsLockPlusSettings.ini文件的[TabHotString]段下有这么一条设置:email=123456789@abc.com,那么在任意能输入文字的地方输入:asdfghjklemail,按下Capslock+Tab,就会变成asdfghjkl123456789@abc.com,有点像IDE的代码段功能
100 |
101 | ## WinBind ##
102 |
103 | #### 如何绑定
104 | 绑定窗口:CapsLock + Alt + (`或1~9)
105 |
106 | >关于绑定:原版有3种模式,此版本有4模式,多了1种,下面做介绍:
107 |
108 | - 模式1:单击,绑定当前激活的窗口到相应按键;
109 | - 模式2:双击,追加绑定当前激活的窗口到相应按键;
110 | - 模式3:三击,绑定当前激活的窗口所属程序所拥有的所有窗口到相应按键;
111 | - 模式4:四击,绑定当前激活的窗口,与相应按键并列窗口,即同时打开同时隐藏;
112 |
113 |
114 | #### 如何激活
115 | 激活窗口:CapsLock + (`或1~9)
116 | >激活/最小化绑定在该按键的窗口
117 |
118 | #### 说明
119 | 关于绑定
120 | >1.模式1和模式3会覆盖当前按键上已有的绑定窗口;
121 | >2.模式2绑定在按键现有模式是模式1或模式2时会追加窗口,是模式3时不追加,而会覆盖原绑定设置,绑定当前激活窗口(与模式1效果一样);
122 | >3.模式2操作示例:
123 | > a.窗口A处于最前的情况下,依次按下CapslockAlt不放,再按两次1;
124 | > b.激活窗口B,同样操作;
125 | > c.激活窗口C,同样操作;
126 | > d.按下Capslock不放,(多次)按下1来在A,B,C三个窗口之间实现类似Alt+Tab的窗口切换。
127 | >4.模式3只要在需要绑定的程序的其中一个窗口做类似模式2的操作(需要三击)即可绑定该程序所有窗口(包括绑定操作过后才打开的)。
128 | >5.模式2原有的绑定窗口被关闭至只剩下1个窗口时,将自动转换成模式1绑定(可以激活 / 最小化窗口)
129 | >6.模式4只有在模式1,2和4情况下才有效。
130 |
131 | 关于窗口激活/最小化
132 | >1.模式1下,在原窗口不存在时,激活动作会自动绑定窗口所属程序的另一个窗口;
133 | >2.模式1和模式3下,在原绑定窗口所属程序未启动时,激活动作将启动该程序;
134 | >3.模式2和模式3下,多窗口中,最近使用本功能激活的窗口在下次使用本功能时会优先激活;
135 | >4.绑定的窗口只有一个时,模式1和模式3会激活 / 最小化该窗口,模式2会自动转换成模式1;
136 | >5.模式4,窗口A、B、C和D绑定按键1,当激活按键1时,窗口A、B、C和D同时激活;
137 |
138 | ## DAAS ##
139 | 生成应用快捷键配置文件 CapsLock + F9
140 | #### 说明
141 | >DAAS:动态适配应用快捷键(Dynamic Adaptation Application Shortcuts),假如说对应用A配置快捷键Caps+A,对应用B配置快捷键Caps+A,当处于应用A下则执行应用A的快捷键,处于应用B则执行应用B的快捷键,当既不处于应用A,也不处于应用B的情况下,则执行默认的快捷键.
142 |
143 | #### 配置软件快捷键
144 | >a.打开应用A,在应用A下执行CapsLock+F9,成功时会弹窗提示配置成功。
145 | >b.到根目录下找到AllKeys文件夹,这里存放所有应用的配置文件,此时找到对应的配置文件,例如A.ini。
146 | >c.[FileInfos]下的内容切勿修改,在[Keys]下添加相应的快捷键配置即可,例:
147 | > 找到同级目录下的userAHK文件夹,可在UserKeySet里设置功能函数,如函数名userKeyFunc_IDEDeleteLine,然后回到你的应用配置文件里,在[Keys]下添加,caps_d=userKeyFunc_IDEDeleteLine保存即可,Caps+F11重启。
148 |
149 |
150 | ## 如何自行设置全局的按键
151 | >在CapsLockPlusSettings.ini里[Keys]设置,请对照 CapsLockPlussettingsDemo.ini 来配置相关设置,里面说的很详细
--------------------------------------------------------------------------------
/language/lang_func.ahk:
--------------------------------------------------------------------------------
1 | getSystemLanguage(){
2 | languageCode_0436 = Afrikaans
3 | languageCode_041c = Albanian
4 | languageCode_0401 = Arabic_Saudi_Arabia
5 | languageCode_0801 = Arabic_Iraq
6 | languageCode_0c01 = Arabic_Egypt
7 | languageCode_0401 = Arabic_Saudi_Arabia
8 | languageCode_0801 = Arabic_Iraq
9 | languageCode_0c01 = Arabic_Egypt
10 | languageCode_1001 = Arabic_Libya
11 | languageCode_1401 = Arabic_Algeria
12 | languageCode_1801 = Arabic_Morocco
13 | languageCode_1c01 = Arabic_Tunisia
14 | languageCode_2001 = Arabic_Oman
15 | languageCode_2401 = Arabic_Yemen
16 | languageCode_2801 = Arabic_Syria
17 | languageCode_2c01 = Arabic_Jordan
18 | languageCode_3001 = Arabic_Lebanon
19 | languageCode_3401 = Arabic_Kuwait
20 | languageCode_3801 = Arabic_UAE
21 | languageCode_3c01 = Arabic_Bahrain
22 | languageCode_4001 = Arabic_Qatar
23 | languageCode_042b = Armenian
24 | languageCode_042c = Azeri_Latin
25 | languageCode_082c = Azeri_Cyrillic
26 | languageCode_042d = Basque
27 | languageCode_0423 = Belarusian
28 | languageCode_0402 = Bulgarian
29 | languageCode_0403 = Catalan
30 | languageCode_0404 = Chinese_Taiwan
31 | languageCode_0804 = Chinese_PRC
32 | languageCode_0c04 = Chinese_Hong_Kong
33 | languageCode_1004 = Chinese_Singapore
34 | languageCode_1404 = Chinese_Macau
35 | languageCode_041a = Croatian
36 | languageCode_0405 = Czech
37 | languageCode_0406 = Danish
38 | languageCode_0413 = Dutch_Standard
39 | languageCode_0813 = Dutch_Belgian
40 | languageCode_0409 = English_United_States
41 | languageCode_0809 = English_United_Kingdom
42 | languageCode_0c09 = English_Australian
43 | languageCode_1009 = English_Canadian
44 | languageCode_1409 = English_New_Zealand
45 | languageCode_1809 = English_Irish
46 | languageCode_1c09 = English_South_Africa
47 | languageCode_2009 = English_Jamaica
48 | languageCode_2409 = English_Caribbean
49 | languageCode_2809 = English_Belize
50 | languageCode_2c09 = English_Trinidad
51 | languageCode_3009 = English_Zimbabwe
52 | languageCode_3409 = English_Philippines
53 | languageCode_0425 = Estonian
54 | languageCode_0438 = Faeroese
55 | languageCode_0429 = Farsi
56 | languageCode_040b = Finnish
57 | languageCode_040c = French_Standard
58 | languageCode_080c = French_Belgian
59 | languageCode_0c0c = French_Canadian
60 | languageCode_100c = French_Swiss
61 | languageCode_140c = French_Luxembourg
62 | languageCode_180c = French_Monaco
63 | languageCode_0437 = Georgian
64 | languageCode_0407 = German_Standard
65 | languageCode_0807 = German_Swiss
66 | languageCode_0c07 = German_Austrian
67 | languageCode_1007 = German_Luxembourg
68 | languageCode_1407 = German_Liechtenstein
69 | languageCode_0408 = Greek
70 | languageCode_040d = Hebrew
71 | languageCode_0439 = Hindi
72 | languageCode_040e = Hungarian
73 | languageCode_040f = Icelandic
74 | languageCode_0421 = Indonesian
75 | languageCode_0410 = Italian_Standard
76 | languageCode_0810 = Italian_Swiss
77 | languageCode_0411 = Japanese
78 | languageCode_043f = Kazakh
79 | languageCode_0457 = Konkani
80 | languageCode_0412 = Korean
81 | languageCode_0426 = Latvian
82 | languageCode_0427 = Lithuanian
83 | languageCode_042f = Macedonian
84 | languageCode_043e = Malay_Malaysia
85 | languageCode_083e = Malay_Brunei_Darussalam
86 | languageCode_044e = Marathi
87 | languageCode_0414 = Norwegian_Bokmal
88 | languageCode_0814 = Norwegian_Nynorsk
89 | languageCode_0415 = Polish
90 | languageCode_0416 = Portuguese_Brazilian
91 | languageCode_0816 = Portuguese_Standard
92 | languageCode_0418 = Romanian
93 | languageCode_0419 = Russian
94 | languageCode_044f = Sanskrit
95 | languageCode_081a = Serbian_Latin
96 | languageCode_0c1a = Serbian_Cyrillic
97 | languageCode_041b = Slovak
98 | languageCode_0424 = Slovenian
99 | languageCode_040a = Spanish_Traditional_Sort
100 | languageCode_080a = Spanish_Mexican
101 | languageCode_0c0a = Spanish_Modern_Sort
102 | languageCode_100a = Spanish_Guatemala
103 | languageCode_140a = Spanish_Costa_Rica
104 | languageCode_180a = Spanish_Panama
105 | languageCode_1c0a = Spanish_Dominican_Republic
106 | languageCode_200a = Spanish_Venezuela
107 | languageCode_240a = Spanish_Colombia
108 | languageCode_280a = Spanish_Peru
109 | languageCode_2c0a = Spanish_Argentina
110 | languageCode_300a = Spanish_Ecuador
111 | languageCode_340a = Spanish_Chile
112 | languageCode_380a = Spanish_Uruguay
113 | languageCode_3c0a = Spanish_Paraguay
114 | languageCode_400a = Spanish_Bolivia
115 | languageCode_440a = Spanish_El_Salvador
116 | languageCode_480a = Spanish_Honduras
117 | languageCode_4c0a = Spanish_Nicaragua
118 | languageCode_500a = Spanish_Puerto_Rico
119 | languageCode_0441 = Swahili
120 | languageCode_041d = Swedish
121 | languageCode_081d = Swedish_Finland
122 | languageCode_0449 = Tamil
123 | languageCode_0444 = Tatar
124 | languageCode_041e = Thai
125 | languageCode_041f = Turkish
126 | languageCode_0422 = Ukrainian
127 | languageCode_0420 = Urdu
128 | languageCode_0443 = Uzbek_Latin
129 | languageCode_0843 = Uzbek_Cyrillic
130 | languageCode_042a = Vietnamese
131 |
132 | return languageCode_%A_Language%
133 | }
--------------------------------------------------------------------------------
/loadScript/scriptDemo.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 方差
3 | * @demo variance(1,2,3,4,6,6)
4 | * @param {number} x1~xn n个数据
5 | * @return {number} 返回 n个数据的方差
6 | */
7 | function variance(){
8 | var n=arguments.length,s=0,ave=average([].slice.apply(arguments));
9 | for(var i=0;i "
95 | ; 4. 按下 Enter 键,确认记录
96 |
97 | [TabHotString]
98 | clp=capslockplus
99 |
100 |
101 | ;----------------------------------------------------------------;
102 | ; ##+T翻译设置
103 |
104 | [TTranslate]
105 | ;有道api接口
106 | ;翻译功能通过调用有道的api实现。
107 | ;接口的请求频率限制为每小时1000次,超过限制会被封禁。也就是说所有使用CapsLockPlus翻译的人一小时内翻译的次数加起来不能超过1000次。
108 | ;有道api网址:http://fanyi.youdao.com/openapi
109 |
110 | ;接口类型,0为免费版,1为收费版。通过上面的网址申请的是免费版的,收费版是需要 email 他们来申请的。
111 | apiType=0
112 |
113 | ;免费版的有道 api key 的 keyfrom 参数,申请 api 时要求填写的。收费版的不需要填写。
114 | keyFrom=xxx
115 |
116 | ;有道api的key,如果自己申请到key,可以填入,这样就不用和其他人共用api接口,留空则使用自带的key,所有人共用
117 | ;注意如果是免费版的key,apiType也要相应设置为0,收费版的填写1
118 | apiKey=0123456789
119 |
120 | ;----------------------------------------------------------------;
121 | ; ##按键功能设置
122 |
123 | ; - 可设置的按键组合有:
124 | ; Capslock + F1~F12
125 | ; Capslock + 0~9
126 | ; Capslock + a~z
127 | ; Capslock + `-=[]\;',./
128 | ; Capslock + Backspace, Tab, Enter, Space, RAlt
129 | ; Capslock + LALt + F1~F12
130 | ; Capslock + LALt + 0~9
131 | ; Capslock + LALt + a~z
132 | ; Capslock + LALt + `-=[]\;',./
133 | ; Capslock + LALt + Backspace, Tab, Enter, Space, RAlt
134 |
135 | ; - 以下设置键名是按键组合名,键值是对应功能,所有支持的功能都在下面
136 |
137 | [Keys]
138 |
139 | ;CapsLockPlusA -> 光标向左移动一个单词
140 | ;keyFunc_moveWordLeft函数名可在UserKeySet里设置,再在这里调用
141 | caps_a=keyFunc_moveWordLeft
142 |
143 |
144 |
145 | )
146 | global lang_winsInfosRecorderIniInit:=""
147 | lang_winsInfosRecorderIniInit=
148 | (
149 | ;------------ Encoding: UTF-16 ------------
150 | ;我负责记录CapsLockPlus``和1~8绑定的窗口信息,不要手动修改我,无视我就行了,麻烦帮我点下右上角的"X",谢谢。
151 | ;我要工作了,麻烦点下右上角的"X"。
152 | ;我不想再说第三遍了。
153 |
154 | [0]
155 | bindType=
156 | class_0=
157 | exe_0=
158 | id_0=
159 | [1]
160 | bindType=
161 | class_0=
162 | exe_0=
163 | id_0=
164 | [2]
165 | bindType=
166 | class_0=
167 | exe_0=
168 | id_0=
169 | [3]
170 | bindType=
171 | class_0=
172 | exe_0=
173 | id_0=
174 | [4]
175 | bindType=
176 | class_0=
177 | exe_0=
178 | id_0=
179 | [5]
180 | bindType=
181 | class_0=
182 | exe_0=
183 | id_0=
184 | [6]
185 | bindType=
186 | class_0=
187 | exe_0=
188 | id_0=
189 | [7]
190 | bindType=
191 | class_0=
192 | exe_0=
193 | id_0=
194 | [8]
195 | bindType=
196 | class_0=
197 | exe_0=
198 | id_0=
199 | )
200 |
201 | ; keysFunction.ahk
202 | global lang_kf_getDebugText:=""
203 | lang_kf_getDebugText=
204 | (
205 | 供 TabScript 调试用字符串
206 | 点击"OK"将它复制到剪贴板
207 | )
208 | return
209 |
--------------------------------------------------------------------------------
/lib/lib_jsEval.ahk:
--------------------------------------------------------------------------------
1 | jsEval_init:
2 | ;comObjError(0) ;关闭 com 对象的报错
3 | gosub, scriptDemoInit
4 | ; 使用ie11引擎实现计算功能,经测试,如果自带引擎低于11,会自动使用自带的最新引擎
5 | FixIE(11)
6 |
7 | obj:=ComObjCreate("HTMLfile")
8 |
9 | ;---load javascript---
10 |
11 | ;build-in script
12 | buildInScript=
13 | ( LTrim
14 |
37 | )
38 | obj.write(buildInScript)
39 | buildInScript:=""
40 |
41 | ;custom script
42 | ifexist, loadScript
43 | {
44 | jsfiles:=StrSplit(CLSets.Global.loadScript, ",", " `t")
45 | loop, % jsfiles.MaxIndex()
46 | {
47 | obj.write("")
53 | }
54 | }
55 | return
56 |
57 |
58 | eval(exp)
59 | {
60 | global obj
61 | exp:=escapeString(exp)
62 |
63 | obj.write("")
64 | return inStr(cabbage:=obj.body.innerText, "body") ? "ERROR" : cabbage
65 | }
66 |
67 | escapeString(string){
68 | ;escape http://www.w3school.com.cn/js/js_special_characters.asp
69 | string:=regExReplace(string, "('|""|&|\\|\\n|\\r|\\t|\\b|\\f)", "\$1")
70 |
71 | ;replace all newline character to '\n'
72 | string:=regExReplace(string, "\R", "\n")
73 | return string
74 | }
75 |
76 |
77 | strSelected2Script(selText){
78 | ; 允许这样使用caps+tab:
79 | ; o.type = obj.type||'';
80 | ; ->sort()
81 | ; 等价于:
82 | ;sort("o.type = obj.type||'';")
83 | ; funcArr:={}
84 |
85 | ; regex:="(?:((?(3)\s*|\R*)->\s*([\w.]*(\((?>'[^'\\]*(?:\\.[^'\\]*)*'|""[^""\\]*(?:\\.[^""\\]*)*""|[^""'()]++|(?3))*\)))))+\s*\z"
86 | regex:="\R[ \t]*?\..+\(.*\)\s*$"
87 |
88 | matchFuncPos:=RegExMatch(selText, regex, funcMatch)
89 |
90 | if(matchFuncPos)
91 | {
92 | selText := SubStr(selText,1,matchFuncPos)
93 |
94 | selText := escapeString(selText)
95 |
96 | selText := "'" . selText . "'" . RegExReplace(funcMatch, "(^\s*)|(\s*$)")
97 | ; regex:="(\s*->\s*([\w.]+\((?>'[^'\\]*(?:\\.[^'\\]*)*'|""[^""\\]*(?:\\.[^""\\]*)*""|[^""'()]++|(?1))*\)))$"
98 | ; loop
99 | ; {
100 |
101 | ; sliceFuncPos:=RegExMatch(funcMatch, regex, sliceFuncMatch)
102 | ; if(sliceFuncPos)
103 | ; {
104 | ; funcArr.Insert(sliceFuncMatch2)
105 | ; funcMatch := SubStr(funcMatch,1,sliceFuncPos-1)
106 | ; }
107 | ; else
108 | ; break
109 | ; }
110 |
111 | }
112 |
113 | ; if(funcArr.MaxIndex())
114 | ; {
115 | ; ;just the innermost need escape char and quotes
116 | ; selText := escapeString(selText)
117 | ; funcNow := funcArr.Remove()
118 | ; ; msgbox, % "funcNow" . funcNow
119 | ; if(RegExMatch(funcNow, "\(\S+\)"))
120 | ; selText := RegExReplace(funcNow, "\(", "('" . selText . "',")
121 | ; else
122 | ; selText := RegExReplace(funcNow, "\(", "('" . selText . "'")
123 | ; loop, % funcArr.MaxIndex()
124 | ; {
125 | ; funcNow := funcArr.Remove()
126 | ; if(RegExMatch(funcNow, "\(\S+\)"))
127 | ; selText := RegExReplace(funcNow, "\(", "(" . selText . ",")
128 | ; else
129 | ; selText := RegExReplace(funcNow, "\(", "(" . selText)
130 | ; msgbox, % selText
131 | ; }
132 | ; }
133 | ; msgbox, % selText
134 | return selText
135 | }
136 |
137 | FixIE(Version=0, ExeName="")
138 | {
139 | static Key := "Software\Microsoft\Internet Explorer"
140 | . "\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"
141 | , Versions := {7:7000, 8:8888, 9:9999, 10:10001, 11:11001}
142 |
143 | if Versions.HasKey(Version)
144 | Version := Versions[Version]
145 |
146 |
147 | if !ExeName
148 | {
149 | if A_IsCompiled
150 | ExeName := A_ScriptName
151 | else
152 | SplitPath, A_AhkPath, ExeName
153 | }
154 |
155 | RegRead, PreviousValue, HKCU, %Key%, %ExeName%
156 | ; msgbox, % PreviousValue . "#" . Version
157 | if (Version = "")
158 | RegDelete, HKCU, %Key%, %ExeName%
159 | else if(PreviousValue != Version)
160 | RegWrite, REG_DWORD, HKCU, %Key%, %ExeName%, %Version%
161 |
162 | ; msgbox, % Version
163 | return PreviousValue
164 | }
165 |
166 |
167 | scriptDemoInit:
168 | ;init scriptDemo
169 | if(CLSets.Global.loadScript)
170 | {
171 | IfNotExist, loadScript
172 | {
173 | FileCreateDir, loadScript
174 | }
175 | IfNotExist, loadScript\scriptDemo.js
176 | {
177 | ; FileAppend, %scriptDemoJS%, loadScript\scriptDemo.js, UTF-8-RAW
178 | FileInstall, loadScript\scriptDemo.js, loadScript\scriptDemo.js
179 | }
180 | else
181 | {
182 | FileGetTime, setDemoModifyTime, loadScript\scriptDemo.js
183 | FileGetTime, thisScriptModifyTime, %A_ScriptName%
184 |
185 | thisScriptModifyTime -= setDemoModifyTime, S
186 | if(thisScriptModifyTime > 0) ;如果主程序文件比较新,那就是更新过,那就覆盖一遍
187 | {
188 | ; FileDelete, loadScript\scriptDemo.js
189 | ; FileAppend, %scriptDemoJS%, loadScript\scriptDemo.js, UTF-8-RAW
190 | FileInstall, loadScript\scriptDemo.js, loadScript\scriptDemo.js, 1
191 | }
192 | }
193 | IfNotExist, loadScript\debug.html
194 | {
195 | ; FileAppend, %debugHTML%, loadScript\debug.html, UTF-8-RAW
196 | FileInstall, loadScript\debug.html, loadScript\debug.html
197 | }
198 | }
199 | return
--------------------------------------------------------------------------------
/lib/lib_ydTrans.ahk:
--------------------------------------------------------------------------------
1 | /*
2 | 有道翻译
3 | */
4 |
5 | #Include lib_json.ahk ;引入json解析文件
6 |
7 | global TransEdit,transEditHwnd,transGuiHwnd, NativeString
8 |
9 | youdaoApiInit:
10 | global youdaoApiString:=""
11 |
12 | ; #Include *i youdaoApiKey.ahk
13 | global youdaoApiKey0, youdaoApiKey1
14 | youdaoApiKey0=12763084
15 |
16 | if(CLSets.TTranslate.apiType=1)
17 | {
18 | if(CLSets.TTranslate.apiKey!="")
19 | {
20 | key:=CLSets.TTranslate.apiKey
21 | youdaoApiString=http://fanyi.youdao.com/paidapi/fanyiapi?key=%key%&type=data&doctype=json&q=
22 | }
23 | else if(youdaoApiKey1)
24 | {
25 | youdaoApiString=http://fanyi.youdao.com/paidapi/fanyiapi?key=%youdaoApiKey1%&type=data&doctype=json&q=
26 | }
27 | }
28 | else
29 | {
30 | if(CLSets.TTranslate.apiKey!="")
31 | {
32 | key:=CLSets.TTranslate.apiKey
33 | keyFrom:=ClSets.TTranslate.keyFrom
34 | youdaoApiString=http://fanyi.youdao.com/openapi.do?keyfrom=%keyFrom%&key=%key%&type=data&doctype=json&version=1.1&q=
35 | }
36 | else if(youdaoApiKey0)
37 | {
38 | youdaoApiString=http://fanyi.youdao.com/openapi.do?keyfrom=CapsLock&key=%youdaoApiKey0%&type=data&doctype=json&version=1.1&q=
39 | }
40 | }
41 | return
42 |
43 | setTransGuiActive:
44 | WinActivate, ahk_id %transGuiHwnd%
45 | return
46 |
47 | openydTranslatePanel(){
48 | WinGet, ifGuiExistButHide, Count, ahk_id %transGuiHwnd%
49 | if(ifGuiExistButHide)
50 | {
51 | WinHide, ahk_id %transGuiHwnd%
52 | }
53 | else
54 | {
55 | Gui, new, +HwndtransGuiHwnd , %lang_yd_name%
56 | Gui, +AlwaysOnTop -Border +Caption -Disabled -LastFound -MaximizeBox -OwnDialogs -Resize +SysMenu -Theme -ToolWindow
57 | Gui, Font, s10 w400, Microsoft YaHei UI ;设置字体
58 | Gui, Font, s10 w400, 微软雅黑
59 | gui, Add, Button, x-40 y-40 Default, OK
60 |
61 | Gui, Add, Edit, x-2 y0 w504 h405 vTransEdit HwndtransEditHwnd -WantReturn -VScroll , %MsgBoxStr%
62 | Gui, Color, ffffff, fefefe
63 | Gui, +LastFound
64 | WinSet, TransColor, ffffff 210
65 | ;~ MsgBox, 1
66 | Gui, Show, Center w500 h402, %lang_yd_name%
67 | ControlFocus, , ahk_id %transEditHwnd%
68 | SetTimer, setTransActive, 50
69 | }
70 |
71 | }
72 |
73 | ydTranslate(ss)
74 | {
75 | transStart:
76 | ; if(StrLen(ss) >= 2000)
77 | ; {
78 | ; MsgBox, , , 文本过长,请重新选择。, 1
79 | ; return
80 | ; }
81 | ss:=RegExReplace(ss, "\s", " ") ;把所有空白符换成空格,因为如果有回车符的话,json转换时会出错
82 |
83 | ;~ global
84 |
85 | NativeString:=Trim(ss)
86 |
87 | transGui:
88 | ;~ WinClose, 有道翻译
89 | MsgBoxStr:=NativeString?lang_yd_translating:""
90 |
91 | DetectHiddenWindows, On ;可以检测到隐藏窗口
92 | WinGet, ifGuiExistButHide, Count, ahk_id %transGuiHwnd%
93 | if(ifGuiExistButHide)
94 | {
95 | ControlSetText, , %MsgBoxStr%, ahk_id %transEditHwnd%
96 | ControlFocus, , ahk_id %transEditHwnd%
97 | WinShow, ahk_id %transGuiHwnd%
98 | }
99 | else ;IfWinNotExist, ahk_id %transGuiHwnd% ;有道翻译
100 | {
101 | ;~ MsgBox, 0
102 |
103 | Gui, new, +HwndtransGuiHwnd , %lang_yd_name%
104 | Gui, +AlwaysOnTop -Border +Caption -Disabled -LastFound -MaximizeBox -OwnDialogs -Resize +SysMenu -Theme -ToolWindow
105 | Gui, Font, s10 w400, Microsoft YaHei UI ;设置字体
106 | Gui, Font, s10 w400, 微软雅黑
107 | gui, Add, Button, x-40 y-40 Default, OK
108 |
109 | Gui, Add, Edit, x-2 y0 w504 h405 vTransEdit HwndtransEditHwnd -WantReturn -VScroll , %MsgBoxStr%
110 | Gui, Color, ffffff, fefefe
111 | Gui, +LastFound
112 | WinSet, TransColor, ffffff 210
113 | ;~ MsgBox, 1
114 | Gui, Show, Center w500 h402, %lang_yd_name%
115 | ControlFocus, , ahk_id %transEditHwnd%
116 | SetTimer, setTransActive, 50
117 | }
118 | ;~ DetectHiddenWindows, On ;可以检测到隐藏窗口
119 |
120 | if(NativeString) ;如果传入的字符串非空则翻译
121 | {
122 | ;~ MsgBox, 2
123 | SetTimer, ydApi, -1
124 | return
125 | }
126 |
127 | Return
128 |
129 |
130 | ydApi:
131 | UTF8Codes:="" ;重置要发送的代码
132 | SetFormat, integer, H
133 | UTF8Codes:=UTF8encode(NativeString)
134 | if(youdaoApiString="")
135 | {
136 | MsgBoxStr=%lang_yd_needKey%
137 | goto, setTransText
138 | }
139 | sendStr:=youdaoApiString . UTF8Codes
140 | whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
141 |
142 | whr.Open("GET", sendStr)
143 |
144 | ;~ MsgBox, 3
145 | try
146 | {
147 | whr.Send()
148 | }
149 | catch
150 | {
151 | MsgBoxStr:=lang_yd_errorNoNet
152 | goto, setTransText
153 | }
154 | afterSend:
155 | responseStr := whr.ResponseText
156 |
157 | ;~ transJson:=JSON_from(responseStr)
158 | transJson:=JSON.Load(responseStr)
159 | ; MsgBox, % responseStr
160 | ; MsgBox, % JSON_to(transJson) ;弹出整个翻译结果的json,测试用
161 | returnError:=transJson.errorCode
162 | if(returnError) ;如果返回错误结果,显示出相应原因
163 | {
164 | if(returnError=10)
165 | {
166 | MsgBoxStr:=lang_yd_errorTooLong
167 | }
168 | if(returnError=11)
169 | {
170 | MsgBoxStr:=lang_yd_errorNoResults
171 | }
172 | if(returnError=20)
173 | {
174 | MsgBoxStr:=lang_yd_errorTextTooLong
175 | }
176 | else if(returnError=30)
177 | {
178 | MsgBoxStr:=lang_yd_errorCantTrans
179 | }
180 | else if(returnError=40)
181 | {
182 | MsgBoxStr:=lang_yd_errorLangType
183 | }
184 | else if(returnError=50)
185 | {
186 | MsgBoxStr:=lang_yd_errorKeyInvalid
187 | }
188 | else if(returnError=60)
189 | {
190 | MsgBoxStr:=lang_yd_errorSpendingLimit
191 | }
192 | else if(returnError=70)
193 | {
194 | MsgBoxStr:=lang_yd_errorNoFunds
195 | }
196 | goto, setTransText
197 | return
198 | }
199 | ;================拼MsgBox显示的内容
200 | {
201 |
202 | MsgBoxStr:= % transJson.query . "`t" ;原单词
203 | if(transJson.basic.phonetic)
204 | {
205 | MsgBoxStr:=% MsgBoxStr . "[" . transJson.basic.phonetic . "] " ;读音
206 | }
207 | MsgBoxStr:= % MsgBoxStr . "`r`n`r`n" . lang_yd_trans . "`r`n" ;分隔,换行
208 | ;~ MsgBoxStr:= % MsgBoxStr . "--有道翻译--`n"
209 | Loop
210 | {
211 | if (transJson.translation[A_Index])
212 | {
213 | if (%A_Index%>1)
214 | {
215 | MsgBoxStr:=% MsgBoxStr . A_Space . ";" . A_Space ;给每个结果之间插入" ; "
216 | }
217 | MsgBoxStr:= % MsgBoxStr . transJson.translation[A_Index] ;翻译结果
218 | }
219 | else
220 | {
221 | MsgBoxStr:= % MsgBoxStr . "`r`n`r`n" . lang_yd_dict . "`r`n"
222 | break
223 | }
224 | }
225 | ;~ MsgBoxStr:= % MsgBoxStr . "--有道词典结果--`n"
226 | Loop
227 | {
228 | if (transJson.basic.explains[A_Index])
229 | {
230 | if (A_Index>1)
231 | {
232 | ;~ MsgBoxStr:=% MsgBoxStr . A_Space . ";" . A_Space ;给每个结果之间插入" ; "
233 | MsgBoxStr:=% MsgBoxStr . "`r`n" ;每条短语换一行
234 | }
235 | MsgBoxStr:= % MsgBoxStr . transJson.basic.explains[A_Index] ;有道词典结果
236 | }
237 | else
238 | {
239 | MsgBoxStr:= % MsgBoxStr . "`r`n`r`n" . lang_yd_phrase . "`r`n"
240 | break
241 | }
242 | }
243 | ;~ MsgBoxStr:= % MsgBoxStr . "--短语--`n"
244 | Loop
245 | {
246 | if (transJson.web[A_Index])
247 | {
248 | if (A_Index>1)
249 | {
250 | MsgBoxStr:=% MsgBoxStr . "`r`n" ;每条短语换一行
251 | }
252 | MsgBoxStr:= % MsgBoxStr . transJson.web[A_Index].key . A_Space . A_Space ;短语
253 | thisA_index:=A_Index
254 | Loop
255 | {
256 | if(transJson.web[thisA_index].value[A_Index])
257 | {
258 | if (A_Index>1)
259 | {
260 | MsgBoxStr:=% MsgBoxStr . A_Space . ";" . A_Space ;给每个结果之间插入" ; "
261 | }
262 | MsgBoxStr:= % MsgBoxStr . transJson.web[thisA_index].value[A_Index]
263 | }
264 | else
265 | {
266 | break
267 | }
268 | }
269 | }
270 | else
271 | {
272 | break
273 | }
274 | }
275 | }
276 | ;~ MsgBox, % MsgBoxStr
277 | setTransText:
278 | ControlSetText, , %MsgBoxStr%, ahk_id %transEditHwnd%
279 | ControlFocus, , ahk_id %transEditHwnd%
280 | SetTimer, setTransActive, 50
281 | return
282 | ;================拼MsgBox显示的内容
283 |
284 | ButtonOK:
285 | Gui, Submit, NoHide
286 |
287 | TransEdit:=RegExReplace(TransEdit, "\s", " ") ;把所有空白符换成空格,因为如果有回车符的话,json转换时会出错
288 | NativeString:=Trim(TransEdit)
289 | ;~ goto, ydApi
290 | goto, transGui
291 |
292 | return
293 |
294 | }
295 |
296 |
297 | ;确保激活
298 | setTransActive:
299 | IfWinExist, ahk_id %transGuiHwnd%
300 | {
301 | SetTimer, ,Off
302 | WinActivate, ahk_id %transGuiHwnd%
303 | }
304 | return
--------------------------------------------------------------------------------
/lib/lib_winJump.ahk:
--------------------------------------------------------------------------------
1 | activateSideWin(UDLR){
2 | global winJumpSelected, winJumpIgnoreCount
3 | _sensitivity := Ceil(20/96*A_ScreenDPI) ; 灵敏度,每隔多少像素点检测一次,高分屏按dpi等比增加扫描间隔
4 | _deskTopExtra := 0 ; 在桌面中的话,增大移动距离
5 | winLastFoundId:=""
6 | CoordMode, Mouse, Screen
7 | ; 如果没有已选中的窗口,则取当前激活窗口为参照窗口
8 | ; 或者,如果选中的的窗口是最小化状态的 winJumpSelected
9 | if(!winJumpSelected){
10 | winHwnd := WinExist("A")
11 | ; isFromActiveWin:=true
12 | }
13 | else{
14 | winHwnd := winJumpSelected
15 | ; isFromActiveWin:=false
16 | }
17 | WinGetPos, winX, winY, winW, winH, ahk_id %winHwnd%
18 | MouseGetPos, mouX, mouY ; 保存原鼠标位置
19 | WinGetPos, , , screenW, screenH, Program Manager ; 获取全屏大小
20 |
21 |
22 |
23 | goY:=winY+winH/2
24 | goX:=winX+winW/2
25 | ; h := screenH/2
26 |
27 | if(UDLR="r")
28 | goX:=winX+winW
29 | else if(UDLR="l")
30 | goX:=winX
31 | else if(UDLR="u")
32 | goY:=winY
33 | else if(UDLR="d")
34 | goY:=winY+winH
35 | else if(UDLR="fl") ; 从最左扫描
36 | goX:=0
37 | else if(UDLR="fr") ; 从最右扫描
38 | goX:=screenW
39 | else if(UDLR="c"){ ; 中间
40 | goXY:=[]
41 | winW1_4:=winW/4
42 | winH1_4:=winH/4
43 | ; 取窗口中等分的9个点扫描
44 | goXY.Insert(1, goX, goY)
45 | goXY.Insert(3, goX-winW1_4, goY-winH1_4)
46 | goXY.Insert(5, goX+winW1_4, goY+winH1_4)
47 | goXY.Insert(7, goX-winW1_4, goY+winH1_4)
48 | goXY.Insert(9, goX+winW1_4, goY-winH1_4)
49 | goXY.Insert(11, goX-winW1_4, goY)
50 | goXY.Insert(13, goX+winW1_4, goY)
51 | goXY.Insert(15, goX, goY-winH1_4)
52 | goXY.Insert(17, goX, goY+winH1_4)
53 |
54 | winJumpCover(winX+10, winY, 0, 0)
55 | winLastFoundId:=winHwnd
56 | }
57 | SystemCursor(0) ; 隐藏鼠标
58 | ; msgbox, % goX . "$" . goY
59 | ; scaning
60 | loop{
61 | if(UDLR="r")
62 | goX += _sensitivity+_deskTopExtra
63 | else if(UDLR="l")
64 | goX -= _sensitivity+_deskTopExtra
65 | else if(UDLR="u")
66 | goY -= _sensitivity+_deskTopExtra
67 | else if(UDLR="d")
68 | goY += _sensitivity+_deskTopExtra
69 | else if(UDLR="fl")
70 | goX += (A_index=1?0:_sensitivity+_deskTopExtra)
71 | else if(UDLR="fr")
72 | goX -= (A_index=1?0:_sensitivity+_deskTopExtra)
73 | else if(UDLR="c"){
74 |
75 | if(A_index<=9){
76 | goX:=goXY[A_index*2-1]
77 | goY:=goXY[A_index*2]
78 | }else{
79 | winJumpCover(winX, winY, winW, winH)
80 | break
81 | }
82 |
83 | ; scanParticleSize:=5
84 | ; if(A_index<=scanParticleSize){
85 | ; goX += (winW-30)/scanParticleSize
86 | ; goY += (winH-30)/scanParticleSize
87 | ; }else{
88 | ; goX := winX+winW/scanParticleSize*(A_index-scanParticleSize-1)
89 | ; goY := (winY+winH)-winH/scanParticleSize*(A_index-scanParticleSize-1)
90 | ; }
91 |
92 |
93 | ; ; scanParticleSize:=5
94 | ; ; ; 从左上角扫到右下角
95 | ; ; msgbox, % goX . "@" . winX . "@" . winX+winW . "||" . goY . "@" . winY . "@" . winY+winH
96 | ; ; if(scanParticleSize>=A_index){
97 | ; ; goX := winX+winW/scanParticleSize*(A_index)
98 | ; ; goY := winY+winH/scanParticleSize*(A_index)
99 | ; ; }else{ ; 从左下角到右上角
100 | ; ; goX := winX+winW/scanParticleSize*(A_index-scanParticleSize-1)
101 | ; ; goY := (winY+winH)-winH/scanParticleSize*(A_index-scanParticleSize-1)
102 | ; ; }
103 | ; msgbox, % A_index . "%" . sgoX . "@" . winX . "@" . winX+winW . "||" . goY . "@" . winY . "@" . winY+winH
104 | ; if(goXwinX+winW or goYwinY+winH)
105 | ; break
106 | ; if(A_index>=(scanParticleSize*2))
107 | ; break
108 | }
109 | ; msgbox, % screenW . "@" . screenH
110 |
111 | if(UDLR!="c" and (goX<0 or goX>screenW or goY<0 or goY>screenH))
112 | break
113 |
114 | MouseMove, %goX%, %goY%, 0
115 | MouseGetPos, , , winNowId, controlClass
116 | ; 如果有需要忽略的窗口,则加速跳过
117 | if(winNowId=winLastFoundId){
118 | _deskTopExtra+=10
119 | continue
120 | }
121 | ; msgbox, 1
122 | WinGetTitle, title, ahk_id %winNowId%
123 |
124 | ; 如果是桌面,加速跳过
125 | if(title="Program Manager"){
126 | _deskTopExtra+=10
127 | continue
128 | }
129 |
130 | WinGetPos, winNowX, winNowY, winNowW, winNowH, ahk_id %winNowId%
131 |
132 | ; 不是启动栏的话
133 | if(controlClass!="MSTaskListWClass1"){
134 |
135 | ; 如果有需要跳过的窗口,跳过(若干次)
136 | if(winJumpIgnoreCount>0){
137 | winLastFoundId:=winNowId
138 | winJumpIgnoreCount--
139 | continue
140 | }
141 | ; msgbox, cover%winJumpIgnoreCount%
142 | winJumpCover(winNowX, winNowY, winNowW, winNowH)
143 | winJumpSelected:=winNowId
144 |
145 | settimer, winJumpActivate, 50
146 |
147 | break
148 | }
149 |
150 | }
151 | MouseMove, mouX, mouY, 0
152 | SystemCursor() ; 显示鼠标
153 | return
154 | }
155 |
156 |
157 | winJumpActivate:
158 | if(!GetKeyState("LAlt", "P") || !Capslock)
159 | {
160 | ; clean
161 | destroyWinJumpCover()
162 | winJumpIgnoreCount:=0
163 | ; /clean
164 | WinSet, Top,, ahk_id %winJumpSelected%
165 | WinActivate, ahk_id %winJumpSelected%
166 | winJumpSelected:=""
167 | settimer, winJumpActivate, off
168 | }
169 | return
170 |
171 | putWinToBottom(){
172 | global winJumpSelected
173 | ; SendInput, !{esc}
174 | if(winJumpSelected)
175 | WinSet, Bottom,, ahk_id %winJumpSelected%
176 | else
177 | SendInput, !{esc}
178 | }
179 |
180 | winJumpCover(x,y,w,h){
181 | Gui winCover:+LastFoundExist
182 | IfWinExist
183 | {
184 | WinMove, , , %x%, %y%, %w%, %h%
185 | return
186 | }
187 | Gui, winCover:New, +HwndwinCoverHwnd
188 | Gui, -Caption -Disabled -Resize +ToolWindow +AlwaysOnTop
189 | Gui, Color, 000000
190 | Gui, +LastFound
191 | WinSet, Transparent, 100
192 | Gui, Show, X%x% Y%y% W%w% H%h%
193 | return
194 | }
195 |
196 | destroyWinJumpCover(){
197 | Gui, winCover:Destroy
198 | return
199 | }
200 | ; 跳窗的时候忽略窗口,按几下忽略几个
201 | winJumpIgnore(){
202 | global winJumpIgnoreCount
203 | settimer, cleanWinJumpIgnore, 50
204 | if(!winJumpIgnoreCount)
205 | winJumpIgnoreCount:=1
206 | else
207 | winJumpIgnoreCount++
208 | ; msgbox, % winJumpIgnoreCount
209 | return
210 | }
211 |
212 | cleanWinJumpIgnore:
213 | if(!GetKeyState("LAlt", "P") || !Capslock)
214 | {
215 | ; clean
216 | winJumpIgnoreCount:=0
217 | settimer, cleanWinJumpIgnore, off
218 | }
219 | return
220 |
221 |
222 | ; 窗口栈---------------
223 | clearWinMinimizeStach(){
224 | global minimizeWinArr
225 | minimizeWinArr:={}
226 | return
227 | }
228 |
229 | popWinMinimizeStack(){
230 | global minimizeWinArr
231 | id:=minimizeWinArr.Remove()
232 | if(id)
233 | WinActivate, ahk_id %id%
234 | }
235 |
236 | pushWinMinimizeStack(){
237 | _inWinMinimizeStack()
238 | }
239 |
240 | unshiftWinMinimizeStack(){
241 | _inWinMinimizeStack(true)
242 | }
243 |
244 | _inWinMinimizeStack(ifInStart:=false){
245 | global minimizeWinArr, winJumpSelected
246 | if not minimizeWinArr
247 | minimizeWinArr:={}
248 |
249 | if(winJumpSelected){
250 | id:=winJumpSelected
251 | WinMinimize, ahk_id %id%
252 |
253 | winNowId:=WinExist("A")
254 | if(winNowId){
255 | WinGetPos, winNowX, winNowY, winNowW, winNowH, ahk_id %winNowId%
256 | winJumpCover(winNowX, winNowY, winNowW, winNowH)
257 | winJumpSelected:=winNowId
258 | ; WinGetTitle, title , ahk_id %winNowId%
259 | ; msgbox, % title
260 | }
261 |
262 | }else{
263 | id:=WinExist("A")
264 | WinMinimize, ahk_id %id%
265 | }
266 |
267 | if not ifInStart
268 | minimizeWinArr.insert(id)
269 | else
270 | minimizeWinArr.insert(1, id)
271 | ; showMsg(id)
272 | }
--------------------------------------------------------------------------------
/lib/lib_keysSet_Old.ahk:
--------------------------------------------------------------------------------
1 | ;如果没有在set.ini设置按键的话,就按这里的默认设置执行
2 | keysInit:
3 | global keyset:=CLSets.Keys
4 |
5 | ;--------------vim
6 | ; if(keyset.plan="vim")
7 | ; {
8 |
9 | ; }
10 |
11 | if(!keyset.caps_a)
12 | keyset.caps_a:="keyFunc_moveWordLeft"
13 | if(!keyset.caps_b)
14 | keyset.caps_b:="keyFunc_moveDown(5)"
15 | if(!keyset.caps_c)
16 | keyset.caps_c:="keyFunc_copy_1"
17 | if(!keyset.caps_d)
18 | keyset.caps_d:="keyFunc_moveDown"
19 | if(!keyset.caps_e)
20 | keyset.caps_e:="keyFunc_moveUp"
21 | if(!keyset.caps_f)
22 | keyset.caps_f:="keyFunc_moveRight"
23 | if(!keyset.caps_g)
24 | keyset.caps_g:="keyFunc_moveWordRight"
25 | if(!keyset.caps_h)
26 | keyset.caps_h:="keyFunc_selectWordLeft"
27 | if(!keyset.caps_i)
28 | keyset.caps_i:="keyFunc_selectUp"
29 | if(!keyset.caps_j)
30 | keyset.caps_j:="keyFunc_selectLeft"
31 | if(!keyset.caps_k)
32 | keyset.caps_k:="keyFunc_selectDown"
33 | if(!keyset.caps_l)
34 | keyset.caps_l:="keyFunc_selectRight"
35 | if(!keyset.caps_m)
36 | keyset.caps_m:="keyFunc_selectDown(5)"
37 | if(!keyset.caps_n)
38 | keyset.caps_n:="keyFunc_selectWordRight"
39 | if(!keyset.caps_o)
40 | keyset.caps_o:="keyFunc_selectEnd"
41 | if(!keyset.caps_p)
42 | keyset.caps_p:="keyFunc_home"
43 | if(!keyset.caps_q)
44 | keyset.caps_q:="keyFunc_qbar"
45 | if(!keyset.caps_r)
46 | keyset.caps_r:="keyFunc_delete"
47 | if(!keyset.caps_s)
48 | keyset.caps_s:="keyFunc_moveLeft"
49 | if(!keyset.caps_t)
50 | keyset.caps_t:="keyFunc_translate"
51 | if(!keyset.caps_u)
52 | keyset.caps_u:="keyFunc_selectHome"
53 | if(!keyset.caps_v)
54 | keyset.caps_v:="keyFunc_paste_1"
55 | if(!keyset.caps_w)
56 | keyset.caps_w:="keyFunc_backspace"
57 | if(!keyset.caps_x)
58 | keyset.caps_x:="keyFunc_cut_1"
59 | if(!keyset.caps_y)
60 | keyset.caps_y:="keyFunc_moveUp(5)"
61 | if(!keyset.caps_z)
62 | keyset.caps_z:="keyFunc_undoRedo"
63 |
64 | if(!keyset.caps_backquote)
65 | keyset.caps_backquote:="keyFunc_winbind_activate(9)"
66 | if(!keyset.caps_1)
67 | keyset.caps_1:="keyFunc_winbind_activate(1)"
68 | if(!keyset.caps_2)
69 | keyset.caps_2:="keyFunc_winbind_activate(2)"
70 | if(!keyset.caps_3)
71 | keyset.caps_3:="keyFunc_winbind_activate(3)"
72 | if(!keyset.caps_4)
73 | keyset.caps_4:="keyFunc_winbind_activate(4)"
74 | if(!keyset.caps_5)
75 | keyset.caps_5:="keyFunc_winbind_activate(5)"
76 | if(!keyset.caps_6)
77 | keyset.caps_6:="keyFunc_winbind_activate(6)"
78 | if(!keyset.caps_7)
79 | keyset.caps_7:="keyFunc_winbind_activate(7)"
80 | if(!keyset.caps_8)
81 | keyset.caps_8:="keyFunc_winbind_activate(8)"
82 | if(!keyset.caps_9)
83 | keyset.caps_9:="keyFunc_doubleChar((,))"
84 | if(!keyset.caps_0)
85 | keyset.caps_0:="keyFunc_selectUp(5)"
86 | if(!keyset.caps_minus)
87 | keyset.caps_minus:="keyFunc_pageUp"
88 | if(!keyset.caps_equal)
89 | keyset.caps_equal:="keyFunc_pageDown"
90 | if(!keyset.caps_backspace)
91 | keyset.caps_backspace:="keyFunc_deleteLine"
92 | if(!keyset.caps_tab)
93 | keyset.caps_tab:="keyFunc_tabScript"
94 | if(!keyset.caps_leftSquareBracket)
95 | keyset.caps_leftSquareBracket:="keyFunc_doubleChar({,})"
96 | if(!keyset.caps_rightSquareBracket)
97 | keyset.caps_rightSquareBracket:="keyFunc_doubleChar([,])"
98 | if(!keyset.caps_backslash)
99 | keyset.caps_backslash:="keyFunc_doNothing"
100 | if(!keyset.caps_semicolon)
101 | keyset.caps_semicolon:="keyFunc_end"
102 | if(!keyset.caps_quote)
103 | keyset.caps_quote:="keyFunc_doubleChar("""""""","""""""")"
104 | if(!keyset.caps_enter)
105 | keyset.caps_enter:="keyFunc_enterWherever"
106 | if(!keyset.caps_comma)
107 | keyset.caps_comma:="keyFunc_doubleAngle"
108 | if(!keyset.caps_dot)
109 | keyset.caps_dot:="keyFunc_send_dot"
110 | if(!keyset.caps_slash)
111 | keyset.caps_slash:="keyFunc_doNothing"
112 | if(!keyset.caps_space)
113 | keyset.caps_space:="keyFunc_enter"
114 | if(!keyset.caps_ralt)
115 | keyset.caps_ralt:="keyFunc_doNothing"
116 |
117 | if(!keyset.caps_f1)
118 | keyset.caps_f1:="keyFunc_openCpasDocs"
119 | if(!keyset.caps_f2)
120 | keyset.caps_f2:="keyFunc_mathBoard"
121 | if(!keyset.caps_f3)
122 | keyset.caps_f3:="keyFunc_mediaNext"
123 | if(!keyset.caps_f4)
124 | keyset.caps_f4:="keyFunc_winTransparent"
125 | if(!keyset.caps_f5)
126 | keyset.caps_f5:="keyFunc_reload"
127 | if(!keyset.caps_f6)
128 | keyset.caps_f6:="keyFunc_winPin"
129 | if(!keyset.caps_f7)
130 | keyset.caps_f7:="keyFunc_doNothing"
131 | if(!keyset.caps_f8)
132 | keyset.caps_f8:="keyFunc_getJSEvalString"
133 | if(!keyset.caps_f9)
134 | keyset.caps_f9:="keyFunc_doNothing"
135 | if(!keyset.caps_f10)
136 | keyset.caps_f10:="keyFunc_doNothing"
137 | if(!keyset.caps_f11)
138 | keyset.caps_f11:="keyFunc_doNothing"
139 | if(!keyset.caps_f12)
140 | keyset.caps_f12:="keyFunc_switchClipboard"
141 |
142 | ; LAlt--------------------------------------------
143 |
144 | if(!keyset.caps_lalt_a)
145 | keyset.caps_lalt_a:="keyFunc_activateSideWin(fl)"
146 | if(!keyset.caps_lalt_b)
147 | keyset.caps_lalt_b:="keyFunc_pageMoveLineDown(5)"
148 | if(!keyset.caps_lalt_c)
149 | keyset.caps_lalt_c:="keyFunc_copy_2"
150 | if(!keyset.caps_lalt_d)
151 | keyset.caps_lalt_d:="keyFunc_activateSideWin(d)"
152 | if(!keyset.caps_lalt_e)
153 | keyset.caps_lalt_e:="keyFunc_activateSideWin(u)"
154 | if(!keyset.caps_lalt_f)
155 | keyset.caps_lalt_f:="keyFunc_activateSideWin(r)"
156 | if(!keyset.caps_lalt_g)
157 | keyset.caps_lalt_g:="keyFunc_activateSideWin(fr)"
158 | if(!keyset.caps_lalt_h)
159 | keyset.caps_lalt_h:="keyFunc_clearWinMinimizeStach"
160 | if(!keyset.caps_lalt_i)
161 | keyset.caps_lalt_i:="keyFunc_doNothing"
162 | if(!keyset.caps_lalt_j)
163 | keyset.caps_lalt_j:="keyFunc_pushWinMinimizeStack"
164 | if(!keyset.caps_lalt_k)
165 | keyset.caps_lalt_k:="keyFunc_unshiftWinMinimizeStack"
166 | if(!keyset.caps_lalt_l)
167 | keyset.caps_lalt_l:="keyFunc_popWinMinimizeStack"
168 | if(!keyset.caps_lalt_m)
169 | keyset.caps_lalt_m:="keyFunc_doNothing"
170 | if(!keyset.caps_lalt_n)
171 | keyset.caps_lalt_n:="keyFunc_doNothing"
172 | if(!keyset.caps_lalt_o)
173 | keyset.caps_lalt_o:="keyFunc_doNothing"
174 | if(!keyset.caps_lalt_p)
175 | keyset.caps_lalt_p:="keyFunc_doNothing"
176 | if(!keyset.caps_lalt_q)
177 | keyset.caps_lalt_q:="keyFunc_activateSideWin(c)"
178 | if(!keyset.caps_lalt_r)
179 | keyset.caps_lalt_r:="keyFunc_tabNext"
180 | if(!keyset.caps_lalt_s)
181 | keyset.caps_lalt_s:="keyFunc_activateSideWin(l)"
182 | if(!keyset.caps_lalt_t)
183 | keyset.caps_lalt_t:="keyFunc_doNothing"
184 | if(!keyset.caps_lalt_u)
185 | keyset.caps_lalt_u:="keyFunc_doNothing"
186 | if(!keyset.caps_lalt_v)
187 | keyset.caps_lalt_v:="keyFunc_paste_2"
188 | if(!keyset.caps_lalt_w)
189 | keyset.caps_lalt_w:="keyFunc_tabPrve"
190 | if(!keyset.caps_lalt_x)
191 | keyset.caps_lalt_x:="keyFunc_cut_2"
192 | if(!keyset.caps_lalt_y)
193 | keyset.caps_lalt_y:="keyFunc_pageMoveLineUp(5)"
194 | if(!keyset.caps_lalt_z)
195 | keyset.caps_lalt_z:="keyFunc_putWinToBottom"
196 |
197 | if(!keyset.caps_lalt_backquote)
198 | keyset.caps_lalt_backquote:="keyFunc_winbind_binding(9)"
199 | if(!keyset.caps_lalt_1)
200 | keyset.caps_lalt_1:="keyFunc_winbind_binding(1)"
201 | if(!keyset.caps_lalt_2)
202 | keyset.caps_lalt_2:="keyFunc_winbind_binding(2)"
203 | if(!keyset.caps_lalt_3)
204 | keyset.caps_lalt_3:="keyFunc_winbind_binding(3)"
205 | if(!keyset.caps_lalt_4)
206 | keyset.caps_lalt_4:="keyFunc_winbind_binding(4)"
207 | if(!keyset.caps_lalt_5)
208 | keyset.caps_lalt_5:="keyFunc_winbind_binding(5)"
209 | if(!keyset.caps_lalt_6)
210 | keyset.caps_lalt_6:="keyFunc_winbind_binding(6)"
211 | if(!keyset.caps_lalt_7)
212 | keyset.caps_lalt_7:="keyFunc_winbind_binding(7)"
213 | if(!keyset.caps_lalt_8)
214 | keyset.caps_lalt_8:="keyFunc_winbind_binding(8)"
215 | if(!keyset.caps_lalt_9)
216 | keyset.caps_lalt_9:="keyFunc_doNothing"
217 | if(!keyset.caps_lalt_0)
218 | keyset.caps_lalt_0:="keyFunc_doNothing"
219 | if(!keyset.caps_lalt_minus)
220 | keyset.caps_lalt_minus:="keyFunc_jumpPageTop"
221 | if(!keyset.caps_lalt_equal)
222 | keyset.caps_lalt_equal:="keyFunc_jumpPageBottom"
223 | if(!keyset.caps_lalt_backspace)
224 | keyset.caps_lalt_backspace:="keyFunc_backspace"
225 | if(!keyset.caps_lalt_tab)
226 | keyset.caps_lalt_tab:="keyFunc_doNothing"
227 | if(!keyset.caps_lalt_leftSquareBracket)
228 | keyset.caps_lalt_leftSquareBracket:="keyFunc_doNothing"
229 | if(!keyset.caps_lalt_rightSquareBracket)
230 | keyset.caps_lalt_rightSquareBracket:="keyFunc_doNothing"
231 | if(!keyset.caps_lalt_backslash)
232 | keyset.caps_lalt_backslash:="keyFunc_doNothing"
233 | if(!keyset.caps_lalt_semicolon)
234 | keyset.caps_lalt_semicolon:="keyFunc_doNothing"
235 | if(!keyset.caps_lalt_quote)
236 | keyset.caps_lalt_quote:="keyFunc_doNothing"
237 | if(!keyset.caps_lalt_enter)
238 | keyset.caps_lalt_enter:="keyFunc_doNothing"
239 | if(!keyset.caps_lalt_comma)
240 | keyset.caps_lalt_comma:="keyFunc_doNothing"
241 | if(!keyset.caps_lalt_dot)
242 | keyset.caps_lalt_dot:="keyFunc_doNothing"
243 | if(!keyset.caps_lalt_slash)
244 | keyset.caps_lalt_slash:="keyFunc_doNothing"
245 | if(!keyset.caps_lalt_space)
246 | keyset.caps_lalt_space:="keyFunc_doNothing"
247 | if(!keyset.caps_lalt_ralt)
248 | keyset.caps_lalt_ralt:="keyFunc_doNothing"
249 |
250 |
251 |
252 | ;--------------------other--------------------
253 |
254 | if(!keyset.caps_lalt_wheelUp)
255 | keyset.caps_lalt_wheelUp:="keyFunc_mouseSpeedIncrease"
256 | if(!keyset.caps_lalt_wheelDown)
257 | keyset.caps_lalt_wheelDown:="keyFunc_mouseSpeedDecrease"
258 |
259 |
260 |
261 | return
--------------------------------------------------------------------------------
/lib/lib_settings.ahk:
--------------------------------------------------------------------------------
1 | /*
2 | 提出settings.ini的设置信息
3 |
4 | ini demo:
5 | diko(Korean Dict)=http://cndic.naver.com/search/all?q={q}
6 | CLSets object Demo:
7 | CLSets.QRun=
8 | {
9 | diko:{ //键值,排除掉括号里面的
10 | fullKey:"diko(Korean Dict)", //全名键值
11 | setValue:"http://cndic.naver.com/search/all?q={q}",
12 | iconIndex:17; //icon索引
13 | }
14 | }
15 | */
16 | settingsInit:
17 | global settingsModifyTime ;设置文件的修改时间
18 | global CLSets:={} ;保存Capsock+settings.ini的各种设置
19 | global CLUserKeys:={}
20 | CLSets.length:={} ;保存settings.ini中每个字段的关键词数量
21 |
22 | global CKeys:={} ;保存AllKeys的各种设置
23 | global CurPName:=0 ; 当前的进程ID
24 |
25 | global setsChanges:={} ;保存哪些设置经过改变
26 | ;set.ini 里面所有字段名,有更新必须修改这里,否则会无法获取
27 | global iniSections:=["Global","QSearch","QRun","QWeb","TabHotString","QStyle","TTranslate","Keys","Dict"]
28 | FileGetTime, settingsModifyTime, CapsLockPlusSettings.ini
29 |
30 | ;init CapsLockPlusSettingsDemo.ini and CapsLockPlusSettings.ini
31 | IfNotExist, CapsLockPlusSettingsDemo.ini
32 | {
33 | FileAppend, %lang_settingsIniInit%, CapsLockPlusSettingsDemo.ini, UTF-16
34 | FileSetAttrib, +R, CapsLockPlusSettingsDemo.ini
35 | }
36 | else
37 | {
38 | FileGetTime, setDemoModifyTime, CapsLockPlusSettingsDemo.ini
39 | IfExist, language
40 | {
41 | FileGetTime, thisScriptModifyTime, language
42 | }
43 | else
44 | {
45 | FileGetTime, thisScriptModifyTime, %A_ScriptName%
46 | }
47 |
48 | thisScriptModifyTime -= setDemoModifyTime, S
49 | if(thisScriptModifyTime > 0) ;如果主程序文件比较新,那就是更新过,那就覆盖一遍
50 | {
51 | FileSetAttrib, -R, CapsLockPlusSettingsDemo.ini
52 | FileDelete, CapsLockPlusSettingsDemo.ini
53 | FileAppend, %lang_settingsIniInit%, CapsLockPlusSettingsDemo.ini, UTF-16
54 | FileSetAttrib, +R, CapsLockPlusSettingsDemo.ini
55 | }
56 | }
57 | IfNotExist, CapsLockPlusSettings.ini
58 | {
59 | FileAppend, %lang_settingsUserInit%, CapsLockPlusSettings.ini, UTF-16
60 | }
61 | lang_settingsIniInit:=""
62 | lang_settingsUserInit:=""
63 | ; IniRead, settingsSections, CapsLockPlusSettings.ini, , , %A_Space%
64 | ; sectionArr:=StrSplit(settingsSections,"`n")
65 | for key,sectionValue in iniSections
66 | {
67 | setsChanges[sectionValue]:={}
68 | setsChanges[sectionValue].deleted:={}
69 | setsChanges[sectionValue].modified:={}
70 | setsChanges[sectionValue].appended:={}
71 | settingsSectionInit(sectionValue)
72 | }
73 | gosub, keysInit
74 | SetTimer, globalSettings, -1
75 | SetTimer, setShortcutKey, -1
76 | SetTimer, hotStringInit, -1
77 | SetTimer, monitorSettingsFile, 500
78 | return
79 |
80 | ;监控设置文件的修改,并作出改动
81 | monitorSettingsFile:
82 | FileGetTime, latestModifyTime, CapsLockPlusSettings.ini
83 | if(latestModifyTime!=settingsModifyTime)
84 | {
85 | settingsModifyTime:=latestModifyTime
86 | ; IniRead, settingsSections, CapsLockPlusSettings.ini, , , %A_Space%
87 | ; sectionArr:=StrSplit(settingsSections,"`n")
88 |
89 | for key,sectionValue in iniSections ;sectionArr
90 | {
91 | isChange%sectionValue%:=settingsSectionInit(sectionValue)
92 | _test:=isChange%sectionValue%
93 |
94 | }
95 | if(isChangeKeys)
96 | {
97 | SetTimer, keysInit, -1
98 | }
99 | if(isChangeGlobal) ;如果global改过
100 | {
101 |
102 | for key1 in setsChanges.Global
103 | {
104 | for key2 in setsChanges.Global[key1]
105 | {
106 | if(key2="autostart")
107 | SetTimer, globalSettings, -1
108 | else if(key2="loadScript")
109 | SetTimer, jsEval_init, -1
110 | }
111 | }
112 | }
113 | if(isChangeTabHotString)
114 | {
115 | SetTimer, hotStringInit, -1
116 | }
117 | if(isChangeTTranslate)
118 | {
119 | SetTimer, youdaoApiInit, -1
120 | }
121 | ;如果有新添加的字段,要在这句上面添加一个if,这样文件改动才会修改到相应的内容
122 | if(isChangeQStyle)
123 | {
124 | global needInitQ:=1 ;+q初始化标志位
125 | CLq()
126 | return ;如果整个Q都重绘,那也不用在单独重载QListView了,返回好了
127 | }
128 | if(isChangeQSearch)
129 | {
130 | SetTimer, QListIconInit, -1
131 | }
132 | if(isChangeQWeb||isChangeQRun)
133 | {
134 | SetTimer, QListIconInit, -1
135 | SetTimer, hotStringInit, -1
136 | }
137 | }
138 | return
139 |
140 | getShortSetKey(str)
141 | {
142 | return RegExReplace(str, "\s*<.*>$")
143 | }
144 |
145 | settingsSectionInit(sectionValue)
146 | {
147 | isChange:=0 ;这个字段是否有改动过
148 | IniRead, settingsKeys, CapsLockPlusSettings.ini, %sectionValue%, , %A_Space%
149 | settingsKeys:=RegExReplace(settingsKeys, "m`n)=.*$")
150 | keyArr:=StrSplit(settingsKeys,"`n")
151 |
152 |
153 | tempLen:=CLSets.length[sectionValue]
154 | if tempLen is not number ;如果还没初始化过
155 | {
156 | CLSets[sectionValue]:={}
157 | _clsetsSec:=CLSets[sectionValue]
158 | CLSets.length[sectionValue]:=0
159 |
160 | for key,keyValue in keyArr
161 | {
162 | IniRead, setValue, CapsLockPlusSettings.ini, %sectionValue%, %keyValue%, %A_Space%
163 |
164 | if sectionValue in QSearch,QRun,QWeb ;如果是这些里面的,用对象来保存,否则直接key=value
165 | {
166 | shortKey:=getShortSetKey(keyValue) ;从 abc(xxx) 中提取出 abc,用来作关键字
167 | _clsetsSec[shortKey]:={}
168 | _t:=_clsetsSec[shortKey]
169 | _t.fullKey:=keyValue
170 | _t.setValue:=setValue
171 | }
172 | else if(sectionValue="Keys")
173 | {
174 | _clsetsSec[keyValue]:=setValue
175 | CLUserKeys[keyValue]:=setValue
176 | }
177 | else
178 | {
179 | _clsetsSec[keyValue]:=setValue
180 | }
181 | CLSets.length[sectionValue]++
182 | }
183 | }
184 | else ;不是初始化
185 | {
186 | _clsetsSec:=CLSets[sectionValue]
187 | if sectionValue in QSearch,QRun,QWeb
188 | {
189 | for key,value in _clsetsSec
190 | {
191 | _fullKey:=value.fullKey
192 | IniRead, valNew, CapsLockPlusSettings.ini, %sectionValue%, %_fullKey%, %A_Space%
193 | if(valNew="") ;已删除
194 | {
195 | ;在这里接直接删除CLSets的话,循环的index会被弄乱,跑完for才删除CLSets
196 | setsChanges[sectionValue].deleted.insert(_fullKey)
197 | isChange:=1
198 | }
199 | else
200 | {
201 | if(value.setValue!=valNew)
202 | {
203 | shortKey:=getShortSetKey(key)
204 | _t:=_clsetsSec[shortKey]
205 | _t.fullKey:=key
206 | _t.setValue:=valNew
207 | ; if(sectionValue!="TabHotString")
208 | setsChanges[sectionValue].modified[key]:=valNew
209 | isChange:=1
210 | }
211 | }
212 | }
213 |
214 | for key, value in setsChanges[sectionValue].deleted
215 | {
216 | _clsetsSec.remove(value)
217 | CLSets.length[sectionValue]--
218 | }
219 |
220 | for key,value in keyArr
221 | {
222 | valOld:=_clsetsSec[getShortSetKey(value)].setValue
223 | if(!(valOld=0||valOld)) ;如果未声明过的变量, 新添加
224 | {
225 | IniRead, valNew, CapsLockPlusSettings.ini, %sectionValue%, %value%, %A_Space%
226 | shortKey:=getShortSetKey(value)
227 | _clsetsSec[shortKey]:={}
228 | _t:=_clsetsSec[shortKey]
229 | _t.fullKey:=value
230 | _t.setValue:=valNew
231 | CLSets.length[sectionValue]++
232 | ; if(sectionValue!="TabHotString")
233 | setsChanges[sectionValue].appended[value]:=valNew
234 | isChange:=1
235 | }
236 | }
237 | }
238 | else ;如果不在QSearch,QRun,QWeb之中
239 | {
240 | for key,value in _clsetsSec
241 | {
242 | IniRead, valNew, CapsLockPlusSettings.ini, %sectionValue%, %key%, %A_Space%
243 | if(valNew="") ;已删除
244 | {
245 | ;在这里接直接删除CLSets的话,循环的index会被弄乱,跑完for才删除CLSets
246 | setsChanges[sectionValue].deleted.insert(key)
247 | isChange:=1
248 | }
249 | else
250 | {
251 | if(value!=valNew)
252 | {
253 | ; msgbox, % value . "@" . valNew
254 | _clsetsSec[key]:=valNew
255 | setsChanges[sectionValue].modified[key]:=valNew
256 | isChange:=1
257 | }
258 | }
259 | }
260 |
261 | for key, value in setsChanges[sectionValue].deleted
262 | {
263 | _clsetsSec.remove(value)
264 | CLSets.length[sectionValue]--
265 | }
266 |
267 | for key,value in keyArr
268 | {
269 | valOld:=_clsetsSec[value]
270 | if(!(valOld=0||valOld)) ;如果未声明过的变量, 新添加
271 | {
272 | IniRead, valNew, CapsLockPlusSettings.ini, %sectionValue%, %value%, %A_Space%
273 | _clsetsSec[value]:=valNew
274 | CLSets.length[sectionValue]++
275 | setsChanges[sectionValue].appended[value]:=valNew
276 | isChange:=1
277 | }
278 | }
279 | }
280 |
281 | }
282 | return isChange
283 | }
284 |
285 |
286 | globalSettings:
287 | ; scriptNameNoSuffix:=RegExReplace(A_ScriptName , "i)(\.ahk|\.exe)$")
288 | ;----------auto start-------------
289 | autostartLnk:=A_StartupCommon . "\CapsLockPlus.lnk"
290 | if(CLsets.global.autostart) ;如果开启开机自启动
291 | {
292 | IfExist, % autostartLnk
293 | {
294 | FileGetShortcut, %autostartLnk%, lnkTarget
295 | if(lnkTarget!=A_ScriptFullPath)
296 | FileCreateShortcut, %A_ScriptFullPath%, %autostartLnk%, %A_WorkingDir%
297 | }
298 | else
299 | {
300 | FileCreateShortcut, %A_ScriptFullPath%, %autostartLnk%, %A_WorkingDir%
301 | }
302 | }
303 | else
304 | {
305 | IfExist, % autostartLnk
306 | {
307 | FileDelete, %autostartLnk%
308 | }
309 | }
310 |
311 | if(CLsets.Global.allowClipboard!="0")
312 | CLsets.Global.allowClipboard:=1
313 |
314 | return
315 |
316 | ; 支持ctrl+alt+Capslock启动CapsLockPlus
317 | setShortcutKey:
318 | startMenuLnk:=A_ProgramsCommon . "\CapsLockPlus.lnk"
319 | IfExist, % startMenuLnk
320 | {
321 | FileGetShortcut, %startMenuLnk%, lnkTarget
322 | if(lnkTarget!=A_ScriptFullPath)
323 | FileCreateShortcut, %A_ScriptFullPath%, %startMenuLnk%, %A_WorkingDir%, , , , Capslock
324 | }
325 | else
326 | {
327 | FileCreateShortcut, %A_ScriptFullPath%, %startMenuLnk%, %A_WorkingDir%, , , , Capslock
328 | }
329 | return
330 |
331 | ; caps+tab 热字串替换初始化;用拼接正则的方法实现关键字匹配
332 | hotStringInit:
333 | global regexHotString:="iS)("
334 | for key,value in CLSets.TabHotString
335 | {
336 | regexHotString.="\Q" . key . "\E" . "|"
337 | }
338 | for key,value in CLSets.QRun
339 | {
340 | regexHotString.="\Q" . key . "\E" . "|"
341 | }
342 | for key,value in CLSets.QWeb
343 | {
344 | regexHotString.="\Q" . key . "\E" . "|"
345 | }
346 | regexHotString.=")$"
347 | return
348 |
349 | CLhotString()
350 | {
351 | matchKey:=""
352 | RegExMatch(Clipboard, regexHotString, matchKey)
353 | if(matchKey)
354 | {
355 | for key,value in CLSets.TabHotString
356 | {
357 | tmp:="Key:" . key . " ,Value:" . value
358 | MsgBox, %tmp%
359 | }
360 |
361 |
362 | if(CLSets.TabHotString[matchKey])
363 | {
364 | temp:=RegExReplace(Clipboard, "\Q" . matchKey . "\E$", CLSets.TabHotString[matchKey])
365 | StringReplace, temp, temp, \n, `n, All ;替换换行符
366 | StringReplace, temp, temp, \`n, \n, All ;有转义符的换回来
367 | StringReplace, temp, temp, \t, `t, All ;替换制表符
368 | StringReplace, temp, temp, \`t, \t, All ;有制表符的换回来
369 | Clipboard:=temp
370 | }
371 | else if(IsObject(CLSets.QRun[matchKey]))
372 | {
373 | Clipboard:=RegExReplace(Clipboard, "\Q" . matchKey . "\E$", CLSets.QRun[matchKey].setValue)
374 | }
375 | else
376 | {
377 | Clipboard:=RegExReplace(Clipboard, "\Q" . matchKey . "\E$", CLSets.QWeb[matchKey].setValue)
378 | }
379 | }
380 |
381 | return matchKey
382 | }
383 |
384 |
385 |
386 |
--------------------------------------------------------------------------------
/lib/lib_json.ahk:
--------------------------------------------------------------------------------
1 | /**
2 | * Lib: JSON.ahk
3 | * JSON lib for AutoHotkey.
4 | * Version:
5 | * v2.1.3 [updated 04/18/2016 (MM/DD/YYYY)]
6 | * License:
7 | * WTFPL [http://wtfpl.net/]
8 | * Requirements:
9 | * Latest version of AutoHotkey (v1.1+ or v2.0-a+)
10 | * Installation:
11 | * Use #Include JSON.ahk or copy into a function library folder and then
12 | * use #Include
13 | * Links:
14 | * GitHub: - https://github.com/cocobelgica/AutoHotkey-JSON
15 | * Forum Topic - http://goo.gl/r0zI8t
16 | * Email: - cocobelgica gmail com
17 | */
18 |
19 |
20 | /**
21 | * Class: JSON
22 | * The JSON object contains methods for parsing JSON and converting values
23 | * to JSON. Callable - NO; Instantiable - YES; Subclassable - YES;
24 | * Nestable(via #Include) - NO.
25 | * Methods:
26 | * Load() - see relevant documentation before method definition header
27 | * Dump() - see relevant documentation before method definition header
28 | */
29 | class JSON
30 | {
31 | /**
32 | * Method: Load
33 | * Parses a JSON string into an AHK value
34 | * Syntax:
35 | * value := JSON.Load( text [, reviver ] )
36 | * Parameter(s):
37 | * value [retval] - parsed value
38 | * text [in, ByRef] - JSON formatted string
39 | * reviver [in, opt] - function object, similar to JavaScript's
40 | * JSON.parse() 'reviver' parameter
41 | */
42 | class Load extends JSON.Functor
43 | {
44 | Call(self, ByRef text, reviver:="")
45 | {
46 | this.rev := IsObject(reviver) ? reviver : false
47 | ; Object keys(and array indices) are temporarily stored in arrays so that
48 | ; we can enumerate them in the order they appear in the document/text instead
49 | ; of alphabetically. Skip if no reviver function is specified.
50 | this.keys := this.rev ? {} : false
51 |
52 | static quot := Chr(34), bashq := "\" . quot
53 | , json_value := quot . "{[01234567890-tfn"
54 | , json_value_or_array_closing := quot . "{[]01234567890-tfn"
55 | , object_key_or_object_closing := quot . "}"
56 |
57 | key := ""
58 | is_key := false
59 | root := {}
60 | stack := [root]
61 | next := json_value
62 | pos := 0
63 |
64 | while ((ch := SubStr(text, ++pos, 1)) != "") {
65 | if InStr(" `t`r`n", ch)
66 | continue
67 | if !InStr(next, ch, 1)
68 | this.ParseError(next, text, pos)
69 |
70 | holder := stack[1]
71 | is_array := holder.IsArray
72 |
73 | if InStr(",:", ch) {
74 | next := (is_key := !is_array && ch == ",") ? quot : json_value
75 |
76 | } else if InStr("}]", ch) {
77 | ObjRemoveAt(stack, 1)
78 | next := stack[1]==root ? "" : stack[1].IsArray ? ",]" : ",}"
79 |
80 | } else {
81 | if InStr("{[", ch) {
82 | ; Check if Array() is overridden and if its return value has
83 | ; the 'IsArray' property. If so, Array() will be called normally,
84 | ; otherwise, use a custom base object for arrays
85 | static json_array := Func("Array").IsBuiltIn || ![].IsArray ? {IsArray: true} : 0
86 |
87 | ; sacrifice readability for minor(actually negligible) performance gain
88 | (ch == "{")
89 | ? ( is_key := true
90 | , value := {}
91 | , next := object_key_or_object_closing )
92 | ; ch == "["
93 | : ( value := json_array ? new json_array : []
94 | , next := json_value_or_array_closing )
95 |
96 | ObjInsertAt(stack, 1, value)
97 |
98 | if (this.keys)
99 | this.keys[value] := []
100 |
101 | } else {
102 | if (ch == quot) {
103 | i := pos
104 | while (i := InStr(text, quot,, i+1)) {
105 | value := StrReplace(SubStr(text, pos+1, i-pos-1), "\\", "\u005c")
106 |
107 | static tail := A_AhkVersion<"2" ? 0 : -1
108 | if (SubStr(value, tail) != "\")
109 | break
110 | }
111 |
112 | if (!i)
113 | this.ParseError("'", text, pos)
114 |
115 | value := StrReplace(value, "\/", "/")
116 | , value := StrReplace(value, bashq, quot)
117 | , value := StrReplace(value, "\b", "`b")
118 | , value := StrReplace(value, "\f", "`f")
119 | , value := StrReplace(value, "\n", "`n")
120 | , value := StrReplace(value, "\r", "`r")
121 | , value := StrReplace(value, "\t", "`t")
122 |
123 | pos := i ; update pos
124 |
125 | i := 0
126 | while (i := InStr(value, "\",, i+1)) {
127 | if !(SubStr(value, i+1, 1) == "u")
128 | this.ParseError("\", text, pos - StrLen(SubStr(value, i+1)))
129 |
130 | uffff := Abs("0x" . SubStr(value, i+2, 4))
131 | if (A_IsUnicode || uffff < 0x100)
132 | value := SubStr(value, 1, i-1) . Chr(uffff) . SubStr(value, i+6)
133 | }
134 |
135 | if (is_key) {
136 | key := value, next := ":"
137 | continue
138 | }
139 |
140 | } else {
141 | value := SubStr(text, pos, i := RegExMatch(text, "[\]\},\s]|$",, pos)-pos)
142 |
143 | static number := "number", integer :="integer"
144 | if value is %number%
145 | {
146 | if value is %integer%
147 | value += 0
148 | }
149 | else if (value == "true" || value == "false")
150 | value := %value% + 0
151 | else if (value == "null")
152 | value := ""
153 | else
154 | ; we can do more here to pinpoint the actual culprit
155 | ; but that's just too much extra work.
156 | this.ParseError(next, text, pos, i)
157 |
158 | pos += i-1
159 | }
160 |
161 | next := holder==root ? "" : is_array ? ",]" : ",}"
162 | } ; If InStr("{[", ch) { ... } else
163 |
164 | is_array? key := ObjPush(holder, value) : holder[key] := value
165 |
166 | if (this.keys && this.keys.HasKey(holder))
167 | this.keys[holder].Push(key)
168 | }
169 |
170 | } ; while ( ... )
171 |
172 | return this.rev ? this.Walk(root, "") : root[""]
173 | }
174 |
175 | ParseError(expect, ByRef text, pos, len:=1)
176 | {
177 | static quot := Chr(34), qurly := quot . "}"
178 |
179 | line := StrSplit(SubStr(text, 1, pos), "`n", "`r").Length()
180 | col := pos - InStr(text, "`n",, -(StrLen(text)-pos+1))
181 | msg := Format("{1}`n`nLine:`t{2}`nCol:`t{3}`nChar:`t{4}"
182 | , (expect == "") ? "Extra data"
183 | : (expect == "'") ? "Unterminated string starting at"
184 | : (expect == "\") ? "Invalid \escape"
185 | : (expect == ":") ? "Expecting ':' delimiter"
186 | : (expect == quot) ? "Expecting object key enclosed in double quotes"
187 | : (expect == qurly) ? "Expecting object key enclosed in double quotes or object closing '}'"
188 | : (expect == ",}") ? "Expecting ',' delimiter or object closing '}'"
189 | : (expect == ",]") ? "Expecting ',' delimiter or array closing ']'"
190 | : InStr(expect, "]") ? "Expecting JSON value or array closing ']'"
191 | : "Expecting JSON value(string, number, true, false, null, object or array)"
192 | , line, col, pos)
193 |
194 | static offset := A_AhkVersion<"2" ? -3 : -4
195 | throw Exception(msg, offset, SubStr(text, pos, len))
196 | }
197 |
198 | Walk(holder, key)
199 | {
200 | value := holder[key]
201 | if IsObject(value) {
202 | for i, k in this.keys[value] {
203 | ; check if ObjHasKey(value, k) ??
204 | v := this.Walk(value, k)
205 | if (v != JSON.Undefined)
206 | value[k] := v
207 | else
208 | ObjDelete(value, k)
209 | }
210 | }
211 |
212 | return this.rev.Call(holder, key, value)
213 | }
214 | }
215 |
216 | /**
217 | * Method: Dump
218 | * Converts an AHK value into a JSON string
219 | * Syntax:
220 | * str := JSON.Dump( value [, replacer, space ] )
221 | * Parameter(s):
222 | * str [retval] - JSON representation of an AHK value
223 | * value [in] - any value(object, string, number)
224 | * replacer [in, opt] - function object, similar to JavaScript's
225 | * JSON.stringify() 'replacer' parameter
226 | * space [in, opt] - similar to JavaScript's JSON.stringify()
227 | * 'space' parameter
228 | */
229 | class Dump extends JSON.Functor
230 | {
231 | Call(self, value, replacer:="", space:="")
232 | {
233 | this.rep := IsObject(replacer) ? replacer : ""
234 |
235 | this.gap := ""
236 | if (space) {
237 | static integer := "integer"
238 | if space is %integer%
239 | Loop, % ((n := Abs(space))>10 ? 10 : n)
240 | this.gap .= " "
241 | else
242 | this.gap := SubStr(space, 1, 10)
243 |
244 | this.indent := "`n"
245 | }
246 |
247 | return this.Str({"": value}, "")
248 | }
249 |
250 | Str(holder, key)
251 | {
252 | value := holder[key]
253 |
254 | if (this.rep)
255 | value := this.rep.Call(holder, key, ObjHasKey(holder, key) ? value : JSON.Undefined)
256 |
257 | if IsObject(value) {
258 | ; Check object type, skip serialization for other object types such as
259 | ; ComObject, Func, BoundFunc, FileObject, RegExMatchObject, Property, etc.
260 | static type := A_AhkVersion<"2" ? "" : Func("Type")
261 | if (type ? type.Call(value) == "Object" : ObjGetCapacity(value) != "") {
262 | if (this.gap) {
263 | stepback := this.indent
264 | this.indent .= this.gap
265 | }
266 |
267 | is_array := value.IsArray
268 | ; Array() is not overridden, rollback to old method of
269 | ; identifying array-like objects. Due to the use of a for-loop
270 | ; sparse arrays such as '[1,,3]' are detected as objects({}).
271 | if (!is_array) {
272 | for i in value
273 | is_array := i == A_Index
274 | until !is_array
275 | }
276 |
277 | str := ""
278 | if (is_array) {
279 | Loop, % value.Length() {
280 | if (this.gap)
281 | str .= this.indent
282 |
283 | v := this.Str(value, A_Index)
284 | str .= (v != "") ? v . "," : "null,"
285 | }
286 | } else {
287 | colon := this.gap ? ": " : ":"
288 | for k in value {
289 | v := this.Str(value, k)
290 | if (v != "") {
291 | if (this.gap)
292 | str .= this.indent
293 |
294 | str .= this.Quote(k) . colon . v . ","
295 | }
296 | }
297 | }
298 |
299 | if (str != "") {
300 | str := RTrim(str, ",")
301 | if (this.gap)
302 | str .= stepback
303 | }
304 |
305 | if (this.gap)
306 | this.indent := stepback
307 |
308 | return is_array ? "[" . str . "]" : "{" . str . "}"
309 | }
310 |
311 | } else ; is_number ? value : "value"
312 | return ObjGetCapacity([value], 1)=="" ? value : this.Quote(value)
313 | }
314 |
315 | Quote(string)
316 | {
317 | static quot := Chr(34), bashq := "\" . quot
318 |
319 | if (string != "") {
320 | string := StrReplace(string, "\", "\\")
321 | ; , string := StrReplace(string, "/", "\/") ; optional in ECMAScript
322 | , string := StrReplace(string, quot, bashq)
323 | , string := StrReplace(string, "`b", "\b")
324 | , string := StrReplace(string, "`f", "\f")
325 | , string := StrReplace(string, "`n", "\n")
326 | , string := StrReplace(string, "`r", "\r")
327 | , string := StrReplace(string, "`t", "\t")
328 |
329 | static rx_escapable := A_AhkVersion<"2" ? "O)[^\x20-\x7e]" : "[^\x20-\x7e]"
330 | while RegExMatch(string, rx_escapable, m)
331 | string := StrReplace(string, m.Value, Format("\u{1:04x}", Ord(m.Value)))
332 | }
333 |
334 | return quot . string . quot
335 | }
336 | }
337 |
338 | /**
339 | * Property: Undefined
340 | * Proxy for 'undefined' type
341 | * Syntax:
342 | * undefined := JSON.Undefined
343 | * Remarks:
344 | * For use with reviver and replacer functions since AutoHotkey does not
345 | * have an 'undefined' type. Returning blank("") or 0 won't work since these
346 | * can't be distnguished from actual JSON values. This leaves us with objects.
347 | * Replacer() - the caller may return a non-serializable AHK objects such as
348 | * ComObject, Func, BoundFunc, FileObject, RegExMatchObject, and Property to
349 | * mimic the behavior of returning 'undefined' in JavaScript but for the sake
350 | * of code readability and convenience, it's better to do 'return JSON.Undefined'.
351 | * Internally, the property returns a ComObject with the variant type of VT_EMPTY.
352 | */
353 | Undefined[]
354 | {
355 | get {
356 | static empty := {}, vt_empty := ComObject(0, &empty, 1)
357 | return vt_empty
358 | }
359 | }
360 |
361 | class Functor
362 | {
363 | __Call(method, ByRef arg, args*)
364 | {
365 | ; When casting to Call(), use a new instance of the "function object"
366 | ; so as to avoid directly storing the properties(used across sub-methods)
367 | ; into the "function object" itself.
368 | if IsObject(method)
369 | return (new this).Call(method, arg, args*)
370 | else if (method == "")
371 | return (new this).Call(arg, args*)
372 | }
373 | }
374 | }
--------------------------------------------------------------------------------
/lib/lib_keysFunLogic.ahk:
--------------------------------------------------------------------------------
1 | ; Backspace
2 | funcLogic_backspace(){
3 | SendInput,{BackSpace}
4 | Return
5 | }
6 |
7 | ; 弹出U盘
8 | funcLogic_drivePop(){
9 | DriveGet, list, list
10 | loop,Parse,list
11 | {
12 | ; 设定为你想弹出的驱动器的标号。
13 | popDriver:=A_LoopField . ":"
14 | DriveGet, type, type, %popDriver%
15 | ; 如果是移动磁盘,则执行弹出操作
16 | if(type == "Removable")
17 | {
18 | hVolume := DllCall("CreateFile", Str, "\\.\" . popDriver
19 | , UInt, 0x80000000 | 0x40000000
20 | , UInt, 0x1 | 0x2
21 | , UInt, 0
22 | , UInt, 0x3
23 | , UInt, 0, UInt, 0)
24 | if hVolume <> -1
25 | {
26 | DllCall("DeviceIoControl", UInt, hVolume , UInt, 0x2D4808
27 | , UInt, 0, UInt, 0, UInt, 0, UInt, 0 , UIntP, dwBytesReturned
28 | , UInt, 0)
29 | DllCall("CloseHandle", UInt, hVolume)
30 | }
31 | }
32 | }
33 | }
34 |
35 | ; 复制到粘贴板1
36 | funcLogic_copy1(){
37 | global
38 | if(CLsets.global.allowClipboard="0") ;禁用剪贴板功能
39 | {
40 | CapsLock2:=""
41 | return
42 | }
43 |
44 | ClipboardOld:=ClipboardAll
45 | Clipboard:=""
46 | SendInput, ^{insert}
47 | ClipWait, 0.1
48 | if (ErrorLevel)
49 | {
50 | SendInput,{home}+{End}^{insert}{End}
51 | ClipWait, 0.1
52 | }
53 | if (!ErrorLevel)
54 | {
55 | ; cClipboardAll:=ClipboardAll
56 | clipSaver("c")
57 | whichClipboardNow:=1
58 | }
59 | else
60 | {
61 | Clipboard:=ClipboardOld
62 | }
63 | return
64 | }
65 |
66 | ; 删除当前行
67 | funcLogic_deleteCurLine()
68 | {
69 | ClipboardOld:=ClipboardAll
70 |
71 | Loop, 3
72 | {
73 | Clipboard:=""
74 | SendInput, ^{insert}
75 | ClipWait, 0.05
76 | selText:=Clipboard
77 | tmp:=Asc(selText)
78 | if(selText && tmp != 13)
79 | {
80 | SendInput, {bs}
81 | }
82 | SendInput,{End}+{home}
83 | }
84 | SendInput, {bs}
85 |
86 | Clipboard:=ClipboardOld
87 | return
88 | }
89 |
90 | ; 保存文件
91 | funcLogic_saveFile(){
92 | SendInput,^{s}
93 | Return
94 | }
95 |
96 | ; 搜索文件
97 | funcLogic_searchFile(){
98 | SendInput, ^{f}
99 | return
100 | }
101 |
102 | ; 左跳词
103 | funcLogic_jumpLeftWord(){
104 | SendInput,^{Left}
105 | return
106 | }
107 |
108 | ; 方向键 - 上
109 | funcLogic_moveUp(i:=1){
110 | global
111 | if(WinActive("ahk_id" . GuiHwnd))
112 | {
113 | ControlFocus, , ahk_id %LV_show_Hwnd%
114 | SendInput, {Up %i%}
115 | ControlFocus, , ahk_id %editHwnd%
116 | }
117 | else
118 | SendInput,{up %i%}
119 | Return
120 | }
121 |
122 | ; 方向键 - 下
123 | funcLogic_moveDown(i:=1){
124 | global
125 | if(WinActive("ahk_id" . GuiHwnd))
126 | {
127 | ControlFocus, , ahk_id %LV_show_Hwnd%
128 | SendInput, {Down %i%}
129 | ControlFocus, , ahk_id %editHwnd%
130 | }
131 | else
132 | SendInput,{down %i%}
133 | Return
134 | }
135 |
136 | ; 方向键 - 左
137 | funcLogic_moveLeft(){
138 | SendInput,{left}
139 | return
140 | }
141 |
142 | ; 方向键 - 右
143 | funcLogic_moveRight(){
144 | SendInput,{right}
145 | Return
146 | }
147 |
148 | ; 复制当前行到下一行
149 | funcLogic_copyLineDown(){
150 | tmpClipboard:=ClipboardAll
151 | Clipboard:=""
152 | SendInput,{home}+{End}^{c}
153 | ClipWait, 0.1
154 | SendInput,{end}{enter}+{insert}
155 | Sleep, 50
156 | Clipboard:=tmpClipboard
157 | return
158 | }
159 |
160 | ; 复制当前行到上一行
161 | funcLogic_CopyLineUp(){
162 | tmpClipboard:=ClipboardAll
163 | Clipboard:=""
164 | SendInput,{home}+{End}^{c}
165 | ClipWait, 0.1
166 | SendInput,{up}{end}{enter}+{insert}
167 | Sleep, 50
168 | Clipboard:=tmpClipboard
169 | Return
170 | }
171 |
172 | ; End
173 | funcLogic_end(){
174 | SendInput,{End}
175 | Return
176 | }
177 |
178 | ; ESC
179 | funcLogic_esc(){
180 | SendInput,{Esc}
181 | Return
182 | }
183 |
184 | ; 打开翻译界面
185 | funcLogic_OpenTranslate(){
186 | dictMiniClass:=CLSets.Dict.dictMiniClass
187 |
188 | if WinExist("ahk_class" . dictMiniClass)
189 | {
190 | SendInput,^!{m}
191 | }
192 |
193 | SendInput,^!{m}
194 | return
195 | }
196 |
197 | ; 注释当前行
198 | funcLogic_CommonLine(){
199 | SendInput,^{/}
200 | Return
201 | }
202 |
203 | ; Delete
204 | funcLogic_delete(){
205 | SendInput,{delete}
206 | Return
207 | }
208 |
209 | ; Home
210 | funcLogic_home(){
211 | SendInput,{Home}
212 | Return
213 | }
214 |
215 | ; 用粘贴板1粘贴
216 | funcLogic_paste1(){
217 | global
218 | if(CLsets.global.allowClipboard="0") ;禁用剪贴板功能
219 | {
220 | CapsLock2:=""
221 | return
222 | }
223 |
224 | if (whichClipboardNow!=1)
225 | {
226 | Clipboard:=cClipboardAll
227 | whichClipboardNow:=1
228 | }
229 | SendInput, ^{v}
230 | Return
231 | }
232 |
233 | ; 关闭当前长款
234 | funcLogic_closeCurWindow(){
235 | SendInput, ^{w}
236 | return
237 | }
238 |
239 | ; 剪切到粘贴板1
240 | funcLogic_cut1(){
241 | global
242 | if(CLsets.global.allowClipboard="0") ;禁用剪贴板功能
243 | {
244 | CapsLock2:=""
245 | return
246 | }
247 |
248 | ClipboardOld:=ClipboardAll
249 | Clipboard:=""
250 | SendInput, ^{x}
251 | ClipWait, 0.1
252 | if (ErrorLevel)
253 | {
254 | SendInput,{home}+{End}^{x}
255 | ClipWait, 0.1
256 | }
257 | if (!ErrorLevel)
258 | {
259 | ;cClipboardAll:=ClipboardAll
260 | clipSaver("c")
261 | whichClipboardNow:=1
262 | }
263 | else
264 | {
265 | Clipboard:=ClipboardOld
266 | }
267 | Return
268 | }
269 |
270 | ; 恢复
271 | funcLogic_recover(){
272 | SendInput, ^{y}
273 | return
274 | }
275 |
276 | ; 撤销
277 | funcLogic_undoRedo(){
278 | SendInput, ^{z}
279 | Return
280 | }
281 |
282 | ; CapsLock 开关
283 | funcLogic_capsLockOpen(){
284 | global
285 | if(CapslockOpen)
286 | {
287 | ; 已开启,则关闭
288 | SetCapsLockState, Off
289 | CapslockOpen:=false
290 | setSettings("Global","CapslockOpen",CapslockOpen)
291 | showMsg("CapsLock Off", 1000)
292 | }
293 | else
294 | {
295 | ; 已关闭,则打开
296 | SetCapsLockState, On
297 | SetCapsLockState, Off
298 | CapslockOpen:=true
299 | setSettings("Global","CapslockOpen",CapslockOpen)
300 | showMsg("CapsLock On", 1000)
301 | }
302 | return
303 | }
304 |
305 | ; 重载程序CapsLockPlus
306 | funcLogic_reload(){
307 | MsgBox, , , reload, 0.5
308 | Reload
309 | return
310 | }
311 |
312 | funcLogic_winbind_binding(n){
313 | global
314 | if(tapTimes[n]=="")
315 | initWinsInfos(n)
316 | tapTimes(n)
317 | return
318 | }
319 |
320 | ; 置顶 / 解除置顶一个窗口
321 | funcLogic_winPin(){
322 | _id:=WinExist("A")
323 | WinSet, AlwaysOnTop
324 | return
325 | }
326 |
327 | ; 激活编号中的窗口
328 | funcLogic_winbind_activate(n){
329 | global
330 | activateWinAction(n)
331 | return
332 | }
333 |
334 | ; 选择的内容用括号括起来
335 | funcLogic_doubleChar(char1,char2:=""){
336 | if(char2=="")
337 | {
338 | char2:=char1
339 | }
340 | charLen:=StrLen(char2)
341 | selText:=getSelText()
342 | ClipboardOld:=ClipboardAll
343 | if(selText)
344 | {
345 | Clipboard:=char1 . selText . char2
346 | SendInput, +{insert}
347 | }
348 | else
349 | {
350 | Clipboard:=char1 . char2
351 | SendInput, +{insert}{left %charLen%}
352 | }
353 | Sleep, 100
354 | Clipboard:=ClipboardOld
355 | Return
356 | }
357 |
358 | ; 右跳词
359 | funcLogic_jumpRightWord(){
360 | SendInput,^{Right}
361 | return
362 | }
363 |
364 | ; 向上新开一行
365 | funcLogic_enterUpWherever(){
366 | SendInput,{Up}{End}{Enter}
367 | Return
368 | }
369 |
370 | ; 所选内容用尖括号括起来
371 | funcLogic_doubleAngle(){
372 | funcLogic_doubleChar("<",">")
373 | return
374 | }
375 |
376 | ; Tab
377 | funcLogic_tab(){
378 | SendInput, {tab}
379 | return
380 | }
381 |
382 | ; 系统音量增加
383 | funcLogic_volumeUp(){
384 | SendInput, {Volume_Up}
385 | return
386 | }
387 |
388 | ; 系统音量减少
389 | funcLogic_volumeDown(){
390 | SendInput, {Volume_Down}
391 | return
392 | }
393 |
394 | funcLogic_OpenTranslatePanel(){
395 | openydTranslatePanel()
396 | return
397 | }
398 |
399 | ; 翻译剪切板里的内容
400 | funcLogic_translateWithClipboard(){
401 | global
402 | selText:=getSelText()
403 | if(selText)
404 | {
405 | ydTranslate(selText)
406 | }
407 | else
408 | {
409 | ClipboardOld:=ClipboardAll
410 | Clipboard:=""
411 | SendInput, ^{Left}^+{Right}^{insert}
412 | ClipWait, 0.05
413 | selText:=Clipboard
414 | ydTranslate(selText)
415 | Clipboard:=ClipboardOld
416 | }
417 |
418 | Return
419 | }
420 |
421 |
422 | funcLogic_getMousePosWinTitle(){
423 | GetMousePosWinTitle()
424 | return
425 | }
426 |
427 | ; 清空翻译界面
428 | funcLogic_clearTranslatePanel(){
429 | ControlSetText, , %MsgBoxStr%, ahk_id %transEditHwnd%
430 | ControlFocus, , ahk_id %transEditHwnd%
431 | WinShow, ahk_id %transGuiHwnd%
432 | return
433 | }
434 |
435 | ; 左跳词删除
436 | funcLogic_jumpBackspace(){
437 | SendInput,^{BackSpace}
438 | Return
439 | }
440 |
441 | ; 复制到粘贴板2
442 | funcLogic_copy2(){
443 | global
444 | if(CLsets.global.allowClipboard="0") ;禁用剪贴板功能
445 | {
446 | CapsLock2:=""
447 | return
448 | }
449 |
450 | ClipboardOld:=ClipboardAll
451 | Clipboard:=""
452 | SendInput, ^{insert}
453 | ClipWait, 0.1
454 | if (ErrorLevel)
455 | {
456 | SendInput,{home}+{End}^{insert}{End}
457 | ClipWait, 0.1
458 | }
459 | if (!ErrorLevel)
460 | {
461 | ; caClipboardAll:=ClipboardAll
462 | clipSaver("ca")
463 | whichClipboardNow:=2
464 | }
465 | else
466 | {
467 | Clipboard:=ClipboardOld
468 | }
469 | return
470 | }
471 |
472 | ; 当前光标选至左边
473 | funcLogic_selectWordLeft(){
474 | SendInput, +^{Left}
475 | return
476 | }
477 |
478 | ; 向上选择字
479 | funcLogic_UpSelectWord(){
480 | SendInput,+{Up}
481 | return
482 | }
483 |
484 | ; 向下选择字
485 | funcLogic_DownSelectWord(){
486 | SendInput,+{Down}
487 | return
488 | }
489 |
490 | ; 向左选择字
491 | funcLogic_LeftSelectWord(){
492 | SendInput,+{left}
493 | return
494 | }
495 |
496 | ; 向右选择字
497 | funcLogic_RightSelectWord(){
498 | SendInput,+{right}
499 | return
500 | }
501 |
502 | ; 选中文字切换为小写
503 | funcLogic_switchSelLowerCase(){
504 | SwitchSelCase("L")
505 | return
506 | }
507 |
508 | ; 选中文字切换为大写
509 | funcLogic_switchSelUpperCase(){
510 | SwitchSelCase("U")
511 | return
512 | }
513 |
514 | ; 选至行末
515 | funcLogic_selectEnd(){
516 | SendInput, +{End}
517 | return
518 | }
519 |
520 | ; 关闭翻译界面
521 | funcLogic_CloseTranslate(){
522 | dictMiniClass:=CLSets.Dict.dictMiniClass
523 |
524 | if WinExist("ahk_class" . dictMiniClass)
525 | {
526 | SendInput,^!{m}
527 | }
528 | return
529 | }
530 |
531 | ; 切换到下一个标签
532 | funcLogic_tabNext(){
533 | SendInput, ^{tab}
534 | return
535 | }
536 |
537 | ; 向右边跳词删除
538 | funcLogic_jumpDelete(){
539 | SendInput,^{delete}
540 | Return
541 | }
542 |
543 | ; 当前光标选至行首
544 | funcLogic_selectHome(){
545 | SendInput, +{Home}
546 | return
547 | }
548 |
549 | ; 从粘贴板2中粘贴
550 | funcLogic_paste2(){
551 | global
552 | if(CLsets.global.allowClipboard="0") ;禁用剪贴板功能
553 | {
554 | CapsLock2:=""
555 | return
556 | }
557 |
558 | if (whichClipboardNow!=2)
559 | {
560 | Clipboard:=caClipboardAll
561 | whichClipboardNow:=2
562 | }
563 | SendInput, ^{v}
564 | Return
565 | }
566 |
567 | ; 关闭当前窗口
568 | funcLogic_caps_alt_w(){
569 | CloseCurWindow()
570 | return
571 | }
572 |
573 | ; 剪切至粘贴板2
574 | funcLogic_cut2(){
575 | global
576 | if(CLsets.global.allowClipboard="0") ;禁用剪贴板功能
577 | {
578 | CapsLock2:=""
579 | return
580 | }
581 |
582 | ClipboardOld:=ClipboardAll
583 | Clipboard:=""
584 | SendInput, ^{x}
585 | ClipWait, 0.1
586 | if (ErrorLevel)
587 | {
588 | SendInput,{home}+{End}^{x}
589 | ClipWait, 0.1
590 | }
591 | if (!ErrorLevel)
592 | {
593 | ; caClipboardAll:=ClipboardAll
594 | clipSaver("ca")
595 | whichClipboardNow:=2
596 | }
597 | else
598 | {
599 | Clipboard:=ClipboardOld
600 | }
601 | Return
602 | }
603 |
604 | ; 选至行末
605 | funcLogic_selectWordRight(){
606 | SendInput, +^{Right}
607 | return
608 | }
609 |
610 | ; 向下新开行
611 | funcLogic_enterDownWherever(){
612 | SendInput,{End}{Enter}
613 | Return
614 | }
615 |
616 | ; 增加鼠标的灵敏度
617 | funcLogic_mouseSpeedIncrease(){
618 | global
619 | mouseSpeed+=1
620 | if(mouseSpeed>20)
621 | {
622 | mouseSpeed:=20
623 | }
624 | showMsg("mouse speed: " . mouseSpeed, 1000)
625 | setSettings("Global","mouseSpeed",mouseSpeed)
626 |
627 | DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, Ptr, mouseSpeed, UInt, 0)
628 | return
629 | }
630 |
631 | ; 降低鼠标的灵敏度
632 | funcLogic_mouseSpeedDecrease(){
633 | global
634 | mouseSpeed-=1
635 | if(mouseSpeed<1)
636 | {
637 | mouseSpeed:=1
638 | }
639 | showMsg("mouse speed: " . mouseSpeed, 1000)
640 | setSettings("Global","mouseSpeed",mouseSpeed)
641 |
642 | DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, Ptr, mouseSpeed, UInt, 0)
643 | return
644 | }
645 |
646 | ; 保存当前鼠标的灵敏度
647 | funcLogic_mouseSpeedRecord(){
648 | DllCall("SystemParametersInfo", UInt, 0x70, UInt, 0, UIntP, OrigMouseSpeed, UInt, 0)
649 | setSettings("Global","OrigMouseSpeed",OrigMouseSpeed)
650 | return
651 | }
652 |
653 | ; 将当前窗口移动到另外一个屏幕上
654 | funcLogic_putTheWindowToOtherScreen(){
655 | PutTheWindowToOtherScreen()
656 | return
657 | }
658 |
659 | ; 读取本地配置鼠标灵敏度
660 | funcLogic_mouseSpeedRecover(){
661 | OrigMouseSpeed:=CLSets.Global.OrigMouseSpeed!=""?CLSets.Global.OrigMouseSpeed:3
662 | DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, Ptr, OrigMouseSpeed, UInt, 0)
663 | setSettings("Global","mouseSpeed",OrigMouseSpeed)
664 | return
665 | }
666 |
667 | funcLogic_winTransparent(){
668 | winTransparent()
669 | }
670 |
671 | ;显示/隐藏任务栏
672 | funcLogic_setTaskBar(){
673 | VarSetCapacity( APPBARDATA, 36, 0 )
674 | IfWinNotExist, ahk_class Shell_TrayWnd
675 | {
676 | NumPut( (ABS_ALWAYSONTOP := 0x2), APPBARDATA, 32, "UInt" ) ;Enable "Always on top" (& disable auto-hide)
677 |
678 | DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
679 |
680 | WinShow ahk_class Shell_TrayWnd
681 | }
682 | else
683 | {
684 | NumPut( ( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" ) ;Disable "Always on top" (& enable auto-hide to hide Start button)
685 |
686 | DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
687 |
688 | WinHide ahk_class Shell_TrayWnd
689 | }
690 | Return
691 | }
692 |
693 | ; snippet
694 | funcLogic_tabScript(){
695 | tabAction()
696 | Return
697 | }
698 |
699 | funcLogic_getJSEvalString(){
700 | global
701 | ClipboardOld:=ClipboardAll
702 | Clipboard:=""
703 | SendInput, ^{insert} ;
704 | ClipWait, 0.1
705 | if(!ErrorLevel)
706 | {
707 | result:=escapeString(Clipboard)
708 | inputbox, result,,%lang_kf_getDebugText%,,,,,,,, % result
709 | if(!ErrorLevel)
710 | {
711 | Clipboard:=result
712 |
713 | return
714 | }
715 | }
716 | Sleep, 200
717 | Clipboard:=ClipboardOld
718 | return
719 | }
720 |
721 | funcLogic_pasteSystem(){
722 | global
723 |
724 | ; ;
725 | ; 禁止 OnClipboardChange 运行,防止 Clipboard:=sClipboardAll 重复执行,导致偶尔会粘贴出空白
726 | ; if(!CLsets.global.allowClipboard) ;禁用剪贴板功能
727 | ; {
728 | ; CapsLock2:=""
729 | ; return
730 | ; }
731 | if (whichClipboardNow!=0)
732 | {
733 | allowRunOnClipboardChange:=false
734 | Clipboard:=sClipboardAll
735 | whichClipboardNow:=0
736 | }
737 | SendInput, ^{v}
738 | return
739 | }
740 |
741 | ; 打开火萤主窗口
742 | funcLogic_HuoYingManScreen(){
743 | SendInput, ^!+{left}
744 | return
745 | }
746 |
747 | ; 打开火萤副窗口
748 | funcLogic_HuoYingSecondaryScreen(){
749 | SendInput, ^!+{right}
750 | return
751 | }
752 |
753 | ; funcLogic_test(){
754 | ; ahkPath:=%A_AhkPath%
755 | ; MsgBox, %ahkPath%
756 | ; ; FileCreateDir, Path
757 | ; return
758 | ; }
759 |
--------------------------------------------------------------------------------
/lib/lib_functions.ahk:
--------------------------------------------------------------------------------
1 | ;为了避免在IDE里Ctrl+C会复制一行,写个函数来获取
2 | getSelText_testVersion()
3 | {
4 | ClipboardOld:=ClipboardAll
5 | Clipboard:=""
6 | SendInput, +{Left}^{c}+{Right}
7 | ClipWait, 0.1
8 | if(!ErrorLevel)
9 | {
10 | selText:=Clipboard
11 | Clipboard:=ClipboardOld
12 | ;~ MsgBox, % "@" . Asc(selText) . "@"
13 | ;~ MsgBox, % StrLen(selText)
14 | if(Asc(selText)!=13&&StrLen(selText)>1)
15 | {
16 | return SubStr(selText, 2)
17 | }
18 | else
19 | {
20 | return
21 | }
22 | }
23 | Clipboard:=ClipboardOld
24 | return
25 | }
26 |
27 |
28 | getSelText()
29 | {
30 | ClipboardOld:=ClipboardAll
31 | Clipboard:=""
32 | SendInput, ^{insert}
33 | ClipWait, 0.1
34 | if(!ErrorLevel)
35 | {
36 | selText:=Clipboard
37 | Clipboard:=ClipboardOld
38 | StringRight, lastChar, selText, 1
39 | if(Asc(lastChar)!=10) ;如果最后一个字符是换行符,就认为是在IDE那复制了整行,不要这个结果
40 | {
41 | return selText
42 | }
43 | }
44 | Clipboard:=ClipboardOld
45 | return
46 | }
47 |
48 |
49 | UTF8encode(str) ;UTF8转码
50 | {
51 | SetFormat, integer, h
52 | returnStr:=""
53 | StrCap := StrPut(str, "CP65001")
54 | VarSetCapacity(UTF8String, StrCap)
55 | StrPut(str, &UTF8String, "CP65001")
56 |
57 | Loop, % StrCap - 1 ;StrPut 返回的长度中包含末尾的字符串截止符,因此必须减 1。
58 | {
59 | returnStr .= "%"SubStr(NumGet(UTF8String, A_Index - 1, "UChar"), 3) ; 逐字节获取,去除开头的“0x”后在前面加上"%"连接起来。
60 | }
61 | ;~ MsgBox, % returnStr ; 显示“E4B8AD”,前面附加“0x”就变成十六进制了。
62 | return returnStr
63 | }
64 |
65 | URLencode(str) ;用于链接的话只要符号转换就行。需要全部转换的,用UTF8encode()
66 | {
67 | local arr1:=["!","#","$","&","'","(",")","*","+",",",":",";","=","?","@","[","]"], ;"/",
68 | arr2:=["%21","%23","%24","%26","%27","%28","%29","%2a","%2b","%2c","%3a","%3b","%3d","%3f","%40","%5b","%5d"] ;"%2f",
69 |
70 | loop, % arr1.MaxIndex()
71 | {
72 | StringReplace, str, str, % arr1[A_Index], % arr2[A_Index], All
73 | }
74 | ; MsgBox, % str
75 | return str
76 | }
77 |
78 |
79 | checkStrType(str, fuzzy:=0)
80 | {
81 | if(!FileExist(str))
82 | {
83 | ; msgbox, % str
84 | if(RegExMatch(str,"iS)^((https?:\/\/)|www\.)([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?|(https?:\/\/)?([\da-z\.-]+)\.(com|net|org)(\W[\/\w \.-]*)*\/?$"))
85 | return "web"
86 | }
87 | if(RegExMatch(str, "i)^ftp://"))
88 | return "ftp"
89 | else
90 | {
91 | if(fuzzy)
92 | return "fileOrFolder"
93 | if(RegExMatch(str,"iS)^[a-z]:\\.+\..+$"))
94 | return "file"
95 | if(RegExMatch(str,"iS)^[a-z]:\\[^.]*$"))
96 | return "folder"
97 | }
98 | return "unknown"
99 | }
100 |
101 | ;winset, region窗口切割功能在放大了屏幕后(也就是dpi改变)不会改变,这里用来修复这个问题
102 | ; 100%dpi:96
103 | ; 125%dpi:120
104 | ; 150%dpi:144
105 | ; 200%dpi:192
106 | ; 250%dpi:240
107 | ; 300%dpi:288
108 | ; 400%dpi:384
109 | ; 500%dpi:480
110 | fixDpi(num)
111 | {
112 | ;msgbox, % Ceil(1/96*A_ScreenDPI)
113 | t:=Ceil(num/96*A_ScreenDPI)
114 | if(A_ScreenDPI>96 && A_ScreenDPI<=120) ;125%
115 | t+=1
116 | if(A_ScreenDPI>120 && A_ScreenDPI<=144) ;150
117 | t+=1
118 | if(A_ScreenDPI>144 && A_ScreenDPI<=192) ;200%
119 | t+=2
120 | if(A_ScreenDPI>192 && A_ScreenDPI<=240) ;250
121 | t+=3
122 | if(A_ScreenDPI>240 && A_ScreenDPI<=288) ;300%
123 | t+=4
124 | if(A_ScreenDPI>288) ; && A_ScreenDPI<=384 >=400%
125 | t+=6
126 | return t
127 | }
128 |
129 |
130 |
131 | ;保存设置到settings.ini
132 | setSettings(sec,key,val)
133 | {
134 | IniWrite, % val, CapsLockPlusSettings.ini, %sec%, % key
135 | }
136 |
137 | ;显示一个信息
138 | showMsg(msg,t:=2000)
139 | {
140 | ToolTip, % msg
141 | t:=-t
142 | settimer, clearToolTip, % t
143 | }
144 |
145 | clearToolTip:
146 | ToolTip
147 | return
148 |
149 |
150 | ;提取Set里QRun的信息
151 | ;返回文件路径,runStr为供run运行的字符串,ifAdmin是否管理员权限运行,param程序运行参数
152 | extractSetStr(str, ByRef runStr:="", ByRef ifAdmin:=false, ByRef param:="")
153 | {
154 | str:=Trim(str, " `t")
155 |
156 | ;如果有系统变量,替换成实际路径
157 | if(!RegExMatch(str, "^%(\w+)%", str0Match))
158 | RegExMatch(str, "(?<=(?:'|""))%(\w+)%", str0Match)
159 | if(str0Match1)
160 | {
161 | EnvGet, _t, % str0Match1
162 | StringReplace, str, str, % str0Match, % _t
163 | }
164 |
165 | ;没有引号且文件存在,例:C:\Program Files\Internet Explorer\iexplore.exe
166 | ;或者是ftp路径
167 | if(FileExist(str)||RegExMatch(str, "^ftp://"))
168 | {
169 | runStr:=str
170 | return str
171 | }
172 |
173 |
174 | ;有引号且文件存在,例:"C:\Program Files\Internet Explorer\iexplore.exe"
175 | RegExMatch(str, "^('|"")(.*)\1$", strMatch)
176 | if(FileExist(strMatch2)||RegExMatch(str, "^ftp://"))
177 | {
178 | runStr:=str
179 | return strMatch2
180 | }
181 |
182 | RegExMatch(str, "('|"")(.*)\1", strMatch)
183 | if(FileExist(strMatch2))
184 | {
185 | runStr:=strMatch
186 | ;判断是否管理员权限
187 | strArr:=StrSplit(str, strMatch)
188 | arr1:=Trim(strArr[1])
189 | arr2:=Trim(strArr[2])
190 |
191 | if(RegExMatch(arr1,"i)^\*RunAs$"))
192 | {
193 | ifAdmin:=true
194 | runStr:="*RunAs " . runStr
195 | }
196 | ;如果有参数
197 | if(arr2)
198 | {
199 | param:=arr2
200 | runStr:=runStr . " " . arr2
201 | }
202 | return strMatch2
203 | }
204 | return
205 | }
206 |
207 | alert(str)
208 | {
209 | msgbox, % str
210 | return
211 | }
212 |
213 | ;将set.ini里的QRun字符串转换成run使用的字符串
214 | ;如果文件(夹)不存在,会返回空
215 | set2Run(str)
216 | {
217 | runStr:=""
218 | extractSetStr(str, runStr)
219 | ; msgbox, % runStr
220 | return runStr
221 | }
222 |
223 | ;用来修复 excel 里复制一整行(列)会报错的问题
224 | ;弹出这个 gui 再进行赋值操作,然后回去
225 | foolGui(switch=1){
226 |
227 | if !switch
228 | {
229 | Gui, foolgui:Destroy
230 | return
231 | }
232 |
233 | Gui, foolgui: -Caption +E0x80000 +LastFound +OwnDialogs +Owner
234 | Gui, foolgui: Show, NA, foolgui
235 | WinActivate, foolgui
236 | }
237 |
238 | clipSaver(clipX)
239 | {
240 | global
241 | if(WinActive("ahk_exe EXCEL.EXE"))
242 | {
243 | foolgui()
244 | if(clipX="s")
245 | sClipboardAll:=ClipboardAll
246 | else if(clipX="c")
247 | cClipboardAll:=ClipboardAll
248 | else ; if(clipX="ca")
249 | caClipboardAll:=ClipboardAll
250 | foolgui(0)
251 | }
252 | else
253 | {
254 | if(clipX="s")
255 | sClipboardAll:=ClipboardAll
256 | else if(clipX="c")
257 | cClipboardAll:=ClipboardAll
258 | else ; if(clipX="ca")
259 | caClipboardAll:=ClipboardAll
260 | }
261 | }
262 |
263 | ;字符串中的特殊字符转义
264 | ; escapeCharForString(str){
265 | ; ; StringReplace, str, str, ``, ````, All
266 | ; ; StringReplace, str, str, ", `"`", All
267 | ; StringReplace, str, str, \", ", All
268 | ; StringReplace, str, str, \', ', All
269 | ; StringReplace, str, str, \\, \, All
270 |
271 | ; return str
272 | ; }
273 |
274 | ;运行函数字符串,被运行的函数的参数只接收字符串,参数分割按 CSV 方式
275 | ; 最多支持3个参数
276 | runFunc(str){
277 | ;如果只给了函数名,没有括号,当做是不传参直接调用函数
278 | if(!RegExMatch(Trim(str), "\)$"))
279 | {
280 | %str%()
281 | return
282 | }
283 | if(RegExMatch(str, "(\w+)\((.*)\)$", match))
284 | {
285 | func:=Func(match1)
286 |
287 | if(!match2)
288 | {
289 | func.()
290 | return
291 | }
292 | ; msgbox, % "match2" . match2
293 | ; pos := 1, params:=[]
294 | ; While pos := RegExMatch(match2, "(?:""((?:[^""\\]|\\.)*)"")|(?:'((?:[^'\\]|\\.)*)')", matchB, pos+StrLen(matchB))
295 | ; {
296 | ; if(matchB1)
297 | ; params.insert(matchB1)
298 | ; else if(match2)
299 | ; params.insert(matchB2)
300 | ; }
301 |
302 | ; parmasLen:=params.MaxIndex()
303 |
304 | params:={}
305 | loop, Parse, match2, CSV
306 | {
307 | params.insert(A_LoopField)
308 | }
309 |
310 | parmasLen:=params.MaxIndex()
311 |
312 | if(parmasLen==1)
313 | {
314 | func.(params[1])
315 | return
316 | }
317 | if(parmasLen==2)
318 | {
319 | func.(params[1],params[2])
320 | return
321 | }
322 | if(parmasLen==3)
323 | {
324 | func.(params[1],params[2],params[3])
325 | return
326 | }
327 | }
328 | }
329 |
330 |
331 |
332 |
333 | ; 例子: 当您按下 Win+C 时隐藏鼠标光标. 再次按下 Win+C 显示.
334 | ; 此脚本来自 www.autohotkey.com/forum/topic6107.html
335 | SystemCursor(OnOff:=1) ; 初始化 = "I","Init"; 隐藏 = 0,"Off"; 切换 = -1,"T","Toggle"; 显示 = 其他
336 | {
337 | static AndMask, XorMask, $, h_cursor
338 | ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; 系统指针
339 | , b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 ; 空白指针
340 | , h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13 ; 默认指针的句柄
341 | if (OnOff = "Init" or OnOff = "I" or $ = "") ; 在请求或首此调用时进行初始化
342 | {
343 | $ = h ; 活动的默认指针
344 | VarSetCapacity( h_cursor,4444, 1 )
345 | VarSetCapacity( AndMask, 32*4, 0xFF )
346 | VarSetCapacity( XorMask, 32*4, 0 )
347 | system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650
348 | StringSplit c, system_cursors, `,
349 | Loop %c0%
350 | {
351 | h_cursor := DllCall( "LoadCursor", "Ptr",0, "Ptr",c%A_Index% )
352 | h%A_Index% := DllCall( "CopyImage", "Ptr",h_cursor, "UInt",2, "Int",0, "Int",0, "UInt",0 )
353 | b%A_Index% := DllCall( "CreateCursor", "Ptr",0, "Int",0, "Int",0
354 | , "Int",32, "Int",32, "Ptr",&AndMask, "Ptr",&XorMask )
355 | }
356 | }
357 | if (OnOff = 0 or OnOff = "Off" or $ = "h" and (OnOff < 0 or OnOff = "Toggle" or OnOff = "T"))
358 | $ = b ; 使用空白指针
359 | else
360 | $ = h ; 使用保存的指针
361 |
362 | Loop %c0%
363 | {
364 | h_cursor := DllCall( "CopyImage", "Ptr",%$%%A_Index%, "UInt",2, "Int",0, "Int",0, "UInt",0 )
365 | DllCall( "SetSystemCursor", "Ptr",h_cursor, "UInt",c%A_Index% )
366 | }
367 | }
368 |
369 | ;激活迷你版有道词典,软件的mini激活快捷键Ctrl+Alt+M
370 | ActiveMiniDict(){
371 | if(CLSets.Dict.dictPath)
372 | {
373 | dictMiniClass:=CLSets.Dict.dictMiniClass
374 |
375 | if WinExist("ahk_class" . dictMiniClass)
376 | {
377 | SendInput,^!{m}
378 | }
379 |
380 | SendInput,^!{m}
381 | Sleep, 50
382 | content:=clipboard
383 |
384 | ; 如果剪切板里有内容的话
385 | if(content)
386 | {
387 | SendInput, +{Insert}{Enter}
388 | }
389 | }
390 | }
391 |
392 | GetMousePosWinTitle(){
393 |
394 | }
395 |
396 | ; 关闭提示窗口
397 | ShowToolTipPanel(){
398 | MouseGetPos, , , id, control
399 | WinGetClass, class, ahk_id %id%
400 | IfInString, class, tooltip
401 | {
402 | ToolTip
403 | return true
404 | }
405 | else
406 | {
407 | MouseGetPos, , , id, control
408 | WinGetTitle, title, ahk_id %id%
409 | WinGetClass, class, ahk_id %id%
410 | WinGet, pid, PID, ahk_id %id%
411 | WinGet, processName,ProcessName, ahk_id %id%
412 |
413 | tips := "AhkID:" . id . "`nAhkTitle:" . title . "`nAhkClass:" . class . "`nPID:" . pid . "`nProcessName:" . processName . "`nHWND:" . control
414 | ToolTip, %tips%
415 | }
416 | return false
417 | }
418 |
419 | ; 功能: 切换选中文字大小写
420 | ; 参数: Mode - 可以为 L (小写)、U (大写)、T (首字母大写)
421 | ;~ 兼容autohotkey 2.0
422 | SwitchSelCase(Mode) {
423 | clipBak := ClipboardAll ; 备份剪贴板
424 | Clipboard := "" ; 清空剪贴板
425 |
426 | SendInput, ^{insert}
427 | ClipWait, 0.1
428 | if (ErrorLevel)
429 | {
430 | SendInput,^{left}^+{right}^{insert}
431 | ClipWait, 0.1
432 | }
433 |
434 | if(!ErrorLevel)
435 | {
436 | selText := Clipboard
437 |
438 | if (selText != "") {
439 | Clipboard := ""
440 | Clipboard := Format("{:" Mode "}", selText)
441 | ClipWait, 1
442 | Send, ^v
443 | Sleep, 500 ; 防止没有粘贴完毕剪贴板就被恢复了
444 | }
445 | }
446 |
447 | Clipboard := clipBak ; 恢复剪贴板
448 | }
449 |
450 | ; 重新加载CapsLockPlusSettings.ini里的Keys键
451 | ReloadKeysSet(){
452 | global
453 | settingsModifyTime := -1
454 | Gosub, monitorSettingsFile
455 | return
456 | }
457 |
458 | DeleteCurLineLeftPart(){
459 | SendInput, +{home}{bs}
460 | return
461 | }
462 |
463 |
464 |
465 | DeleteCurLineRightPart(){
466 | SendInput, +{end}{bs}
467 | return
468 | }
469 |
470 | ; 创建虚拟界面
471 | CreateVirtualPanel(){
472 | SendInput, ^#{d}
473 | }
474 |
475 | ; 关闭当前虚拟界面
476 | CloseVirtualPanel(){
477 | SendInput, ^#{F4}
478 | }
479 |
480 | ; 转到上一个虚拟界面
481 | ChangeLastVirtualPanel(){
482 | SendInput, ^#{left}
483 | }
484 |
485 | ; 转到下一个虚拟界面
486 | ChangeNextVirtualPanel(){
487 | SendInput, ^#{right}
488 | }
489 |
490 | ; 关闭当前窗口
491 | CloseCurWindow(){
492 | SendInput, !{F4}
493 | }
494 |
495 | ; 向上翻页
496 | TurnPageUp(){
497 | SendInput, {PgUp}
498 | }
499 |
500 | ; 向下翻页
501 | TurnPageDown(){
502 | SendInput, {PgDn}
503 | }
504 |
505 | ; 向左切换标签页
506 | ChangeWindowLeft(){
507 | SendInput, ^{Tab}
508 | }
509 |
510 | ; 向右切换标签页
511 | ChangeWindowRight(){
512 | SendInput, ^+{Tab}
513 | }
514 |
515 | ; 将当前屏幕的窗口移动到另外一个屏幕
516 | PutTheWindowToOtherScreen(){
517 | SendInput, +#{Right}
518 | }
519 |
520 | ; 监听当前激活的窗口是否改变,是则更换对应当前窗口的热键
521 | MonitorProgressChange(){
522 | #Persistent
523 | SetTimer, OnPidChange, 500
524 | return
525 |
526 | ; 当进程ID改变时
527 | ; 如果CKeys的键值里有当前的PID,则重新对CLSets.Keys进行赋值
528 | OnPidChange:
529 | {
530 | curActiceWinID := WinExist("A")
531 | WinGet, pName, ProcessName, ahk_id %curActiceWinID%
532 |
533 | if (pName != null && pName != "" && pName != CurPName)
534 | {
535 | CurPName := pName
536 | if (CKeys[CurPName] != null && CLSets.Keys != null)
537 | {
538 | test:=CKeys[CurPName]
539 | For key, value in CKeys[CurPName]
540 | {
541 | if (CLSets.Keys[key])
542 | {
543 | CLSets.Keys[key] := value
544 | }
545 | }
546 | }
547 | else
548 | {
549 | gosub, keysResetDefault
550 | }
551 | }
552 | return
553 | }
554 | }
555 |
556 | ; 根据当前窗口创建Keys配置文件
557 | CreateKeysFile()
558 | {
559 | allKeysDirName := "AllKeys"
560 | scriptPath:=A_ScriptDir . "\" . allKeysDirName
561 |
562 | IfNotExist, %scriptPath%
563 | FileCreateDir, %allKeysDirName%
564 |
565 | curActiceWinID := WinExist("A") ;获取id
566 |
567 | if(curActiceWinID)
568 | {
569 | ; 程序标题
570 | WinGetTitle, curActiveWinTitle, ahk_id %curActiceWinID%
571 | ColorArray := StrSplit(curActiveWinTitle, " - ")
572 | progressName := null
573 | if(colorArray.MaxIndex() > 1)
574 | {
575 | progressName := ColorArray[ColorArray.MaxIndex()]
576 | }
577 | else
578 | {
579 | progressName := curActiveWinTitle
580 | }
581 | progressName := progressName . ".ini"
582 | progressPath := scriptPath . "\" . progressName
583 |
584 | IfNotExist %progressPath%
585 | {
586 | ; 程序进程ID
587 | WinGet, pName, ProcessName, ahk_id %curActiceWinID%
588 |
589 | fileTxt := "`n[FileInfos]`nProcessName=" . pName . "`n`n[Keys]`n"
590 |
591 | FileAppend, %fileTxt%, %progressPath%, UTF-8
592 | FileSetAttrib, +N, %progressPath%
593 | tips := "创建 [" . progressName . "] 成功"
594 | MsgBox, %tips%
595 | }
596 | else
597 | {
598 | tips := "配置文件 [" . progressName . "] 已经存在"
599 | MsgBox, %tips%
600 | }
601 | }
602 | else
603 | {
604 | MsgBox, 获取不了当前窗口的ahk_id
605 | }
606 | }
607 |
608 |
609 |
610 | ; 读取Keys配置文件
611 | ReadKeysFile(){
612 | allKeysDirName := "AllKeys"
613 | scriptPath:=A_ScriptDir . "\" . allKeysDirName
614 | sectionValue:=["FileInfos","Keys"]
615 |
616 | IfExist, %scriptPath%
617 | {
618 | Loop, %scriptPath%\*.ini
619 | {
620 | ; 读取每个Keys配置文件
621 | _tmpPName := 0
622 | for key, keyValue in sectionValue
623 | {
624 | ReadConfigFile(A_LoopFileFullPath, keyValue)
625 | }
626 | }
627 | }
628 | }
629 |
630 | global _tmpPName := null
631 |
632 | ; 读取每个Keys配置文件里的FileInfos和Keys,存入到CKeys中,以PID为键名,Keys为键值
633 | ReadConfigFile(fileName, sectionValue)
634 | {
635 | IniRead, contentValue, %fileName%, %sectionValue%, ,%A_Space%
636 |
637 | contentValue:=RegExReplace(contentValue, "m`n)=.*$")
638 | keyArr:=StrSplit(contentValue,"`n")
639 |
640 | for keyIndex,key in keyArr
641 | {
642 | IniRead, value, %fileName%, %sectionValue%, %key%, %A_Space%
643 | if (sectionValue == "FileInfos")
644 | {
645 | ; 以PID为键名,Keys为键值
646 | CKeys[value] := {}
647 | _tmpPName := value
648 | }
649 | else if (sectionValue == "Keys")
650 | {
651 | tips1:="Key:" . _tmpPName . "`nValue:" . value
652 | _clsetsSec := CKeys[_tmpPName]
653 | _clsetsSec[key] := value
654 | }
655 | }
656 | }
657 |
--------------------------------------------------------------------------------
/lib/lib_bindWins.ahk:
--------------------------------------------------------------------------------
1 | bindWinsInit:
2 | global winsInfos:={}
3 | global tapTimes:={1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0,19:0,20:0,btn:-1}
4 | global winTapedX ;winTapedX用于判断多窗口绑定的切换是哪个按键的,在CapsLock松开后winsSort()用来判定一次窗口在窗口组的位置
5 | global lastActiveWinId ;在用窗口激活时,现在正在激活状态的窗口id
6 | ;标志有没获取过窗口信息,因为判断多次敲击需要等待时间,
7 | ;超时了才执行绑定程序,在等待时间中唤醒绑定窗口会造成绑定失败,
8 | ;所以增加一个标志,当唤醒窗口时,标志不假则立刻执行一次绑定程序
9 | global gettingWinInfo:=0
10 |
11 | initWinsInfos(n)
12 | {
13 | winsInfos[n]:={}
14 | winsInfos[n].class:={}
15 | winsInfos[n].exe:={}
16 | winsInfos[n].id:={}
17 | return
18 | }
19 |
20 | IfNotExist, CapsLockPlusWinsInfosRecorder.ini
21 | {
22 | FileAppend, %lang_winsInfosRecorderIniInit%, CapsLockPlusWinsInfosRecorder.ini, UTF-16
23 | }
24 | lang_winsInfosRecorderIniInit:=""
25 |
26 | IniRead, infosSections, CapsLockPlusWinsInfosRecorder.ini, , , %A_Space%
27 | sectionArr:=StrSplit(infosSections,"`n")
28 | loop, % tapTimes.MaxIndex() ;+1:把索引从0开始换成1开始
29 | initWinsInfos(A_index)
30 | ; {
31 | ; _t:="group" . A_index-1 ;-1:把索引从1开始换成0开始
32 | ; winsInfos[_t]:={}
33 | ; winsInfos[_t].class:={}
34 | ; winsInfos[_t].exe:={}
35 | ; winsInfos[_t].id:={}
36 | ; }
37 | ;取出winsInfosRecorder.ini里的数据,数组存着
38 | for sectionKey,sectionValue in sectionArr
39 | {
40 | ;~ winsInfos[sectionValue].length:=0
41 | IniRead, infosKeys, CapsLockPlusWinsInfosRecorder.ini, %sectionValue%, , %A_Space%
42 | infosKeys:=RegExReplace(infosKeys, "m`n)=.*$")
43 | keyArr:=StrSplit(infosKeys,"`n")
44 | for key,keyValue in keyArr
45 | {
46 | IniRead, infos, CapsLockPlusWinsInfosRecorder.ini, %sectionValue%, %keyValue%, %A_Space%
47 | if(keyValue="bindType") ;如果是bindType则直接记录,否则是class,exe,id,再开多一维数组记录
48 | {
49 | winsInfos[sectionValue].bindType:=infos
50 | }
51 | else
52 | {
53 | ni:=StrSplit(keyValue, "_") ;name and id
54 | winsInfos[sectionValue][ni.1][ni.2]:=infos
55 | }
56 | }
57 | }
58 |
59 | return
60 | ;=function=start============================================================================
61 | getWinInfo(btnx, bindType)
62 | {
63 | winId:=WinExist("A") ;获取id
64 | WinGetClass, winClass, ahk_id %winId% ;获取该id窗口的class
65 | WinGet, winExe, ProcessPath, ahk_id %winId% ;获取该id窗口的path
66 | infosGx:=winsInfos[btnx] ;记录到窗口绑定变量
67 | if(bindType==1) ;如果是单窗口绑定
68 | {
69 | ;~ if(winId==infosGx.id.0) ;如果重复绑定,不执行
70 | ;~ return
71 | infosGx.bindType:=1
72 | infosGx.id.0:=winId
73 | infosGx.class.0:=winClass
74 | infosGx.exe.0:=winExe
75 | IfExist, CapsLockPlusWinsInfosRecorder.ini
76 | {
77 | IniWrite, 1, CapsLockPlusWinsInfosRecorder.ini, %btnx%, bindType ;写入bindType到ini
78 | IniWrite, %winClass%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_0 ;写入class到ini
79 | IniWrite, %winExe%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_0 ;写入path到ini
80 | IniWrite, %winId%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_0 ;写入id到ini
81 | }
82 | else
83 | {
84 | MsgBox, %lang_bw_noWIRini%
85 | return
86 | }
87 | loop, % infosGx.id.MaxIndex() ;除了第0个,其他都删掉
88 | {
89 | ;~ SendInput, % A_Index
90 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_%A_Index%
91 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_%A_Index%
92 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_%A_Index%
93 | infosGx.class.remove(1)
94 | infosGx.exe.remove(1)
95 | infosGx.id.remove(1)
96 | }
97 | ;~ infosGx.length:=1
98 | return
99 | }
100 |
101 | else if(bindType==2) ;如果多窗口绑定
102 | {
103 | if(infosGx.bindType==3 or infosGx.bindType==4) ;如果现在的绑定模式是3,先清空,再绑上第一个窗口
104 | {
105 | infosGx.class.0:=winClass
106 | infosGx.exe.0:=winExe
107 | infosGx.id.0:=winId
108 |
109 | IniWrite, %winClass%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_0 ;写入class到ini
110 | IniWrite, %winExe%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_0 ;写入path到ini
111 | IniWrite, %winId%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_0 ;写入id到ini
112 |
113 | loop, % infosGx.id.MaxIndex() ;除了第0个,其他都删掉
114 | {
115 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_%A_Index%
116 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_%A_Index%
117 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_%A_Index%
118 | infosGx.class.remove(1)
119 | infosGx.exe.remove(1)
120 | infosGx.id.remove(1)
121 | }
122 | infosGx.bindType:=1
123 | }
124 | else ;否则就是模式1或2,直接在现有窗口基础上添加就行
125 | {
126 | index:=infosGx.id.MaxIndex()+1
127 | loop, % index ;查重,如果是已有的窗口,不添加
128 | {
129 | if(winId==infosGx.id[A_Index-1])
130 | return
131 | }
132 | ;~ SendInput, % index
133 | infosGx.class.insert(winClass)
134 | infosGx.exe.insert(winExe)
135 | infosGx.id.insert(winId)
136 |
137 | IniWrite, %winClass%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_%index% ;写入class到ini
138 | IniWrite, %winExe%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_%index% ;写入path到ini
139 | IniWrite, %winId%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_%index% ;写入id到ini
140 |
141 | infosGx.bindType:=2
142 | }
143 | IniWrite, 2, CapsLockPlusWinsInfosRecorder.ini, %btnx%, bindType ;写入bindType到ini
144 | }
145 |
146 | else if(bindType==3) ;如果单程序全窗口绑定
147 | {
148 | infosGx.bindType:=3
149 | WinGet, winList, List, ahk_class %winClass% ahk_exe %winExe%
150 | uselessLength:=infosGx.id.MaxIndex()+1-winList ;多余无用的数据有多少条(原本的-新增的)
151 | infosGx.class.0:=winClass
152 | infosGx.exe.0:=winExe
153 | loop, % winList ;全部id分配到变量里
154 | {
155 | infosGx.id[A_Index-1]:=winList%A_Index%
156 | }
157 | IniWrite, %winClass%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_0 ;写入class到ini
158 | IniWrite, %winExe%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_0 ;写入path到ini
159 | loop, % winList ;全部id写到ini里, 不知道写入会不会造成程序等待,所以和分配变量分开两个loop进行
160 | {
161 | index:=A_Index-1
162 | IniWrite, % winList%A_Index%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_%index% ;写入id到ini
163 | }
164 | loop, % uselessLength ;除了前面刚刚写入的,其他有多的话都删掉
165 | {
166 | index:=winList+uselessLength-A_Index
167 | ;~ SendInput, % index
168 | infosGx.class.remove(index)
169 | infosGx.exe.remove(index)
170 | infosGx.id.remove(index)
171 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_%index%
172 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_%index%
173 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_%index%
174 | }
175 | IniWrite, 3, CapsLockPlusWinsInfosRecorder.ini, %btnx%, bindType ;写入bindType到ini
176 | ;~ infosGx.length:=winList
177 | }
178 | else if(bindType == 4)
179 | {
180 | if(infosGx.bindType<0)
181 | {
182 | ;当前没有绑定任何窗口,则设置bindType为1
183 | infosGx.bindType:=1
184 | infosGx.id.0:=winId
185 | infosGx.class.0:=winClass
186 | infosGx.exe.0:=winExe
187 | IfExist, CapsLockPlusWinsInfosRecorder.ini
188 | {
189 | IniWrite, 1, CapsLockPlusWinsInfosRecorder.ini, %btnx%, bindType ;写入bindType到ini
190 | IniWrite, %winClass%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_0 ;写入class到ini
191 | IniWrite, %winExe%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_0 ;写入path到ini
192 | IniWrite, %winId%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_0 ;写入id到ini
193 | }
194 | else
195 | {
196 | MsgBox, %lang_bw_noWIRini%
197 | return
198 | }
199 | }
200 | else
201 | {
202 | if(infosGx.bindType == 1 or infosGx.bindType == 2 or infosGx.bindType == 4)
203 | {
204 | ;如果bindType不是1,则执行bindType == 2
205 | index:=infosGx.id.MaxIndex()+1
206 | loop, % index ;查重,如果是已有的窗口,不添加
207 | {
208 | if(winId==infosGx.id[A_Index-1])
209 | return
210 | }
211 |
212 | loop, % index
213 | {
214 | tmp:=A_Index-1
215 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_%tmp%
216 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_%tmp%
217 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_%tmp%
218 | }
219 |
220 | ;~ SendInput, % index
221 | infosGx.class.insert(winClass)
222 | infosGx.exe.insert(winExe)
223 | infosGx.id.insert(winId)
224 |
225 | loop, % infosGx.id.MaxIndex()+1
226 | {
227 | tmp:=A_Index-1
228 |
229 | winClass:=infosGx.class[tmp]
230 | winExe:=infosGx.exe[tmp]
231 | winId:=infosGx.id[tmp]
232 |
233 | IniWrite, %winClass%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_%tmp% ;写入class到ini
234 | IniWrite, %winExe%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_%tmp% ;写入path到ini
235 | IniWrite, %winId%, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_%tmp% ;写入id到ini
236 | }
237 |
238 | infosGx.bindType:=4
239 | IniWrite, 4, CapsLockPlusWinsInfosRecorder.ini, %btnx%, bindType ;写入bindType到ini
240 |
241 | MsgBox,,,成功添加合并窗口,1
242 | return
243 | }
244 | }
245 | }
246 | return
247 | }
248 |
249 |
250 | activateWinAction(btnx)
251 | {
252 | ;如果正在获取窗口信息,立刻执行窗口绑定程序
253 | if(gettingWinInfo)
254 | gosub, doGetWinInfo
255 |
256 | infosGx:=winsInfos[btnx]
257 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;如果该按键上只绑了一个窗口
258 |
259 | if(infosGx.bindType==1)
260 | {
261 |
262 | tempId:=infosGx.id.0
263 | IfWinNotExist, ahk_id %tempId%
264 | {
265 | tempClass:=infosGx.class.0
266 | tempExe:=infosGx.exe.0
267 | WinGet, tempId, ID, ahk_exe %tempExe% ahk_class %tempClass%
268 | if(tempId)
269 | {
270 | IniWrite, %tempId%, CapsLockPlusWinsInfosRecorder.ini, % btnx , id_0
271 | }
272 | Else
273 | {
274 | IfExist, %tempExe%
275 | {
276 | Run, %tempExe%
277 | }
278 | Return
279 | }
280 | }
281 | IfWinActive, ahk_id %tempId%
282 | {
283 | WinMinimize, ahk_id %tempId%
284 | if(lastActiveWinId!="" && lastActiveWinId!=tempId)
285 | WinActivate, ahk_id %lastActiveWinId%
286 | return
287 | }
288 |
289 | lastActiveWinId:=WinExist("A")
290 | WinActivate, ahk_id %tempId%
291 | return
292 | }
293 | ;;;;;;;;;;;;如果该按键上绑了多个独立窗口
294 | if(infosGx.bindType==2)
295 | {
296 | winTapedX:=btnx ;将按下标记设置为当前按键
297 |
298 | ;变量中的窗口被关掉的清除掉
299 | maxIndex:=infosGx.id.MaxIndex()
300 | loop, % maxIndex+1
301 | {
302 | index:=maxIndex+1-A_Index
303 | tempId:=infosGx.id[index]
304 | IfWinNotExist, ahk_id %tempId%
305 | {
306 | infosGx.class.remove(index)
307 | infosGx.exe.remove(index)
308 | infosGx.id.remove(index)
309 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_%index%
310 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_%index%
311 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_%index%
312 | }
313 | }
314 |
315 | ;如果绑定组中只剩一个窗口,自动转换成bindType1
316 | if(infosGx.id.MaxIndex()=0)
317 | {
318 | IniWrite, 1, CapsLockPlusWinsInfosRecorder.ini, %btnx%, bindType ;写入bindType到ini
319 | infosGx.bindType:=1
320 | tempId:=infosGx.id.0
321 | IfWinActive, ahk_id %tempId%
322 | {
323 | WinMinimize, ahk_id %tempId%
324 | return
325 | }
326 | WinActivate, ahk_id %tempId%
327 | return
328 | }
329 |
330 | ;判断当前激活窗口id是否id组中的一个,是的话,激活它的下一个窗口,都不是的话,激活第一个
331 | actWinId:=WinExist("A")
332 | loop, % infosGx.id.MaxIndex()+1
333 | {
334 | if(infosGx.id[A_Index-1]=actWinId)
335 | {
336 | if(A_index-1=infosGx.id.MaxIndex()) ;如果最后一个窗口才是激活的,那就激活第一个窗口
337 | {
338 | tempId:=infosGx.id.0
339 | WinActivate, ahk_id %tempId%
340 | return
341 | }
342 | tempId:=infosGx.id[A_index]
343 | WinActivate, ahk_id %tempId%
344 | return
345 | }
346 | }
347 | tempId:=infosGx.id.0
348 | WinActivate, ahk_id %tempId%
349 | return
350 | }
351 |
352 | if(infosGx.bindType==3) ;如果该按键绑定了某程序所有窗口
353 | {
354 | winTapedX:=btnx ;将按下标记设置为当前按键
355 | tempClass:=infosGx.class.0
356 | tempExe:=infosGx.exe.0
357 |
358 | ;变量中的窗口被关掉的清除掉
359 | maxIndex:=infosGx.id.MaxIndex()
360 | loop, % maxIndex+1
361 | {
362 | index:=maxIndex+1-A_Index
363 | tempId:=infosGx.id[index]
364 | IfWinNotExist, ahk_id %tempId%
365 | {
366 | infosGx.id.remove(index)
367 | }
368 | }
369 |
370 | ;判断现有的某程序的窗口是否增加,有的话添加到变量中
371 | WinGet, winList, List, ahk_class %tempClass% ahk_exe %tempExe%
372 | loop, % winList
373 | {
374 | idx:=winList%A_index%
375 | isExist:=0
376 | loop, % infosGx.id.MaxIndex()+1
377 | {
378 | if(idx=infosGx.id[A_index-1])
379 | {
380 | isExist:=1
381 | break
382 | }
383 | }
384 | if(!isExist)
385 | {
386 | infosGx.id.insert(idx)
387 | }
388 | }
389 |
390 | ;如果当前没有该程序的任何窗口,启动程序
391 | if(infosGx.id.MaxIndex()="")
392 | {
393 | IfExist, %tempExe%
394 | {
395 | Run, %tempExe%
396 | }
397 | Return
398 | }
399 | ;if only one windows
400 | else if(infosGx.id.MaxIndex()=0)
401 | {
402 | tempId:=infosGx.id.0
403 | IfWinActive, ahk_id %tempId%
404 | {
405 | WinMinimize, ahk_id %tempId%
406 | return
407 | }
408 | WinActivate, ahk_id %tempId%
409 | return
410 | }
411 |
412 | ;判断当前激活窗口id是否id组中的一个,是的话,激活它的下一个窗口,都不是的话,激活第一个
413 | actWinId:=WinExist("A")
414 | loop, % infosGx.id.MaxIndex()+1
415 | {
416 | if(infosGx.id[A_Index-1]=actWinId)
417 | {
418 | if(A_index-1=infosGx.id.MaxIndex()) ;如果最后一个窗口才是激活的,那就激活第一个窗口
419 | {
420 | tempId:=infosGx.id.0
421 | WinActivate, ahk_id %tempId%
422 | return
423 | }
424 | tempId:=infosGx.id[A_index]
425 | WinActivate, ahk_id %tempId%
426 | return
427 | }
428 | }
429 | tempId:=infosGx.id.0
430 | WinActivate, ahk_id %tempId%
431 | return
432 | }
433 |
434 | ;;;;;;;;;;;;如果该按键上绑了多个并列窗口
435 | if(infosGx.bindType==4)
436 | {
437 | winTapedX:=btnx ;将按下标记设置为当前按键
438 |
439 | ;变量中的窗口被关掉的清除掉
440 | maxIndex:=infosGx.id.MaxIndex()
441 | loop, % maxIndex+1
442 | {
443 | index:=maxIndex+1-A_Index
444 | tempId:=infosGx.id[index]
445 | IfWinNotExist, ahk_id %tempId%
446 | {
447 | infosGx.class.remove(index)
448 | infosGx.exe.remove(index)
449 | infosGx.id.remove(index)
450 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, class_%index%
451 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, exe_%index%
452 | IniDelete, CapsLockPlusWinsInfosRecorder.ini, %btnx%, id_%index%
453 | }
454 | }
455 |
456 | ;如果绑定组中只剩一个窗口,自动转换成bindType1
457 | if(infosGx.id.MaxIndex()=0)
458 | {
459 | IniWrite, 1, CapsLockPlusWinsInfosRecorder.ini, %btnx%, bindType ;写入bindType到ini
460 | infosGx.bindType:=1
461 | tempId:=infosGx.id.0
462 | IfWinActive, ahk_id %tempId%
463 | {
464 | WinMinimize, ahk_id %tempId%
465 | return
466 | }
467 | WinActivate, ahk_id %tempId%
468 | return
469 | }
470 |
471 | isShowing:=0
472 | loop, % infosGx.id.MaxIndex()+1
473 | {
474 | tempId:=infosGx.id[A_index-1]
475 | IfWinActive, ahk_id %tempId%
476 | {
477 | isShowing:=isShowing+1
478 | }
479 | }
480 |
481 | maxIndex:=infosGx.id.MaxIndex()+1
482 | ;激活id组中的所有窗口
483 | loop, % maxIndex
484 | {
485 | tempId:=infosGx.id[A_index-1]
486 | If(isShowing>0)
487 | {
488 | WinMinimize, ahk_id %tempId%
489 | }
490 | else
491 | {
492 | WinActivate, ahk_id %tempId%
493 | }
494 | }
495 | return
496 | }
497 | }
498 |
499 | ;当放开CapsLock后,对窗口排序,当前激活的窗口排到窗口组的第一位
500 | winsSort(btnx)
501 | {
502 | infosGx:=winsInfos[btnx]
503 | loop, % infosGx.id.MaxIndex()+1
504 | {
505 | actWinId:=WinExist("A")
506 | if(infosGx.id[A_Index-1]=actWinId)
507 | {
508 | ;~ MsgBox, % infosGx.id[A_Index-1]
509 | infosGx.id.insert(0,infosGx.id.remove(A_index-1)) ;将当前激活窗口移到窗口组第一个
510 | }
511 | }
512 | winTapedX:=-1 ;重置标记
513 | return
514 | }
515 |
516 |
517 | tapTimes(btnx) ;判断敲击次数,绑定按键的入口函数,判断完敲击次数会调用doGetWinInfo,再调用getWinInfo
518 | {
519 | gettingWinInfo:=1
520 | SetTimer, doGetWinInfo, -500
521 | tapTimes.tapBtn:=btnx ;记录按下了哪个按键
522 | if(tapTimes["btn" . btnx]<1)
523 | {
524 | tapTimes["btn" . btnx]:=1
525 | }
526 | if(A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 500)
527 | {
528 | if(tapTimes["btn" . btnx]<2)
529 | {
530 | tapTimes["btn" . btnx]:=2
531 | }
532 | else if(tapTimes["btn" . btnx]<3)
533 | {
534 | tapTimes["btn" . btnx]:=3
535 | }
536 | else
537 | {
538 | tapTimes["btn" . btnx]:=4
539 | }
540 | }
541 | return
542 | }
543 |
544 |
545 |
546 | doGetWinInfo:
547 | SetTimer, doGetWinInfo, Off
548 | winBtnx:=tapTimes.tapBtn
549 | tTapTimesx:=tapTimes["btn" . winBtnx]
550 | if(tTapTimesx>0&&winBtnx>-1)
551 | {
552 | getWinInfo(winBtnx, tTapTimesx)
553 | ;~ SendInput, % winBtnx . "@" . tTapTimesx0@2
554 | }
555 | tapTimes["btn" . winBtnx]:=0 ;重置敲击次数
556 | tapTimes.tapBtn:=-1 ;重置winBtnx
557 | gettingWinInfo:=0
558 | return
559 |
560 | ;=function=end============================================================================
--------------------------------------------------------------------------------
/CapsLockPlus.ahk:
--------------------------------------------------------------------------------
1 | ; if not A_IsAdmin ;running by administrator
2 | ; {
3 | ; Run *RunAs "%A_ScriptFullPath%"
4 | ; ExitApp
5 | ; }
6 |
7 |
8 | IfExist, CapsLockPlusIcon.ico
9 | {
10 | ;freezing icon
11 | menu, TRAY, Icon, CapsLockPlusIcon.ico, , 1
12 | }
13 | Menu, Tray, Icon,,, 1
14 |
15 |
16 |
17 | global CLversion:="Version: 2.7.0.0 | 2016-11-30`n`nCopyright 2016 Chen JunKai"
18 |
19 | global cClipboardAll ;CapsLockPlus clipboard
20 | global caClipboardAll ;CapsLockPlusalt clipboard
21 | global sClipboardAll ;system clipboard
22 | global whichClipboardNow ;0 system clipboard; 1 CapsLockPlus clipboard; 2 CapsLockPlusalt clipboard
23 | ; global clipSaveArr=[]
24 | allowRunOnClipboardChange:=true
25 |
26 |
27 | #Include lib
28 | #Include lib_init.ahk ;The beginning of all things
29 |
30 | ; language
31 | #include ..\language\lang_func.ahk
32 | #include ..\language\Simplified_Chinese.ahk
33 | ; #include ..\language\Traditional_Chinese.ahk
34 | ; #include ..\language\English.ahk
35 | ; /language
36 |
37 | #include lib_settings.ahk ;get the settings from CapsLockPlusSettings.ini
38 | #include lib_keysFunction.ahk
39 | #include lib_keysSet.ahk
40 | ; #include lib_ahkExec.ahk
41 | ; #include lib_scriptDemo.ahk
42 | ; #include lib_fileMethods.ahk
43 |
44 |
45 | #Include lib_clQ.ahk ;CapsLockPlusQ
46 | #Include lib_ydTrans.ahk ;CapsLockPlusT translate
47 | #Include lib_clTab.ahk
48 | #Include lib_functions.ahk ;public functions
49 | #Include lib_keysFunLogic.ahk ;public functions logic
50 | #Include lib_bindWins.ahk ;CapsLockPlus` 1~8, windows bind
51 | #Include lib_winJump.ahk
52 | #Include lib_winTransparent.ahk
53 | #Include lib_mouseSpeed.ahk
54 | #Include lib_mathBoard.ahk
55 | #include lib_loadAnimation.ahk
56 |
57 |
58 | ;change dir
59 | #include ..\userAHK
60 | #include *i UserKeySet.ahk
61 |
62 | #MaxHotkeysPerInterval 500
63 | #NoEnv
64 | ; #WinActivateForce
65 | Process Priority,,High
66 |
67 | start:
68 |
69 | ;-----------------START-----------------
70 | global ctrlZ, CapsLock2, CapsLock , CapsLockOpen
71 |
72 | CapsLockOpen:=CLSets.Global.CapslockOpen!=""?CLSets.Global.CapslockOpen:true
73 |
74 | Capslock::
75 | ;ctrlZ: CapsLockPlusZ undo / redo flag
76 | ;Capslock: Capslock 键状态标记,按下是1,松开是0
77 | ;Capslock2: 是否使用过 CapsLockPlus 功能标记,使用过会清除这个变量
78 | ctrlZ:=CapsLock2:=CapsLock:=1
79 |
80 | SetTimer, setCapsLock2, -300 ; 300ms 犹豫操作时间
81 |
82 | KeyWait, Capslock
83 | CapsLock:="" ;Capslock最优先置空,来关闭 CapsLockPlus 功能的触发
84 | if CapsLock2
85 | {
86 | if (CapslockOpen)
87 | SetCapsLockState, % GetKeyState("CapsLock","T") ? "Off" : "On"
88 | }
89 | CapsLock2:=""
90 |
91 | ;
92 | if(winTapedX!=-1)
93 | {
94 | winsSort(winTapedX)
95 | }
96 |
97 | Return
98 |
99 | setCapsLock2:
100 | CapsLock2:=""
101 | return
102 |
103 | OnClipboardChange: ; 剪贴板内容改变时将运行
104 |
105 | ; 如果有复制操作时,capslock键没有按下,那就是系统原生复制
106 | if (allowRunOnClipboardChange && !CapsLock && CLsets.global.allowClipboard != "0")
107 | {
108 | clipSaver("s")
109 | whichClipboardNow:=0
110 | }
111 | allowRunOnClipboardChange:=true
112 | return
113 |
114 | ;----------------------------keys-set-start-----------------------------
115 |
116 | #if CLsets.global.allowClipboard != "0"
117 | $^v::
118 | try
119 | funcLogic_pasteSystem()
120 | return
121 | #if
122 |
123 | #If CapsLock ;when capslock key press and hold
124 |
125 | ; ================= CapsLock + Key ... Start =================
126 | {
127 | ; ========= A ~ Z,0~9,F1~F12 ... Start
128 | {
129 | a::
130 | b::
131 | c::
132 | d::
133 | e::
134 | f::
135 | g::
136 | h::
137 | i::
138 | j::
139 | k::
140 | l::
141 | n::
142 | m::
143 | o::
144 | p::
145 | q::
146 | r::
147 | s::
148 | t::
149 | u::
150 | v::
151 | w::
152 | x::
153 | y::
154 | z::
155 | 1::
156 | 2::
157 | 3::
158 | 4::
159 | 5::
160 | 6::
161 | 7::
162 | 8::
163 | 9::
164 | 0::
165 | f1::
166 | f2::
167 | f3::
168 | f4::
169 | f5::
170 | f6::
171 | f7::
172 | f8::
173 | f9::
174 | f10::
175 | f11::
176 | f12::
177 | try
178 | runFunc(keyset["caps_" . A_ThisHotkey])
179 | Capslock2:=""
180 | Return
181 | }
182 | ; === A ~ Z,0~9,F1~F12 ... End
183 |
184 |
185 | ; ========= 其他符号 ... Start
186 | {
187 | `::
188 | try
189 | runFunc(keyset.caps_backquote)
190 | Capslock2:=""
191 | return
192 |
193 | -::
194 | try
195 | runFunc(keyset.caps_minus)
196 | Capslock2:=""
197 | return
198 |
199 | =::
200 | try
201 | runFunc(keyset.caps_equal)
202 | Capslock2:=""
203 | Return
204 |
205 | backspace::
206 | try
207 | runFunc(keyset.caps_backspace)
208 | Capslock2:=""
209 | Return
210 |
211 | tab::
212 | try
213 | runFunc(keyset.caps_tab)
214 | Capslock2:=""
215 | Return
216 |
217 | [::
218 | try
219 | runFunc(keyset.caps_leftSquareBracket)
220 | Capslock2:=""
221 | Return
222 |
223 | ]::
224 | try
225 | runFunc(keyset.caps_rightSquareBracket)
226 | Capslock2:=""
227 | Return
228 |
229 | \::
230 | try
231 | runFunc(keyset.caps_backslash)
232 | Capslock2:=""
233 | return
234 |
235 | `;::
236 | try
237 | runFunc(keyset.caps_semicolon)
238 | Capslock2:=""
239 | Return
240 |
241 | '::
242 | try
243 | runFunc(keyset.caps_quote)
244 | Capslock2:=""
245 | return
246 |
247 | enter::
248 | try
249 | runFunc(keyset.caps_enter)
250 | Capslock2:=""
251 | Return
252 |
253 | ,::
254 | try
255 | runFunc(keyset.caps_comma)
256 | Capslock2:=""
257 | Return
258 |
259 | .::
260 | try
261 | runFunc(keyset.caps_dot)
262 | Capslock2:=""
263 | return
264 |
265 | /::
266 | try
267 | runFunc(keyset.caps_slash)
268 | Capslock2:=""
269 | Return
270 |
271 | space::
272 | try
273 | runFunc(keyset.caps_space)
274 | Capslock2:=""
275 | Return
276 | }
277 | ; === 其他符号 ... End
278 |
279 |
280 | ; ========= 鼠标操作 ... Start
281 | {
282 | WheelUp::
283 | try
284 | runFunc(keyset.caps_wheelUp)
285 | Capslock2:=""
286 | return
287 |
288 | WheelDown::
289 | try
290 | runFunc(keyset.caps_wheelDown)
291 | Capslock2:=""
292 | return
293 |
294 | MButton::
295 | try
296 | runFunc(keyset.caps_midButton)
297 | Capslock2:=""
298 | return
299 |
300 | ~LButton::
301 | try
302 | runFunc(keyset.caps_leftButton)
303 | Capslock2:=""
304 | return
305 |
306 | ~RButton::
307 | try
308 | runFunc(keyset.caps_rightButton)
309 | Capslock2:=""
310 | return
311 | }
312 | ; === 鼠标操作 ... End
313 | }
314 | ; ================= CapsLock + Key ... End =================
315 |
316 |
317 | ; ================= CapsLock + Alt + Key ... Start =================
318 | {
319 | ; ========= A ~ Z,0~9,F1~F12 ... Start
320 | {
321 | !a::
322 | !b::
323 | !c::
324 | !d::
325 | !e::
326 | !f::
327 | !g::
328 | !h::
329 | !i::
330 | !j::
331 | !k::
332 | !l::
333 | !n::
334 | !m::
335 | !o::
336 | !p::
337 | !q::
338 | !r::
339 | !s::
340 | !t::
341 | !u::
342 | !v::
343 | !w::
344 | !x::
345 | !y::
346 | !z::
347 | !1::
348 | !2::
349 | !3::
350 | !4::
351 | !5::
352 | !6::
353 | !7::
354 | !8::
355 | !9::
356 | !0::
357 | !f1::
358 | !f2::
359 | !f3::
360 | !f4::
361 | !f5::
362 | !f6::
363 | !f7::
364 | !f8::
365 | !f9::
366 | !f10::
367 | !f11::
368 | !f12::
369 | try
370 | StringTrimLeft, OutputVar, A_ThisHotkey, 1
371 | runFunc(keyset["caps_alt_" . OutputVar])
372 | Capslock2:=""
373 | Return
374 | }
375 | ; === A ~ Z,0~9,F1~F12 ... End
376 |
377 |
378 | ; ========= 其他符号 ... Start
379 | {
380 | !`::
381 | try
382 | runFunc(keyset.caps_alt_backquote)
383 | Capslock2:=""
384 | return
385 |
386 | !-::
387 | try
388 | runFunc(keyset.caps_alt_minus)
389 | Capslock2:=""
390 | return
391 |
392 | !=::
393 | try
394 | runFunc(keyset.caps_alt_equal)
395 | Capslock2:=""
396 | Return
397 |
398 | !backspace::
399 | try
400 | runFunc(keyset.caps_alt_backspace)
401 | Capslock2:=""
402 | Return
403 |
404 | !tab::
405 | try
406 | runFunc(keyset.caps_alt_tab)
407 | Capslock2:=""
408 | Return
409 |
410 | ![::
411 | try
412 | runFunc(keyset.caps_alt_leftSquareBracket)
413 | Capslock2:=""
414 | Return
415 |
416 | !]::
417 | try
418 | runFunc(keyset.caps_alt_rightSquareBracket)
419 | Capslock2:=""
420 | Return
421 |
422 | !\::
423 | try
424 | runFunc(keyset.caps_alt_backslash)
425 | Capslock2:=""
426 | return
427 |
428 | !`;::
429 | try
430 | runFunc(keyset.caps_alt_semicolon)
431 | Capslock2:=""
432 | Return
433 |
434 | !'::
435 | try
436 | runFunc(keyset.caps_alt_quote)
437 | Capslock2:=""
438 | return
439 |
440 | !enter::
441 | try
442 | runFunc(keyset.caps_alt_enter)
443 | Capslock2:=""
444 | Return
445 |
446 | !,::
447 | try
448 | runFunc(keyset.caps_alt_comma)
449 | Capslock2:=""
450 | Return
451 |
452 | !.::
453 | try
454 | runFunc(keyset.caps_alt_dot)
455 | Capslock2:=""
456 | return
457 |
458 | !/::
459 | try
460 | runFunc(keyset.caps_alt_slash)
461 | Capslock2:=""
462 | Return
463 |
464 | !space::
465 | try
466 | runFunc(keyset.caps_alt_space)
467 | Capslock2:=""
468 | Return
469 | }
470 | ; === 其他符号 ... End
471 |
472 |
473 | ; ========= 鼠标操作 ... Start
474 | {
475 | !WheelUp::
476 | try
477 | runFunc(keyset.caps_alt_wheelUp)
478 | Capslock2:=""
479 | return
480 |
481 | !WheelDown::
482 | try
483 | runFunc(keyset.caps_alt_wheelDown)
484 | Capslock2:=""
485 | return
486 |
487 | !MButton::
488 | try
489 | runFunc(keyset.caps_alt_midButton)
490 | Capslock2:=""
491 | return
492 |
493 | !~LButton::
494 | try
495 | runFunc(keyset.caps_alt_leftButton)
496 | Capslock2:=""
497 | return
498 |
499 | !~RButton::
500 | try
501 | runFunc(keyset.caps_alt_rightButton)
502 | Capslock2:=""
503 | return
504 | }
505 | ; === 鼠标操作 ... End
506 | }
507 | ; ================= CapsLock + Alt + Key ... End =================
508 |
509 |
510 | ; ================= CapsLock + Shift + Key ... Start =================
511 | {
512 | ; ========= A ~ Z,0~9,F1~F12 ... Start
513 | {
514 | +a::
515 | +b::
516 | +c::
517 | +d::
518 | +e::
519 | +f::
520 | +g::
521 | +h::
522 | +i::
523 | +j::
524 | +k::
525 | +l::
526 | +n::
527 | +m::
528 | +o::
529 | +p::
530 | +q::
531 | +r::
532 | +s::
533 | +t::
534 | +u::
535 | +v::
536 | +w::
537 | +x::
538 | +y::
539 | +z::
540 | +1::
541 | +2::
542 | +3::
543 | +4::
544 | +5::
545 | +6::
546 | +7::
547 | +8::
548 | +9::
549 | +0::
550 | +f1::
551 | +f2::
552 | +f3::
553 | +f4::
554 | +f5::
555 | +f6::
556 | +f7::
557 | +f8::
558 | +f9::
559 | +f10::
560 | +f11::
561 | +f12::
562 | try
563 | StringTrimLeft, OutputVar, A_ThisHotkey, 1
564 | runFunc(keyset["caps_shift_" . OutputVar])
565 | Capslock2:=""
566 | Return
567 | }
568 | ; === A ~ Z,0~9,F1~F12 ... End
569 |
570 |
571 | ; ========= 其他符号 ... Start
572 | {
573 | +`::
574 | try
575 | runFunc(keyset.caps_shift_backquote)
576 | Capslock2:=""
577 | return
578 |
579 | +-::
580 | try
581 | runFunc(keyset.caps_shift_minus)
582 | Capslock2:=""
583 | return
584 |
585 | +=::
586 | try
587 | runFunc(keyset.caps_shift_equal)
588 | Capslock2:=""
589 | Return
590 |
591 | +backspace::
592 | try
593 | runFunc(keyset.caps_shift_backspace)
594 | Capslock2:=""
595 | Return
596 |
597 | +tab::
598 | try
599 | runFunc(keyset.caps_shift_tab)
600 | Capslock2:=""
601 | Return
602 |
603 | +[::
604 | try
605 | runFunc(keyset.caps_shift_leftSquareBracket)
606 | Capslock2:=""
607 | Return
608 |
609 | +]::
610 | try
611 | runFunc(keyset.caps_shift_rightSquareBracket)
612 | Capslock2:=""
613 | Return
614 |
615 | +\::
616 | try
617 | runFunc(keyset.caps_shift_backslash)
618 | Capslock2:=""
619 | return
620 |
621 | +`;::
622 | try
623 | runFunc(keyset.caps_shift_semicolon)
624 | Capslock2:=""
625 | Return
626 |
627 | +'::
628 | try
629 | runFunc(keyset.caps_shift_quote)
630 | Capslock2:=""
631 | return
632 |
633 | +enter::
634 | try
635 | runFunc(keyset.caps_shift_enter)
636 | Capslock2:=""
637 | Return
638 |
639 | +,::
640 | try
641 | runFunc(keyset.caps_shift_comma)
642 | Capslock2:=""
643 | Return
644 |
645 | +.::
646 | try
647 | runFunc(keyset.caps_shift_dot)
648 | Capslock2:=""
649 | return
650 |
651 | +/::
652 | try
653 | runFunc(keyset.caps_shift_slash)
654 | Capslock2:=""
655 | Return
656 |
657 | +space::
658 | try
659 | runFunc(keyset.caps_shift_space)
660 | Capslock2:=""
661 | Return
662 | }
663 | ; === 其他符号 ... End
664 |
665 |
666 | ; ========= 鼠标操作 ... Start
667 | {
668 | +WheelUp::
669 | try
670 | runFunc(keyset.caps_shift_wheelUp)
671 | Capslock2:=""
672 | return
673 |
674 | +WheelDown::
675 | try
676 | runFunc(keyset.caps_shift_wheelDown)
677 | Capslock2:=""
678 | return
679 |
680 | +MButton::
681 | try
682 | runFunc(keyset.caps_shift_midButton)
683 | Capslock2:=""
684 | return
685 |
686 | +~LButton::
687 | try
688 | runFunc(keyset.caps_shift_leftButton)
689 | Capslock2:=""
690 | return
691 |
692 | +~RButton::
693 | try
694 | runFunc(keyset.caps_shift_rightButton)
695 | Capslock2:=""
696 | return
697 | }
698 | ; === 鼠标操作 ... End
699 | }
700 | ; ================= CapsLock + Shift + Key ... End =================
701 |
702 |
703 |
704 | ; ================= CapsLock + Ctrl + Key ... Start =================
705 | {
706 | ; ========= A ~ Z,0~9,F1~F12 ... Start
707 | {
708 | ^a::
709 | ^b::
710 | ^c::
711 | ^d::
712 | ^e::
713 | ^f::
714 | ^g::
715 | ^h::
716 | ^i::
717 | ^j::
718 | ^k::
719 | ^l::
720 | ^n::
721 | ^m::
722 | ^o::
723 | ^p::
724 | ^q::
725 | ^r::
726 | ^s::
727 | ^t::
728 | ^u::
729 | ^v::
730 | ^w::
731 | ^x::
732 | ^y::
733 | ^z::
734 | ^1::
735 | ^2::
736 | ^3::
737 | ^4::
738 | ^5::
739 | ^6::
740 | ^7::
741 | ^8::
742 | ^9::
743 | ^0::
744 | ^f1::
745 | ^f2::
746 | ^f3::
747 | ^f4::
748 | ^f5::
749 | ^f6::
750 | ^f7::
751 | ^f8::
752 | ^f9::
753 | ^f10::
754 | ^f11::
755 | ^f12::
756 | try
757 | StringTrimLeft, OutputVar, A_ThisHotkey, 1
758 | runFunc(keyset["caps_ctrl_" . OutputVar])
759 | Capslock2:=""
760 | Return
761 | }
762 | ; === A ~ Z,0~9,F1~F12 ... End
763 |
764 |
765 | ; ========= 其他符号 ... Start
766 | {
767 | ^`::
768 | try
769 | runFunc(keyset.caps_ctrl_backquote)
770 | Capslock2:=""
771 | return
772 |
773 | ^-::
774 | try
775 | runFunc(keyset.caps_ctrl_minus)
776 | Capslock2:=""
777 | return
778 |
779 | ^=::
780 | try
781 | runFunc(keyset.caps_ctrl_equal)
782 | Capslock2:=""
783 | Return
784 |
785 | ^backspace::
786 | try
787 | runFunc(keyset.caps_ctrl_backspace)
788 | Capslock2:=""
789 | Return
790 |
791 | ^tab::
792 | try
793 | runFunc(keyset.caps_ctrl_tab)
794 | Capslock2:=""
795 | Return
796 |
797 | ^[::
798 | try
799 | runFunc(keyset.caps_ctrl_leftSquareBracket)
800 | Capslock2:=""
801 | Return
802 |
803 | ^]::
804 | try
805 | runFunc(keyset.caps_ctrl_rightSquareBracket)
806 | Capslock2:=""
807 | Return
808 |
809 | ^\::
810 | try
811 | runFunc(keyset.caps_ctrl_backslash)
812 | Capslock2:=""
813 | return
814 |
815 | ^`;::
816 | try
817 | runFunc(keyset.caps_ctrl_semicolon)
818 | Capslock2:=""
819 | Return
820 |
821 | ^'::
822 | try
823 | runFunc(keyset.caps_ctrl_quote)
824 | Capslock2:=""
825 | return
826 |
827 | ^enter::
828 | try
829 | runFunc(keyset.caps_ctrl_enter)
830 | Capslock2:=""
831 | Return
832 |
833 | ^,::
834 | try
835 | runFunc(keyset.caps_ctrl_comma)
836 | Capslock2:=""
837 | Return
838 |
839 | ^.::
840 | try
841 | runFunc(keyset.caps_ctrl_dot)
842 | Capslock2:=""
843 | return
844 |
845 | ^/::
846 | try
847 | runFunc(keyset.caps_ctrl_slash)
848 | Capslock2:=""
849 | Return
850 |
851 | ^space::
852 | try
853 | runFunc(keyset.caps_ctrl_space)
854 | Capslock2:=""
855 | Return
856 | }
857 | ; === 其他符号 ... End
858 |
859 |
860 | ; ========= 鼠标操作 ... Start
861 | {
862 | ^WheelUp::
863 | try
864 | runFunc(keyset.caps_ctrl_wheelUp)
865 | Capslock2:=""
866 | return
867 |
868 | ^WheelDown::
869 | try
870 | runFunc(keyset.caps_ctrl_wheelDown)
871 | Capslock2:=""
872 | return
873 |
874 | ^MButton::
875 | try
876 | runFunc(keyset.caps_ctrl_midButton)
877 | Capslock2:=""
878 | return
879 |
880 | ^~LButton::
881 | try
882 | runFunc(keyset.caps_ctrl_leftButton)
883 | Capslock2:=""
884 | return
885 |
886 | ^~RButton::
887 | try
888 | runFunc(keyset.caps_ctrl_rightButton)
889 | Capslock2:=""
890 | return
891 | }
892 | ; === 鼠标操作 ... End
893 | }
894 | ; ================= CapsLock + Ctrl + Key ... End =================
895 |
896 | #If
897 |
898 | GuiClose:
899 | GuiEscape:
900 | Gui, Cancel
901 | return
902 |
--------------------------------------------------------------------------------
/lib/lib_keysFunction.ahk:
--------------------------------------------------------------------------------
1 | ; ================= CapsLock + Key ... Start =================
2 | {
3 | ; ========= A ~ Z ... Start
4 | {
5 | keyFunc_a(){
6 | funcLogic_backspace()
7 | return
8 | }
9 |
10 | keyFunc_b(){
11 | funcLogic_drivePop()
12 | return
13 | }
14 |
15 | keyFunc_c(){
16 | funcLogic_copy1()
17 | return
18 | }
19 |
20 | keyFunc_d(){
21 | funcLogic_deleteCurLine()
22 | return
23 | }
24 |
25 | keyFunc_e(){
26 | funcLogic_SaveFile()
27 | return
28 | }
29 |
30 | keyFunc_f(){
31 | funcLogic_searchFile()
32 | return
33 | }
34 |
35 | ; 空
36 | keyFunc_g(){
37 | return
38 | }
39 |
40 | keyFunc_h(){
41 | funcLogic_jumpLeftWord()
42 | return
43 | }
44 |
45 | keyFunc_i(){
46 | funcLogic_moveUp()
47 | return
48 | }
49 |
50 | keyFunc_j(){
51 | funcLogic_moveLeft()
52 | return
53 | }
54 |
55 | keyFunc_k(){
56 | funcLogic_moveDown()
57 | return
58 | }
59 |
60 | keyFunc_l(){
61 | funcLogic_moveRight()
62 | return
63 | }
64 |
65 | keyFunc_m(){
66 | funcLogic_copyLineDown()
67 | return
68 | }
69 |
70 | keyFunc_n(){
71 | funcLogic_CopyLineUp()
72 | return
73 | }
74 |
75 | keyFunc_o(){
76 | funcLogic_end()
77 | return
78 | }
79 |
80 | keyFunc_p(){
81 | funcLogic_esc()
82 | return
83 | }
84 |
85 | keyFunc_q(){
86 | funcLogic_OpenTranslatePanel()
87 | return
88 | }
89 |
90 | keyFunc_r(){
91 | funcLogic_CommonLine()
92 | return
93 | }
94 |
95 | keyFunc_s(){
96 | funcLogic_delete()
97 | return
98 | }
99 |
100 | keyFunc_t(){
101 | funcLogic_translateWithClipboard()
102 | return
103 | }
104 |
105 | keyFunc_u(){
106 | funcLogic_home()
107 | return
108 | }
109 |
110 | keyFunc_v(){
111 | funcLogic_paste1()
112 | return
113 | }
114 |
115 | keyFunc_w(){
116 | funcLogic_closeCurWindow()
117 | return
118 | }
119 |
120 | keyFunc_x(){
121 | funcLogic_cut1()
122 | return
123 | }
124 |
125 | keyFunc_y(){
126 | funcLogic_recover()
127 | return
128 | }
129 |
130 | keyFunc_z(){
131 | funcLogic_undoRedo()
132 | return
133 | }
134 |
135 | }
136 | ; === A ~ Z ... End
137 |
138 |
139 | ; ========= F1 ~ F12 ... Start
140 | {
141 | keyFunc_f1(){
142 | return
143 | }
144 |
145 | keyFunc_f2(){
146 | return
147 | }
148 |
149 | keyFunc_f3(){
150 | return
151 | }
152 |
153 | keyFunc_f4(){
154 | return
155 | }
156 |
157 | keyFunc_f5(){
158 | return
159 | }
160 |
161 | keyFunc_f6(){
162 | return
163 | }
164 |
165 | keyFunc_f7(){
166 | return
167 | }
168 |
169 | keyFunc_f8(){
170 | return
171 | }
172 |
173 | keyFunc_f9(){
174 | CreateKeysFile()
175 | return
176 | }
177 |
178 | keyFunc_f10(){
179 | funcLogic_capsLockOpen()
180 | return
181 | }
182 |
183 | keyFunc_f11(){
184 | funcLogic_reload()
185 | return
186 | }
187 |
188 | keyFunc_f12(){
189 | funcLogic_winPin()
190 | return
191 | }
192 | }
193 | ; === F1 ~ F12 ... End
194 |
195 |
196 | ; ========= 0 ~ 9 ... Start
197 | {
198 | keyFunc_0(){
199 | return
200 | }
201 |
202 | keyFunc_1(){
203 | funcLogic_winbind_activate(1)
204 | return
205 | }
206 |
207 | keyFunc_2(){
208 | funcLogic_winbind_activate(2)
209 | return
210 | }
211 |
212 | keyFunc_3(){
213 | funcLogic_winbind_activate(3)
214 | return
215 | }
216 |
217 | keyFunc_4(){
218 | funcLogic_winbind_activate(4)
219 | return
220 | }
221 |
222 | keyFunc_5(){
223 | funcLogic_winbind_activate(5)
224 | return
225 | }
226 |
227 | keyFunc_6(){
228 | funcLogic_winbind_activate(6)
229 | return
230 | }
231 |
232 | keyFunc_7(){
233 | funcLogic_winbind_activate(7)
234 | return
235 | }
236 |
237 | keyFunc_8(){
238 | funcLogic_winbind_activate(8)
239 | return
240 | }
241 |
242 | keyFunc_9(){
243 | funcLogic_doubleChar("(",")")
244 | return
245 | }
246 | }
247 | ; === 0 ~ 9 ... End
248 |
249 |
250 | ; ========= 其他符号 ... Start
251 | {
252 | keyFunc_backquote(){
253 | funcLogic_winbind_activate(9)
254 | return
255 | }
256 |
257 | keyFunc_minus(){
258 | return
259 | }
260 |
261 | keyFunc_equal(){
262 | return
263 | }
264 |
265 | keyFunc_backspace(){
266 | return
267 | }
268 |
269 | keyFunc_tab(){
270 | return
271 | }
272 |
273 | keyFunc_leftSquareBracket(){
274 | funcLogic_doubleChar("{","}")
275 | return
276 | }
277 |
278 | keyFunc_rightSquareBracket(){
279 | funcLogic_doubleChar("[","]")
280 | return
281 | }
282 |
283 | keyFunc_backslash(){
284 | return
285 | }
286 |
287 | keyFunc_semicolon(){
288 | funcLogic_jumpRightWord()
289 | return
290 | }
291 |
292 | keyFunc_quote(){
293 | funcLogic_doubleChar("""""""","""""""")
294 | return
295 | }
296 |
297 | keyFunc_enter(){
298 | funcLogic_enterUpWherever()
299 | return
300 | }
301 |
302 | keyFunc_comma(){
303 | funcLogic_doubleAngle()
304 | return
305 | }
306 |
307 | keyFunc_dot(){
308 | return
309 | }
310 |
311 | keyFunc_slash(){
312 | return
313 | }
314 |
315 | keyFunc_space(){
316 | global
317 | IfWinExist, ahk_id %transGuiHwnd%
318 | {
319 | funcLogic_clearTranslatePanel()
320 | }
321 | else
322 | {
323 | funcLogic_tab()
324 | }
325 | return
326 | }
327 | }
328 | ; === 其他符号 ... End
329 |
330 |
331 | ; ========= 鼠标操作 ... Start
332 | {
333 | keyFunc_wheelUp(){
334 | funcLogic_volumeUp()
335 | return
336 | }
337 |
338 | keyFunc_wheelDown(){
339 | funcLogic_volumeDown()
340 | return
341 | }
342 |
343 | keyFunc_midButton(){
344 | return
345 | }
346 |
347 | keyFunc_leftButton(){
348 | return
349 | }
350 |
351 | keyFunc_rightButton(){
352 | return
353 | }
354 |
355 | }
356 | ; === 鼠标操作 ... End
357 | }
358 | ; ================= CapsLock + Key ... End =================
359 |
360 |
361 |
362 | ; ================= CapsLock + Alt + Key ... Start =================
363 | {
364 | ; ========= A ~ Z ... Start
365 | {
366 | keyFunc_alt_a(){
367 | funcLogic_jumpBackspace()
368 | return
369 | }
370 |
371 | keyFunc_alt_b(){
372 | return
373 | }
374 |
375 | keyFunc_alt_c(){
376 | funcLogic_copy2()
377 | return
378 | }
379 |
380 | keyFunc_alt_d(){
381 | return
382 | }
383 |
384 | keyFunc_alt_e(){
385 | return
386 | }
387 |
388 | keyFunc_alt_f(){
389 | return
390 | }
391 |
392 | keyFunc_alt_g(){
393 | return
394 | }
395 |
396 | keyFunc_alt_h(){
397 | funcLogic_selectWordLeft()
398 | return
399 | }
400 |
401 | keyFunc_alt_i(){
402 | funcLogic_UpSelectWord()
403 | return
404 | }
405 |
406 | keyFunc_alt_j(){
407 | funcLogic_LeftSelectWord()
408 | return
409 | }
410 |
411 | keyFunc_alt_k(){
412 | funcLogic_DownSelectWord()
413 | return
414 | }
415 |
416 | keyFunc_alt_l(){
417 | funcLogic_RightSelectWord()
418 | return
419 | }
420 |
421 | keyFunc_alt_m(){
422 | funcLogic_switchSelLowerCase()
423 | return
424 | }
425 |
426 | keyFunc_alt_n(){
427 | funcLogic_switchSelUpperCase()
428 | return
429 | }
430 |
431 | keyFunc_alt_o(){
432 | funcLogic_selectEnd()
433 | return
434 | }
435 |
436 | keyFunc_alt_p(){
437 | return
438 | }
439 |
440 | keyFunc_alt_q(){
441 | return
442 | }
443 |
444 | keyFunc_alt_r(){
445 | return
446 | }
447 |
448 | keyFunc_alt_s(){
449 | funcLogic_jumpDelete()
450 | return
451 | }
452 |
453 | keyFunc_alt_t(){
454 | return
455 | }
456 |
457 | keyFunc_alt_u(){
458 | funcLogic_selectHome()
459 | return
460 | }
461 |
462 | keyFunc_alt_v(){
463 | funcLogic_paste2()
464 | return
465 | }
466 |
467 | keyFunc_alt_w(){
468 | funcLogic_caps_alt_w()
469 | return
470 | }
471 |
472 | keyFunc_alt_x(){
473 | funcLogic_cut2()
474 | return
475 | }
476 |
477 | keyFunc_alt_y(){
478 | return
479 | }
480 |
481 | keyFunc_alt_z(){
482 | return
483 | }
484 |
485 | }
486 | ; === A ~ Z ... End
487 |
488 |
489 | ; ========= F1 ~ F12 ... Start
490 | {
491 | keyFunc_alt_f1(){
492 | return
493 | }
494 |
495 | keyFunc_alt_f2(){
496 | return
497 | }
498 |
499 | keyFunc_alt_f3(){
500 | return
501 | }
502 |
503 | keyFunc_alt_f4(){
504 | return
505 | }
506 |
507 | keyFunc_alt_f5(){
508 | return
509 | }
510 |
511 | keyFunc_alt_f6(){
512 | return
513 | }
514 |
515 | keyFunc_alt_f7(){
516 | return
517 | }
518 |
519 | keyFunc_alt_f8(){
520 | return
521 | }
522 |
523 | keyFunc_alt_f9(){
524 | return
525 | }
526 |
527 | keyFunc_alt_f10(){
528 | return
529 | }
530 |
531 | keyFunc_alt_f11(){
532 | return
533 | }
534 |
535 | keyFunc_alt_f12(){
536 | return
537 | }
538 | }
539 | ; === F1 ~ F12 ... End
540 |
541 |
542 | ; ========= 0 ~ 9 ... Start
543 | {
544 | keyFunc_alt_0(){
545 | return
546 | }
547 |
548 | keyFunc_alt_1(){
549 | funcLogic_winbind_binding(1)
550 | return
551 | }
552 |
553 | keyFunc_alt_2(){
554 | funcLogic_winbind_binding(2)
555 | return
556 | }
557 |
558 | keyFunc_alt_3(){
559 | funcLogic_winbind_binding(3)
560 | return
561 | }
562 |
563 | keyFunc_alt_4(){
564 | funcLogic_winbind_binding(4)
565 | return
566 | }
567 |
568 | keyFunc_alt_5(){
569 | funcLogic_winbind_binding(5)
570 | return
571 | }
572 |
573 | keyFunc_alt_6(){
574 | funcLogic_winbind_binding(6)
575 | return
576 | }
577 |
578 | keyFunc_alt_7(){
579 | funcLogic_winbind_binding(7)
580 | return
581 | }
582 |
583 | keyFunc_alt_8(){
584 | funcLogic_winbind_binding(8)
585 | return
586 | }
587 |
588 | keyFunc_alt_9(){
589 | return
590 | }
591 | }
592 | ; === 0 ~ 9 ... End
593 |
594 |
595 | ; ========= 其他符号 ... Start
596 | {
597 | keyFunc_alt_backquote(){
598 | funcLogic_winbind_binding(9)
599 | return
600 | }
601 |
602 | keyFunc_alt_minus(){
603 | return
604 | }
605 |
606 | keyFunc_alt_equal(){
607 | return
608 | }
609 |
610 | keyFunc_alt_backspace(){
611 | return
612 | }
613 |
614 | keyFunc_alt_tab(){
615 | return
616 | }
617 |
618 | keyFunc_alt_leftSquareBracket(){
619 | return
620 | }
621 |
622 | keyFunc_alt_rightSquareBracket(){
623 | return
624 | }
625 |
626 | keyFunc_alt_backslash(){
627 | return
628 | }
629 |
630 | keyFunc_alt_semicolon(){
631 | funcLogic_selectWordRight()
632 | return
633 | }
634 |
635 | keyFunc_alt_quote(){
636 | return
637 | }
638 |
639 | keyFunc_alt_enter(){
640 | funcLogic_enterDownWherever()
641 | return
642 | }
643 |
644 | keyFunc_alt_comma(){
645 | return
646 | }
647 |
648 | keyFunc_alt_dot(){
649 | return
650 | }
651 |
652 | keyFunc_alt_slash(){
653 | return
654 | }
655 |
656 | keyFunc_alt_space(){
657 | return
658 | }
659 |
660 |
661 | }
662 | ; === 其他符号 ... End
663 |
664 |
665 | ; ========= 鼠标操作 ... Start
666 | {
667 |
668 | keyFunc_alt_wheelUp(){
669 | funcLogic_mouseSpeedIncrease()
670 | return
671 | }
672 |
673 | keyFunc_alt_wheelDown(){
674 | funcLogic_mouseSpeedDecrease()
675 | return
676 | }
677 |
678 | keyFunc_alt_midButton(){
679 | funcLogic_mouseSpeedRecord()
680 | return
681 | }
682 |
683 | keyFunc_alt_leftButton(){
684 | funcLogic_putTheWindowToOtherScreen()
685 | return
686 | }
687 |
688 | keyFunc_alt_rightButton(){
689 | return
690 | }
691 |
692 | }
693 |
694 | ; === 鼠标操作 ... End
695 | }
696 | ; ================= CapsLock + Alt + Key ... End =================
697 |
698 |
699 |
700 | ; ================= CapsLock + Shift + Key ... Start =================
701 | {
702 | ; ========= A ~ Z ... Start
703 | {
704 | keyFunc_shift_a(){
705 | DeleteCurLineLeftPart()
706 | return
707 | }
708 |
709 | keyFunc_shift_b(){
710 | return
711 | }
712 |
713 | keyFunc_shift_c(){
714 | return
715 | }
716 |
717 | keyFunc_shift_d(){
718 | return
719 | }
720 |
721 | keyFunc_shift_e(){
722 | ChangeNextVirtualPanel()
723 | return
724 | }
725 |
726 | keyFunc_shift_f(){
727 | return
728 | }
729 |
730 | keyFunc_shift_g(){
731 | return
732 | }
733 |
734 | keyFunc_shift_h(){
735 | return
736 | }
737 |
738 | keyFunc_shift_i(){
739 | TurnPageUp()
740 | return
741 | }
742 |
743 | keyFunc_shift_j(){
744 | ChangeWindowLeft()
745 | return
746 | }
747 |
748 | keyFunc_shift_k(){
749 | TurnPageDown()
750 | return
751 | }
752 |
753 | keyFunc_shift_l(){
754 | ChangeWindowRight()
755 | return
756 | }
757 |
758 | keyFunc_shift_m(){
759 | return
760 | }
761 |
762 | keyFunc_shift_n(){
763 | return
764 | }
765 |
766 | keyFunc_shift_o(){
767 | return
768 | }
769 |
770 | keyFunc_shift_p(){
771 | return
772 | }
773 |
774 | keyFunc_shift_q(){
775 | ChangeLastVirtualPanel()
776 | return
777 | }
778 |
779 | keyFunc_shift_r(){
780 | CreateVirtualPanel()
781 | return
782 | }
783 |
784 | keyFunc_shift_s(){
785 | DeleteCurLineRightPart()
786 | return
787 | }
788 |
789 | keyFunc_shift_t(){
790 | return
791 | }
792 |
793 | keyFunc_shift_u(){
794 | return
795 | }
796 |
797 | keyFunc_shift_v(){
798 | return
799 | }
800 |
801 | keyFunc_shift_w(){
802 | CloseVirtualPanel()
803 | return
804 | }
805 |
806 | keyFunc_shift_x(){
807 | return
808 | }
809 |
810 | keyFunc_shift_y(){
811 | return
812 | }
813 |
814 | keyFunc_shift_z(){
815 | return
816 | }
817 |
818 | }
819 | ; === A ~ Z ... End
820 |
821 |
822 | ; ========= F1 ~ F12 ... Start
823 | {
824 | keyFunc_shift_f1(){
825 | return
826 | }
827 |
828 | keyFunc_shift_f2(){
829 | return
830 | }
831 |
832 | keyFunc_shift_f3(){
833 | return
834 | }
835 |
836 | keyFunc_shift_f4(){
837 | return
838 | }
839 |
840 | keyFunc_shift_f5(){
841 | return
842 | }
843 |
844 | keyFunc_shift_f6(){
845 | return
846 | }
847 |
848 | keyFunc_shift_f7(){
849 | return
850 | }
851 |
852 | keyFunc_shift_f8(){
853 | return
854 | }
855 |
856 | keyFunc_shift_f9(){
857 | return
858 | }
859 |
860 | keyFunc_shift_f10(){
861 | return
862 | }
863 |
864 | keyFunc_shift_f11(){
865 | return
866 | }
867 |
868 | keyFunc_shift_f12(){
869 | return
870 | }
871 | }
872 | ; === F1 ~ F12 ... End
873 |
874 |
875 | ; ========= 0 ~ 9 ... Start
876 | {
877 | keyFunc_shift_0(){
878 | return
879 | }
880 |
881 | keyFunc_shift_1(){
882 | return
883 | }
884 |
885 | keyFunc_shift_2(){
886 | return
887 | }
888 |
889 | keyFunc_shift_3(){
890 | return
891 | }
892 |
893 | keyFunc_shift_4(){
894 | return
895 | }
896 |
897 | keyFunc_shift_5(){
898 | return
899 | }
900 |
901 | keyFunc_shift_6(){
902 | return
903 | }
904 |
905 | keyFunc_shift_7(){
906 | return
907 | }
908 |
909 | keyFunc_shift_8(){
910 | return
911 | }
912 |
913 | keyFunc_shift_9(){
914 | return
915 | }
916 | }
917 | ; === 0 ~ 9 ... End
918 |
919 |
920 | ; ========= 其他符号 ... Start
921 | {
922 |
923 | keyFunc_shift_backquote(){
924 | return
925 | }
926 |
927 | keyFunc_shift_minus(){
928 | return
929 | }
930 |
931 | keyFunc_shift_equal(){
932 | return
933 | }
934 |
935 | keyFunc_shift_backspace(){
936 | return
937 | }
938 |
939 | keyFunc_shift_tab(){
940 | return
941 | }
942 |
943 | keyFunc_shift_leftSquareBracket(){
944 | return
945 | }
946 |
947 | keyFunc_shift_rightSquareBracket(){
948 | return
949 | }
950 |
951 | keyFunc_shift_backslash(){
952 | return
953 | }
954 |
955 | keyFunc_shift_semicolon(){
956 | return
957 | }
958 |
959 | keyFunc_shift_quote(){
960 | return
961 | }
962 |
963 | keyFunc_shift_enter(){
964 | return
965 | }
966 |
967 | keyFunc_shift_comma(){
968 | return
969 | }
970 |
971 | keyFunc_shift_dot(){
972 | return
973 | }
974 |
975 | keyFunc_shift_slash(){
976 | return
977 | }
978 |
979 | keyFunc_shift_space(){
980 | return
981 | }
982 |
983 | }
984 | ; === 其他符号 ... End
985 |
986 |
987 | ; ========= 鼠标操作 ... Start
988 | {
989 |
990 | keyFunc_shift_wheelUp(){
991 | return
992 | }
993 |
994 | keyFunc_shift_wheelDown(){
995 | return
996 | }
997 |
998 | keyFunc_shift_midButton(){
999 | return
1000 | }
1001 |
1002 | keyFunc_shift_leftButton(){
1003 | ShowToolTipPanel()
1004 | return
1005 | }
1006 |
1007 | keyFunc_shift_rightButton(){
1008 | return
1009 | }
1010 |
1011 | }
1012 | ; === 鼠标操作 ... End
1013 | }
1014 | ; ================= CapsLock + Shift + Key ... End =================
1015 |
1016 |
1017 |
1018 | ; ================= CapsLock + Ctrl + Key ... Start =================
1019 | {
1020 | ; ========= A ~ Z ... Start
1021 | {
1022 | keyFunc_ctrl_a(){
1023 | return
1024 | }
1025 |
1026 | keyFunc_ctrl_b(){
1027 | return
1028 | }
1029 |
1030 | keyFunc_ctrl_c(){
1031 | return
1032 | }
1033 |
1034 | keyFunc_ctrl_d(){
1035 | return
1036 | }
1037 |
1038 | keyFunc_ctrl_e(){
1039 | return
1040 | }
1041 |
1042 | keyFunc_ctrl_f(){
1043 | return
1044 | }
1045 |
1046 | keyFunc_ctrl_g(){
1047 | return
1048 | }
1049 |
1050 | keyFunc_ctrl_h(){
1051 | return
1052 | }
1053 |
1054 | keyFunc_ctrl_i(){
1055 | return
1056 | }
1057 |
1058 | keyFunc_ctrl_j(){
1059 | return
1060 | }
1061 |
1062 | keyFunc_ctrl_k(){
1063 | return
1064 | }
1065 |
1066 | keyFunc_ctrl_l(){
1067 | return
1068 | }
1069 |
1070 | keyFunc_ctrl_m(){
1071 | return
1072 | }
1073 |
1074 | keyFunc_ctrl_n(){
1075 | return
1076 | }
1077 |
1078 | keyFunc_ctrl_o(){
1079 | return
1080 | }
1081 |
1082 | keyFunc_ctrl_p(){
1083 | return
1084 | }
1085 |
1086 | keyFunc_ctrl_q(){
1087 | return
1088 | }
1089 |
1090 | keyFunc_ctrl_r(){
1091 | return
1092 | }
1093 |
1094 | keyFunc_ctrl_s(){
1095 | return
1096 | }
1097 |
1098 | keyFunc_ctrl_t(){
1099 | return
1100 | }
1101 |
1102 | keyFunc_ctrl_u(){
1103 | return
1104 | }
1105 |
1106 | keyFunc_ctrl_v(){
1107 | return
1108 | }
1109 |
1110 | keyFunc_ctrl_w(){
1111 | return
1112 | }
1113 |
1114 | keyFunc_ctrl_x(){
1115 | return
1116 | }
1117 |
1118 | keyFunc_ctrl_y(){
1119 | return
1120 | }
1121 |
1122 | keyFunc_ctrl_z(){
1123 | return
1124 | }
1125 |
1126 | }
1127 | ; === A ~ Z ... End
1128 |
1129 |
1130 | ; ========= F1 ~ F12 ... Start
1131 | {
1132 | keyFunc_ctrl_f1(){
1133 | return
1134 | }
1135 |
1136 | keyFunc_ctrl_f2(){
1137 | return
1138 | }
1139 |
1140 | keyFunc_ctrl_f3(){
1141 | return
1142 | }
1143 |
1144 | keyFunc_ctrl_f4(){
1145 | return
1146 | }
1147 |
1148 | keyFunc_ctrl_f5(){
1149 | return
1150 | }
1151 |
1152 | keyFunc_ctrl_f6(){
1153 | return
1154 | }
1155 |
1156 | keyFunc_ctrl_f7(){
1157 | return
1158 | }
1159 |
1160 | keyFunc_ctrl_f8(){
1161 | return
1162 | }
1163 |
1164 | keyFunc_ctrl_f9(){
1165 | return
1166 | }
1167 |
1168 | keyFunc_ctrl_f10(){
1169 | return
1170 | }
1171 |
1172 | keyFunc_ctrl_f11(){
1173 | return
1174 | }
1175 |
1176 | keyFunc_ctrl_f12(){
1177 | return
1178 | }
1179 | }
1180 | ; === F1 ~ F12 ... End
1181 |
1182 |
1183 | ; ========= 0 ~ 9 ... Start
1184 | {
1185 | keyFunc_ctrl_0(){
1186 | return
1187 | }
1188 |
1189 | keyFunc_ctrl_1(){
1190 | return
1191 | }
1192 |
1193 | keyFunc_ctrl_2(){
1194 | return
1195 | }
1196 |
1197 | keyFunc_ctrl_3(){
1198 | return
1199 | }
1200 |
1201 | keyFunc_ctrl_4(){
1202 | return
1203 | }
1204 |
1205 | keyFunc_ctrl_5(){
1206 | return
1207 | }
1208 |
1209 | keyFunc_ctrl_6(){
1210 | return
1211 | }
1212 |
1213 | keyFunc_ctrl_7(){
1214 | return
1215 | }
1216 |
1217 | keyFunc_ctrl_8(){
1218 | return
1219 | }
1220 |
1221 | keyFunc_ctrl_9(){
1222 | return
1223 | }
1224 | }
1225 | ; === 0 ~ 9 ... End
1226 |
1227 |
1228 | ; ========= 其他符号 ... Start
1229 | {
1230 | keyFunc_ctrl_backquote(){
1231 | return
1232 | }
1233 |
1234 | keyFunc_ctrl_minus(){
1235 |
1236 | return
1237 | }
1238 |
1239 | keyFunc_ctrl_equal(){
1240 |
1241 | return
1242 | }
1243 |
1244 | keyFunc_ctrl_backspace(){
1245 |
1246 | return
1247 | }
1248 |
1249 | keyFunc_ctrl_tab(){
1250 |
1251 | return
1252 | }
1253 |
1254 | keyFunc_ctrl_leftSquareBracket(){
1255 |
1256 | return
1257 | }
1258 |
1259 | keyFunc_ctrl_rightSquareBracket(){
1260 |
1261 | return
1262 | }
1263 |
1264 | keyFunc_ctrl_backslash(){
1265 |
1266 | return
1267 | }
1268 |
1269 | keyFunc_ctrl_semicolon(){
1270 |
1271 | return
1272 | }
1273 |
1274 | keyFunc_ctrl_quote(){
1275 |
1276 | return
1277 | }
1278 |
1279 | keyFunc_ctrl_enter(){
1280 |
1281 | return
1282 | }
1283 |
1284 | keyFunc_ctrl_comma(){
1285 |
1286 | return
1287 | }
1288 |
1289 | keyFunc_ctrl_dot(){
1290 |
1291 | return
1292 | }
1293 |
1294 | keyFunc_ctrl_slash(){
1295 |
1296 | return
1297 | }
1298 |
1299 | keyFunc_ctrl_space(){
1300 |
1301 | return
1302 | }
1303 |
1304 | }
1305 | ; === 其他符号 ... End
1306 |
1307 |
1308 | ; ========= 鼠标操作 ... Start
1309 | {
1310 |
1311 | keyFunc_ctrl_wheelUp(){
1312 | return
1313 | }
1314 |
1315 | keyFunc_ctrl_wheelDown(){
1316 | return
1317 | }
1318 |
1319 | keyFunc_ctrl_midButton(){
1320 | funcLogic_mouseSpeedRecover()
1321 | return
1322 | }
1323 |
1324 | keyFunc_ctrl_leftButton(){
1325 | return
1326 | }
1327 |
1328 | keyFunc_ctrl_rightButton(){
1329 | return
1330 | }
1331 |
1332 | }
1333 | ; === 鼠标操作 ... End
1334 | }
1335 | ; ================= CapsLock + Ctrl + Key ... End =================
1336 |
--------------------------------------------------------------------------------