上一篇写的是如何取消禁用掉,这次写些如何重新定义,上一篇的信息我就不再重复。
上一篇提到如果想要重新定义侧键,必须重写鼠键的驱动,这个思路是对的。
但我们有更强有力的工具,autohotkey,以及AutoHotInterception库。
操作方法:第一,先安装autohotkey Version 1.1.28.02。安装方法不多说,很简单。
第二,下载AutoHotInterception库
先进入,autohotkey帮助文档界面,找到Usage and Syntex,找key list子项,在内容中找到以下文字,
点击“AHKHID”进入链接网页。
Try AHKHID. You can also try searching the forum for a keywords like
RawInput*
,USB HID
orAHKHID
.
链接:https://autohotkey.com/board/topic/38015-ahkhid-an-ahk-implementation-of-the-hid-functions/
下载AutoHotInterception库,具体下载就不多说了。
第三,看README.MD帮助文档,找到下面的红色文字。
# Setup
1. Download and install the [Interception Driver](http://www.oblita.com/interception)
2. Download an AHI release from the [releases page](https://github.com/evilC/AutoHotInterception/releases) and extract it to a folder.
DO NOT use the "Clone or Download" link on the main page.
This is the folder where (at least initially) you will be running scripts from.
It contains a number of sample `.ahk` scripts and a `lib` folder, which contains all the libraries and files needed for AHI.
3. Copy the `interception.dll` from the folder where you ran the interecption install into the `lib` folder that was created in step (2)
4. Right-click `Unblocker.ps1` in the lib folder and select `Run as Admin`.
This is because downloaded DLLs are often blocked and will not work.
This can be done manually by right clicking the DLLs, selecting Properties, and checking a "Block" box if it exists.
5. Edit the example script, enter the VID and PID of your keyboard
6. Run one of the sample scripts
7. (Optional) The contents of the `lib` folder can actually be placed in one of the AutoHotkey lib folders (eg `My Documents\AutoHotkey\lib` - make it if it does not exist), and the `#include` lines of the sample scripts changed to `#include <AutoHotInterception>`, to enable your AHI scripts to be in any folder, without each needing it's own copy of the library files.
大致说下意思,如果英文好的,略去,以下绿字部分。
1.从http://www.oblita.com/interception,下载Interception Driver,并安装,重启电脑。
2.就是例子代码,略去。
3.把第一步得到的interception.dll拷贝到AutoHotInterception例子代码的Lib文件中,以管理员身份运行Unblocker.ps1文件。
如果不能运行,点击DLL的属性页的“解除阻止”按钮。
第四,例子,以下紫色代码
#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk
AHI := new AutoHotInterception()
id1 := AHI.GetKeyboardId(0x17EF, 0x6054, 1)
cm1 := AHI.CreateContextManager(id1)
return
#if cm1.IsActive
::aaa::JACKPOT
LCTRL::
Send,{Blind}{q DownR} ;
return
LCTRL up::
Send,{Blind}{q Up} ;
return
#if
^Esc::
ExitApp
需要注意的是,GetKeyboardId参数需要vid,pid,这个可以在设备管理器中,找到,改为实际值。
试一下,是不是,按鼠标侧键,变成字母q了,同时,主键盘的左控制键也不受影响。
外加一些福利说明,我们可以把组合键都重新定义,免得原装侧键+。。。,会出来什么其他的功能。
因为组合键的物理电信号,并不是简单的叠加,所以,我们也要把出厂5种侧键组合键功能重新定义,
方法就不多说了,大家自己动动手。
尽情享受,联想m300侧键的功能吧。