如何劫持 Caps Lock 键进行剪切、复制、粘贴键盘操作 [英] How to hijack the Caps Lock key for Cut, Copy, Paste keyboard operations

查看:127
本文介绍了如何劫持 Caps Lock 键进行剪切、复制、粘贴键盘操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我想要完成的:

  1. 要复制,请按下并松开 Caps Lock 一次
  2. 要粘贴,请快速按下并松开 Caps Lock 两次
  3. 要剪切,请按 Ctrl+Caps Lock
  1. To Copy, press and release Caps Lock ONCE
  2. To Paste, press and release Caps Lock TWICE, quickly
  3. To Cut, press Ctrl+Caps Lock

我想要这样做的原因经常是我发现自己低头按下正确的 X/C/V 键,因为它们都彼此相邻(至少在 QWERTY 键盘上).

The reason I want to do this is often times i find my self looking down to press the correct X/C/V key, since they're all next to each other (atleast on a QWERTY keyboard).

如何在标准键盘(使用 Windows)上执行此操作,使其适用于整个系统并对所有应用程序(包括 Windows 资源管理器)透明?如果使用标准键盘无法实现,您认为任何可编程数字小键盘"都可以做到这一点吗?

How can I do this on a standard keyboard (using Windows), so that it applies to the entire system and is transparent to all applications, including to Windows Explorer? If not possible with a standard keyboard, can any of the "programmable numeric keypads" do this you think?

在上面,透明"我的意思是应用程序不应该知道这个击键被翻译.它只得到常规的 Ctrl+X/C/V 代码,所以它的行为没有任何问题".

In the above, by "transparent" I mean "the application should never know that this keystroke was translated. It only gets the regular Ctrl+X/C/V code, so it behaves without any problems".

附言.不确定所有适合这个问题的标签,所以请随意添加更多标签.

Ps. Not sure of all the tags that are appropriate for this question, so feel free to add more tags.

解决了.更新:感谢@Jonno_FTW 向我介绍 AutoHotKey.我通过在我的文档"文件夹中的默认 AutoHotKey.ahk 文件中添加以下 AHK 脚本来管理所有三个要求:

SOLVED. UPDATE: Thank you to @Jonno_FTW for introducing me to AutoHotKey. I managed all three requirements by adding the following AHK script in the default AutoHotKey.ahk file in My Documents folder:

Ctrl & CapsLock::
  Send ^x
Return      
CapsLock::
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 1000)
  Send ^v
Else
  Send ^c
Return

那很简单!

未完全解决.更新:以上适用于记事本,但不适用于资源管理器(例如复制文件)或 MS Office(即使文本复制不起作用).因此,我需要深入研究 AutoHotKey 或其他解决方案.当我找到一个解决方案时会在这里发布一个解决方案.同时,如果有人可以让 AutoHotKey 为我需要的一切工作,请回复!

NOT COMPLETELY SOLVED. UPDATE: The above works in Notepad, but NOT in Explorer (copying files for example) or MS Office (even text copying does not work). So, I need to dig around a bit more into AutoHotKey or other solutions. Will post a solution here when I find one. In the meantime, if someone can make AutoHotKey work for everything I need, please reply!

一切都解决了.更新:我所要做的就是将大写C"/X/Z 更改为小写c"/x/z.所以发送 ^C 变成了发送 ^c.它现在适用于包括 Windows 资源管理器在内的所有程序!修复了上面的代码以反映此更改.

ALL SOLVED. UPDATE: All I had to do was to change the capital "C"/X/Z to lowercase "c"/x/z. So Send ^C became Send ^c. It now works in ALL programs inlcuding Windows Explorer! Fixed code above to reflect this change.

推荐答案

我相信您正在寻找的程序是 AutoHotkey.

I believe the program you are looking for is AutoHotkey.

这篇关于如何劫持 Caps Lock 键进行剪切、复制、粘贴键盘操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆