【问题标题】:How can I send a right windows key with Dragon NaturallySpeaking's advanced scripting?如何使用 Dragon NaturallySpeaking 的高级脚本发送正确的 Windows 键?
【发布时间】:2019-11-09 23:11:17
【问题描述】:

如何使用 Dragon NaturallySpeaking 的高级脚本发送正确的 Windows 键?

看看What is the difference between the commands SendKeys, SendSystemKeys or SendDragonKeys?SendKeysSendSystemKeysSendDragonKeys 似乎是不可能的。

【问题讨论】:

    标签: windows keyboard naturallyspeaking windows-key


    【解决方案1】:

    按右窗口键:

    ' From https://knowbrainer.com/forums/forum/messageview.cfm?catid=3&threadid=3032
    ' Author: monkey8
    ' Tested with Dragon NaturallySpeaking 12.5 with Windows 7 SP1 x64 Ultimate
    Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _
    Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long
    Const VK_RWIN = 92
    Sub Main
    keybd_event(VK_RWIN,0,0,0)
    'if you want to send a key while holding down the Windows key then insert the code here
    keybd_event(VK_RWIN,0,2,0)
    End Sub
    

    按下左窗口键:

    ' From https://knowbrainer.com/forums/forum/messageview.cfm?catid=3&threadid=3032
    ' Author: monkey8
    ' Tested with Dragon NaturallySpeaking 12.5 with Windows 7 SP1 x64 Ultimate
    Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _
    Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long
    Const VK_LWIN = 91
    Sub Main
    keybd_event(VK_LWIN,0,0,0)
    'if you want to send a key while holding down the Windows key then insert the code here
    keybd_event(VK_LWIN,0,2,0)
    End Sub
    

    键盘代码的有用参考:List of Virtual Key Codes (mirror)

    【讨论】:

      【解决方案2】:

      注意Declare 的内容必须高于脚本中的Sub Main。如果你使用修饰键,这就是它的样子:

      Declare Function keybd_event Lib "user32.dll" (ByVal vKey As Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long
      Const VK_LWIN = 91
      
      Sub Main
      
      keybd_event(VK_LWIN,0,0,0)
      SendSystemKeys "{Right}"
      keybd_event(VK_LWIN,0,2,0)
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多