SemlerPDX

VoiceAttack Inline VB.net Voice Typing with NATO Phonetic Alphabet (EXAMPLE)

Dec 29th, 2020 (edited)
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.20 KB | None | 0 0
  1. 'example VoiceAttack profile containing this inline: https://tinyurl.com/yd25v8tx
  2.  
  3. Imports Microsoft.VisualBasic
  4. Imports System
  5. Imports System.Collections
  6. Imports System.Collections.Generic
  7. Imports System.Data
  8. Imports System.Drawing
  9. Imports System.Diagnostics
  10. Imports System.Windows.Forms
  11. Imports System.Linq
  12. Imports System.Xml.Linq
  13. Imports System.Threading.Tasks
  14.  
  15. Public Class VAInline
  16.     dim responses as integer = 0
  17.     dim response() as string
  18.     dim NATO_List as string
  19.    
  20.     Public Sub Main()
  21.        
  22.         if (VA.GetText("~NATO_List") isNot nothing)
  23.             NATO_List = VA.GetText("~NATO_List")
  24.            
  25.             if (VA.GetText("~response") isNot nothing)
  26.                
  27.                 'Split spoken responses at the space which separates words
  28.                 response = VA.GetText("~response").Split(New Char() {" "c})
  29.                
  30.                 'Set variable for each word in the response inside NATO_List
  31.                 for each word as string in response
  32.                     if (NATO_List.Contains(word))
  33.                         responses += 1
  34.                         VA.SetText("~response_" + responses.ToString(), word)
  35.                     end if
  36.                 next
  37.                
  38.                 'Set variable to return count of valid words
  39.                 if (responses > 0)
  40.                     VA.SetInt("~response_count", responses)
  41.                 end if
  42.                
  43.             end if
  44.         end if
  45.        
  46.     End Sub
  47. End Class
Add Comment
Please, Sign In to add comment