English | 中文
master branch: v3.0
v2 branch: v2.x
- Download and install AutoHotkey (v1.1. )
- Clone the Capslock source code
- Run
Capslock .ahk
- There is a key function
keyFunc_example2
in demo.ahk. - Add below setting under the [Keys] section in
CapsLock settings.ini
:caps_f7=keyFunc_example2
- Save, reload Capslock (CapsLock F5)
- Press
CapsLock F7
to invoke the function
- In order to avoid calling the internal functions, all the key functions are restricted to start with
keyfunc_
An example here:
Listary is a good app launcher, now I want to add two features to it:
- Activate Listary with
CapsLock Q
- I want to fill the selected text into the pop-up text input box
We can make it like this:
- Copy the following code to
/userAHK/main.ahk
:
keyfunc_listary(){
; Get the selected text
selText:=getSelText()
; Send win F (the default hotkey of Listary) to activate Listary
sendinput, #{f}
; Wait until Listary is activated
winwait, ahk_exe Listary.exe, , 0.5
; If there is any selected text
if(selText){
; Add "gg " before the selected text to google
selText:="gg " . selText
; Fill the text, and press `home` key to move the cursor to the beginning,
; in order to add other keywords if you need.
sendinput, %selText%{home}
}
}
- Add a setting
caps_q=keyfunc_listary()
under[Keys]
section inCapsLock settings.ini
, save, pressCapsLock F5
to reload, done.
CapsLock .ahk
is the entry file, library files are in the /lib
folder,
the function of each file is as follows:
Filename | Description |
---|---|
lib_bindWins.ahk | Window binding |
lib_clQ.ahk | qbar |
lib_clTab.ahk | CapsLock Tab |
lib_functions.ahk | Some utils |
lib_init.ahk | Program initialization |
lib_jsEval.ahk | The calculation function implemented by using the IE engine, required by Math Board and CapsLock Tab |
lib_json.ahk | json library |
lib_keysFunction.ahk | All the key functions |
lib_keysSet.ahk | Hotkey layouts |
lib_loadAnimation.ahk | Loading animation when the program starts |
lib_mathBoard.ahk | Math Board |
lib_mouseSpeed.ahk | Mouse speed modification |
lib_settings.ahk | Load the settings in CapsLock settings.ini |
lib_ydTrans.ahk | Youdao Translation |