2016-05-31 35 views

回答

2

最好我能想出是這裏顯示我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把所有的語境,但在後的代碼我指着應該讓你開始。

我最新版本的函數實際上調用了一個AutoHotKey腳本,該腳本查看前三個字符(或多少,如果有的話)和接下來的兩個字符(或多少有,如果有任何),並返回一個空格,兩個空格,或根據上下文而定。上下文可以是一個終端標點符號(需要兩個空格),也可以是一個磅/散列號符號或者關閉方括號或大括號]}}全部不需要空格,否則默認爲一個空格。我也擁有它,所以我可以在輸入Dragon命令的結果之前和/或之後調用它。

HTH,YMMV,

相關問題