创新路
我们一直在努力

【黑科技】(变废为宝)十多块的垃圾鼠标瞬间变成几百的高级宏鼠标!

黑科技

   今天给大家来波福利!教你们如何变废为宝,要玩游戏的都知道,有宏鼠标和不是宏鼠标,差距是相当大的,从价格方面来说,不是宏鼠标的价格也就几块到几十块,宏鼠标的价格是从几百块到几千块,这差距大家可以想象一下,今天有幸知道了宏鼠标的程序是怎么开发的,知道了最原始的方法这种好东西,当然不能独自享受,这里就分享给大家!

   这里就要给大家介绍一个程序了,是如何让普通鼠标变成高级宏鼠标的!AHK,全称AutoHotKey,什么你不知道?AHK是一种生产力工具,举个例,就是有了AHK,你们打开网页或者文件的时候,才能用鼠标滚轮上下翻动,这个AHK程序,最擅长的是热键和热字串!重映射键盘鼠标,操作窗口,字符串处理等,通俗一点,就是没有实现不了的,只有写不出代码的人!

好了,下面进入正题,

; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a

; semicolon, such as this one, are comments.  They are not executed.


; This script has a special filename and path because it is automatically

; launched when you run the program directly.  Also, any text file whose

; name ends in .ahk is associated with the program, which means that it

; can be launched simply by double-clicking it.  You can have as many .ahk

; files as you want, located in any folder.  You can also run more than

; one .ahk file simultaneously and each will get its own tray icon.


; SAMPLE HOTKEYS: Below are two sample hotkeys.  The first is Win+Z and it

; launches a web site in the default browser.  The second is Control+Alt+N

; and it launches a new Notepad window (or activates an existing one).  To

; try out these hotkeys, run AutoHotkey again, which will load this file.


#z::Run www.autohotkey.com


^!n::

IfWinExist Untitled – Notepad

WinActivate

else

Run Notepad

return


; Note: From now on whenever you run AutoHotkey directly, this script

; will be loaded.  So feel free to customize it to suit your needs.


; Please read the QUICK-START TUTORIAL near the top of the help file.

; It explains how to perform common automation tasks such as sending

; keystrokes and mouse clicks.  It also explains more about hotkeys.

这几十行代码,我就不一一说是什么意思了,太深入的说,不知道要说多久,现在就教大家把普通鼠标变成宏鼠标吧!

#IfWinActive ahk_class LaunchUnrealUWindowsClient 这句话的意思是,要在你需要的程序中启动,标红的是你所需的程序

按键::   这个的意思是需要用那个按键来促发 这个地方随便你自己设置比如说鼠标左键右键中键滚轮

loop{    这里的意思是开始循环

seed {按键} 这里是要按下你需要的按键

sleep 延迟 这里是根据你运行程序的延迟

}Until Not getkeystate("按键","P") 语法的格式不多说

return   这里的意思是,以上循环

这里就形成了一个简单宏了

再举个例,比如说,我要鼠标左键变成复制,右键变成粘贴 而不冲突普通的鼠标左右键

#IfWinActive ahk_class LaunchUnrealUWindowsClient 红色部分可以改成表格或者文档

ctrl::
Loop
{
GetKeyState,State,XButton1,P

If (State="U") ;
{
Break

return

LButton::

loop{

seed {ctrldown}

seed {c}

}Until Not getkeystate("LButton","P")

return

RButton::

loop{

seed {ctrldown}

seed {v}

}Until Not getkeystate("RButton","P")

return

这样就可以实现,按一次CTRL,鼠标左右键就变成复制粘贴,再按一次CTRL,鼠标左右键就变成普通按键!

有兴趣的小伙伴可以去试一下,保证会让你得到不一样的惊喜!那今天就写到这里吧!

未经允许不得转载:天府数据港官方信息博客 » 【黑科技】(变废为宝)十多块的垃圾鼠标瞬间变成几百的高级宏鼠标!

客官点个赞呗! (0)
分享到:

评论 抢沙发

评论前必须登录!

天府云博 - 做有态度的开发&运维&设计学习分享平台!

联系我们百度云主机