0

我有这个 Windows 语音识别 (WSRMacro) 脚本,它将多个单词组合成一个单词:

"Happy children"
-> "Happychildren"

但是,在某些情况下会出现脚本中的错误,我不知道如何推断问题所在。尽管上面的示例有效,但以下示例无效:

"Happy children bake a cake"

替代面板不是像上面那样复合单词,而是出现以下提示:

-> Alternates Panel (Say the number next to the item you want followed by OK): 
(1) Replace that withhappychildrenbakeacake
(2) replace that withhappychildrenbakeacake
(3) replace that with no space happy no space 
    children no space bake no space a no space cake

我可以从上面的备用面板输出中推断出下面脚本中的任何特定错误吗?

或者有什么我可以添加到脚本中以获得关于错误性质的更有用的反馈?

  <command priority="5">
    <listenFor>compound that</listenFor>
    <emulateRecognition>select that</emulateRecognition>
    <sendKeys>{250 WAIT}{{CTRL}}c{250 WAIT}</sendKeys>
    <script language="VBScript">
      <![CDATA[
      that = Application.clipboardData.GetData("text")
      Set regEx = New RegExp
      regEx.Pattern = "[^\s\w,;:]"
      If regEx.Test(that) Then
        Application.SetTextFeedback("Try again without any punctuation selected")
      Else
        regEx.Pattern = "(\s) *(\S)"
        regEx.Global = True
        that = regEx.Replace(" " & that, "$1no space $2")
        On Error Resume Next
        Application.EmulateRecognition("replace that with" & that)
        If 0 <> Err.Number Then
          Application.SetTextFeedback("Try again with only the digits selected")
        End If
      End If
    ]]>
    </script>
  </command>
4

1 回答 1

0

听起来您正试图在本机不支持文本服务框架的应用程序中使用它。

更严重的是,您为什么不使用内置命令“从中删除空格”或“连接”?

于 2009-10-08T22:32:05.350 回答