加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

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

发布时间:2020-12-13 20:07:31 所属栏目:Windows 来源:网络整理
导读:例如,您按ctrl v并将缓冲区内容插入窗口.如何创建我自己的这样的热键?对不起,noobish的问题. 一个快速,轻松地完成这一工作的好方法是使用一种专注于宏编程的脚本语言.我最喜欢的是 AutoIt,因为它在AutoIt帮助文件的一个剪辑中说 AutoIt was initially desig
例如,您按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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读