First you need to add a system.speech reference
Now declare your Reference
Now we are going to declare this into memory outside of sub.Code:Imports System.SpeechNow we are going to our Voice CommandsCode:Dim gram As New System.Speech.Recognition.DictationGrammar() Dim WithEvents reco As New Recognition.SpeechRecognitionEngine
Now to program the Voice Commands (For our homepage I did it by going to settings, Type: String, Scope: User, Name: HomePageURL)Code:reco.SetInputToDefaultAudioDevice() Dim gram As New Recognition.SrgsGrammar.SrgsDocument Dim Rule As New Recognition.SrgsGrammar.SrgsRule("Rule") Dim List As New Recognition.SrgsGrammar.SrgsOneOf("Back", "Forward", "refresh", "Set as Homepage", "Google", "Go to Homepage") Dim Items As New Recognition.SrgsGrammar.SrgsText Rule.Add(List) gram.Rules.Add(Rule) gram(dot)root = Rule 'MPGH wont let me type Gram (.) root reco.LoadGrammar(New Recognition.Grammar(gram)) reco.RecognizeAsync()
(take note this is not proper handling, I am simply doing this improperly for the sake of not giving a fuck)Code:Private Sub reco_SpeechRecognized(ByVal sender As Object, ByVal e As System.Speech.Recognition.RecognitionEventArgs) Handles reco.SpeechRecognized Dim homepage As String = My.Settings.HomePageUrl Select Case e.Result.Text Case "refresh" WebBrowser1.Refresh() Case "Back" WebBrowser1.GoBack() Case "Forward" WebBrowser1.GoForward() Case "Set as Homepage" My.Settings.HomePageUrl = WebBrowser1.Url.ToString My.Settings.Save() MsgBox("New HomePage:" & homepage) Case "Google" WebBrowser1.Navigate("https://google.com") Case "Go to Homepage" WebBrowser1.Navigate(homepage) End Select
And now we finish handling our Speech recognizer.
Code:Private Sub reco_RecognizeCompleted(ByVal sender As Object, ByVal e As System.Speech.Recognition.RecognizeCompletedEventArgs) Handles reco.RecognizeCompleted reco.RecognizeAsync() End Sub
Now you have a Voice Command Webbrowser without the need of any buttons (assuming you have a mic or a headset).
Last edited by unknownartist0; 07-20-2013 at 07:02 PM.
Huh, I didn't know voice commands was that simple, nice job.
When I import the Speech i got this error:
Warning 1 Namespace or type specified in the Imports 'System.Speech' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
Then, when i put these lines of code:
I got these errors:Code:Dim gram As New System.Speech.Recognition.DictationGrammar() Dim WithEvents reco As New Recognition.SpeechRecognitionEngine
Error 2 Type 'System.Speech.Recognition.DictationGrammar' is not defined.
Error 3 Type 'Recognition.SpeechRecognitionEngine' is not defined.
Do I need some SDK or what?
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
If you did everything correctly and get this then
Maybe, you might need to be on .Net framework 4.0 too but im not sure.
https://www.microsof*****m/en-us/downl....aspx?id=10121
Last edited by unknownartist0; 07-22-2013 at 08:48 PM.
Last edited by Sixx93; 07-23-2013 at 06:36 AM.
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
ok, I've added the references and now I don't get any errors... But when I try to run the app, on the line:
I got this:Code:reco.SetInputToDefaultAudioDevice()
A first chance exception of type 'System.PlatformNotSupportedException' occurred in System.Speech.dll
This is the source:
Code:Imports System.Speech Public Class Form1 Dim gram As New System.Speech.Recognition.DictationGrammar() Dim WithEvents reco As New Recognition.SpeechRecognitionEngine Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load reco.SetInputToDefaultAudioDevice() Dim gram As New Recognition.SrgsGrammar.SrgsDocument Dim Rule As New Recognition.SrgsGrammar.SrgsRule("Rule") Dim List As New Recognition.SrgsGrammar.SrgsOneOf("Back", "Forward", "refresh", "Set as Homepage", "Google", "Go to Homepage") Dim Items As New Recognition.SrgsGrammar.SrgsText Rule.Add(List) gram.Rules.Add(Rule) gram****ot = Rule reco.LoadGrammar(New Recognition.Grammar(gram)) reco.RecognizeAsync() End Sub Private Sub reco_SpeechRecognized(ByVal sender As Object, ByVal e As System.Speech.Recognition.RecognitionEventArgs) Handles reco.SpeechRecognized Select Case e.Result.Text Case "refresh" MsgBox("refresh") Case "Back" MsgBox("Back") Case "Forward" MsgBox("forward") Case "Set as Homepage" MsgBox("Set as Homepage") Case "Google" MsgBox("Google") Case "Go to Homepage" MsgBox("Go to Homepage") End Select End Sub Private Sub reco_RecognizeCompleted(ByVal sender As Object, ByVal e As System.Speech.Recognition.RecognizeCompletedEventArgs) Handles reco.RecognizeCompleted reco.RecognizeAsync() End Sub End Class
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
Last edited by wut12345; 07-23-2013 at 06:19 PM. Reason: I hate apple.
I'm asking because I'm trying to learn something new... If you are here only to post something to increase your post counter (like you're doing in every thread, posting answers un-needed like this one ) or
then go somewhere else.
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
I don't care If I handle things correctly, I don't care if this is a good method, I've wrote 'perfect' methods before on my own preknowledge so I could give a shit less about an Example, of using the Speech reference, I had this idea way before I knew there was a reference to use in Visual studio for speech/audio recognition.
I'm not getting mad... I mean, if you don't want to help, then don't post useless things :\
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
Cryptonic (07-26-2013),unknownartist0 (07-26-2013)