在 Dragon NaturallySpeaking 的高级脚本中,有什么方法可以将事件窗口的标题复制到 Microsoft Windows 中的剪贴板吗?
我使用的解决方法是定义 AutoHotkey脚本:
^!l::
WinGetActiveTitle, Title
Clipboard = %Title%
return
并在语音命令中调用键盘快捷键:
但我不想在 AutoHotkey 和 Dragon NaturallySpeaking 之间纠结。可以用“纯”高级脚本来完成吗?
最佳答案
是的,您可以使用 Dragon NaturallySpeaking 的高级脚本将事件窗口的标题复制到剪贴板,如下所示:
'
' get window title
'
Sub Main
Clipboard ( GetWindowTitle )
End Sub
'
' Use these Windows Functions for Getting an active Window title
'
Declare Function GetForegroundWindow Lib "user32" () As Long
'
Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" ( ByVal hwnd As Long , _
ByVal lpString As String , ByVal cch As Long ) As Long
'
' GetWindowTitle
' (Gets an active Window title)
'
Function GetWindowTitle() As String
Dim x As Integer
Dim TitleText As String * 300
Dim hw As Long
hw = GetForegroundWindow()
x = GetWindowText ( hw , TitleText , Len ( TitleText ) )
GetWindowTitle = Trim ( Left ( TitleText , x ) )
End Function
'
现在,我将所有函数保存在全局“#Uses”文件中(以及其他声明、函数和全局常量等),因此我只需要 Main Sub 部分,但您可以将所有引用的函数和您也需要在一个脚本中声明它。
第 3 次
关于naturallyspeaking - 在 Dragon Naturallyspoken 高级脚本中将事件窗口的标题复制到 Microsoft Windows 中的剪贴板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38492451/