微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

什么是最简单的方法来制作Windows的热键?

例如,您按ctrl v并将缓冲区内容插入窗口.如何创建我自己的这样的热键?对不起,noobish的问题.
一个快速,轻松地完成这一工作的好方法是使用一种专注于宏编程的脚本语言.我最喜欢的是 AutoIt,因为它在AutoIt帮助文件一个剪辑中说

AutoIt was initially designed for PC
“roll out” situations to reliably
automate and configure thousands of
PCs. Over time it has become a
powerful language that supports
complex expressions,user functions,
loops and everything else that veteran
scripters would expect.

在AutoIt中编写热键应用程序不容易.例如,由于某些原因(不明确提到),您希望Alt q在特定情况下作为数字键盘7进行反应,因此您不必跨键盘触摸.这是一些代码,这样做…

Func _num7()
    Send("{numpad7}")
EndFunc

HotKeySet("!{q}","_num7")

While 1
    sleep(10)
WEnd

如果这不够直观,AutoIt帮助文件forums是非常有帮助的.更不用说,如果您最终得到任何AutoIt的具体问题,AutoIt开发人员可以使用非常少的AutoIt开发人员.

在上面的例子中,我们假设您只想在特定应用程序使用时激活热键,以免干扰其他热键.这段代码将会完成.

; The comment character in AutoIt is ;
Local $inTargetProg = False

Func _num7()
    Send("{numpad7}")
EndFunc

While 1
    If WinActive("Target Application Window Title") and Not $inTargetProg Then
        HotKeySet("!{q}","_num7") ; binds Alt+Q to the _num7() function
        $inWC3 = True
    EndIf

    If Not WinActive("Target Application Window Title") and $inTargetProg Then
        HotKeySet("!{q}") ; UnBind the hotkey when not in use
        $inWC3 = False
    EndIf

    sleep(5)
WEnd

原文地址:https://www.jb51.cc/windows/371008.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐