在 Dragon NaturallySpeaking 的高级脚本中获取光标上下文

Getting the cursor context in Dragon NaturallySpeaking's advanced scripting

不知道在Dragon NaturallySpeaking 的高级脚本中是否可以获取游标上下文。

我所说的游标上下文是指周围的字符。例如,有时我想根据光标前的字符是否为 space.

来调整语音命令的某些步骤

我能想到的最好的是我的 CheckNewPara 函数,显示如下:http://knowbrainer.com/forums/forum/messageview.cfm?catid=4&threadid=2739&discTab=true&messid=11427&parentid=11409&FTVAR_FORUMVIEWTMP=Single

Function CheckNewPara()
    Clipboard$()
    SendKeys "+{Left}^c", True  '  copy previous character
    Select Case Clipboard$()
            Case ""  '  if the prior character is nothing
                    CheckNewPara = ""  '  add no space
            Case Chr(13)&Chr(10), Chr(9), ")"  '  if the prior character is a Lf-CR, tab or )
                    SendKeys "{Right}", True
                    CheckNewPara = ""  '  add no space
            Case "."  '  if the prior character is a period
                    SendKeys "{Right}", True
                    Clipboard$()  '  check for No.
                    SendKeys "+{Left 3}^c", True  '  copy prior three characters
                    SendKeys "{Right}", True
                            If Clipboard$() = "No." Then
                                    CheckNewPara = " "  '  add one space after No.
                            Else
                                    CheckNewPara = "  "  '  add two spaces after period
                            End If
            Case "?", "!"
                    SendKeys "{Right}", True
                    CheckNewPara = "  "  '  add two spaces after other ends of sentence
            Case Else
                    SendKeys "{Right}", True
                    CheckNewPara = " "  '  add one space in the usual case
    End Select
    Clipboard$()
End Function

您应该查看 http://knowbrainer.com/forums/forum/messageview.cfm?FTVAR_FORUMVIEWTMP=Linear&catid=4&threadid=2739&discTab=true 中的完整主题以了解所有上下文,但我指向的 post 中的代码应该可以帮助您入门。

我最新版本的函数实际上调用了一个 AutoHotKey 脚本,该脚本查看前三个字符(或尽可能多的字符,如果有的话)和接下来的两个字符(或有多少字符,如果有的话)和 returns 一个 space,两个 space,或者什么都没有,这取决于上下文。上下文可以是一个终结标点符号(需要两个 spaces)或一个 pound/hash # 符号或右括号或大括号 ] } 都不需要 spaces,或者默认一个space。我也有它,所以我可以在输入 Dragon 命令的结果后 and/or 之前调用它。

HTH, YMMV,