KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: sharing macro to position pointer inside dragon correction dialog, relatively to start/end of Xth word
Topic Summary:
Created On: 09/01/2020 10:25 PM
Status: Post and Reply
Linear : Threading : Single : Branch
Keyword
 09/01/2020 10:25 PM
User is offline View Users Profile Print this message

Author Icon
dicdoc
Top-Tier Member

Posts: 268
Joined: 07/31/2014

When correction dialog only provides a partially correct alternative to transciption I often prefer navigating by voice inside correction field of correction dialog to go to the end of the 2nd word or to the beginning of the 4th word. The above macro does this using a start/end list and a complex ordinated list (1st, 2nd, 3rd) :

===

Sub Main
 Dim n, i, NbrCarDebordDr As Integer, ClipTemp, verif, ponctuation As String, v As Long
 'ponctuation = ",.;:!?%< >$£(){}[]§°+*/=\'«-»~±""''"

 ClipTemp = Clipboard
 If InStr(ListVar2, "\") Then
  Let n = CInt(Mid(ListVar2, 1, InStr(ListVar2, "\")-1))
 End If
 'MsgBox(ListVar1 & " " & n & " " & ListVar2 )

 'MsgBox(InStr(ListVar2, "\")-1)
 'MsgBox(InStr(ListVar2, "\")-2)

'
' TTT DE L'AVANT-DERNIER MOT
' ==========================

If n = 998 Then
 SendKeys"{end}", 1 ' à la fin de la ligne

For i = 1 To 2
' Routine qui vérifie que la lettre gauche ne fait pas partie des ponctuation
' ce qui signifie qu'il faut tout d'abord décalé le porteur d'une neutre à gauche avant
' d'effectuer le saut de mot
'
 SendKeys"+{left}", 1
 SendKeys"^c", 1
 verif = Clipboard
 v = InStr(1, ponctuation, verif)
 'MsgBox("" & verif & "===" & v & "")
 While v > 0
  SendKeys"{left}", 1
  SendKeys"+{left}", 1
  SendKeys"^c", 1
  verif = Clipboard
  v = InStr(1, ponctuation, verif)
 'MsgBox("" & verif & "==" & v & "")

 Wend
 'SendKeys"{right}", 1

 SendKeys"{left}", 1
 SendKeys"^{left}", 1
Next i
'
' restreindre la sélection au mot sans les espaces
'
 SendKeys"^+{right}", 1
 SendKeys"{right}", 1


' Routine qui vérifie que la lettre gauche ne fait pas partie des ponctuation
' ce qui signifie qu'il faut tout d'abord décalé le porteur d'une neutre à gauche avant
' d'effectuer le saut de mot
'
 SendKeys"+{left}", 1
 SendKeys"^c", 1
 verif = Clipboard
 v = InStr(1, ponctuation, verif)
 'MsgBox("" & verif & "===" & v & "")
 While v > 0
  SendKeys"{left}", 1
  SendKeys"+{left}", 1
  SendKeys"^c", 1
  verif = Clipboard
  v = InStr(1, ponctuation, verif)
 'MsgBox("" & verif & "==" & v & "")

 Wend
 SendKeys"^+{left}", 1


 Clipboard ClipTemp
 GoTo FinCommune

'
' TTT DU DERNIER MOT
' ====================
'

ElseIf n = 999 Then
'
' restreindre la sélection au mot sans les espaces
'
 SendKeys"{end}^{left}", 1 ' à la fin de la ligne
 If ListVar1 = "début" Then
  GoTo FinCommune
 End If
 If ListVar1 = "fin" Then
 ' Routine qui vérifie que la lettre gauche ne fait pas partie des ponctuation
 ' ce qui signifie qu'il faut tout d'abord décalé le porteur d'une neutre à gauche avant
 ' d'effectuer le saut de mot
 '
   SendKeys"^+{right}^c", 1
   Wait .25
   'MsgBox(Clipboard & " " & Len(Clipboard) & " " & (Instr(Clipboard," ")) & " " )
  If (InStr(Clipboard," ")) = 0 Then
   SendKeys "{right}", 1
   'MsgBox(Clipboard & " " & Len(Clipboard) & " " & (Instr(Clipboard," ")) & " " )
   GoTo FinCommune
  End If
  If (InStr(Clipboard," ")) > 0 Then
   NbrCarDebordDr = Len(Clipboard)-(InStr(Clipboard," ")-1)
   'MsgBox(Clipboard & " " & Len(Clipboard) & " " & (Instr(Clipboard," ") - 1) & " " & NbrCarDebordDr)
   SendKeys"{right}{left " & NbrCarDebordDr & "}", 1
  End If
  GoTo FinCommune
 End If
End If



'
' TTT MOT 1-60
' ====================
'
If ListVar1 = "début" Then
 SendKeys"{home}^{right " & (n-1) & "}", 1
End If

If ListVar1 = "fin" Then

  SendKeys"{home}^{right " & (n-1) & "}^+{right}^c", 1
  Wait .25
  'MsgBox(Clipboard & " " & Len(Clipboard) & " " & (Instr(Clipboard," ")) & " " )
 If (InStr(Clipboard," ")) = 0 Then
  SendKeys "{right}", 1
  'MsgBox(Clipboard & " " & Len(Clipboard) & " " & (Instr(Clipboard," ")) & " " )
  GoTo FinCommune
 End If
 If (InStr(Clipboard," ")) > 0 Then
  NbrCarDebordDr = Len(Clipboard)-(InStr(Clipboard," ")-1)
  'MsgBox(Clipboard & " " & Len(Clipboard) & " " & (Instr(Clipboard," ") - 1) & " " & NbrCarDebordDr)
  SendKeys"{right}{left " & NbrCarDebordDr & "}", 1
 End If

End If

FinCommune:
Clipboard ClipTemp


End Sub


-------------------------

Memory: 16GB Microphone Brand and Model: LFH 4000 & Flexy Mike  Operating System: win 10, latest update; Surface Book 2, Processor (CPU) Type & Speed: I7 8650 Soundcard Brand and Model: none Speech Software: Dragon Medical Practice Edition, french version: 4.2 Using KnowBrainer?:Yes

Statistics
31789 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 2 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 598 guests browsing this forum, which makes a total of 600 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2020 FuseTalk™ Inc. All rights reserved.