jay_t55
jay_t55

Reputation: 11652

Windows Speech Recognition C#

I'm making a program that does stuff (Sorry, I'm not allowed to say what it is), but I want to be able to let Windows Speech somehow "know" that there are linklabels and buttons on my Forms, so that when I say "Next" or "Start" etc, it will click those buttons. Just like when you are using IE and you are on Google.com and when you say "Search" it will perform a click on the search button and begin the search.

The problem is that it doesn't seem to know that buttons/linklabels or anything like that exist in C# windows forms applications. Is this something that we must do ourselves?

Thanks

Bael

Upvotes: 2

Views: 1162

Answers (3)

S Belz
S Belz

Reputation: 83

You could use a switch:

string speech = e.Result.Text;
switch  (speech)
{
case "Next":
BtnNext.PerformClick();
break;
}

Upvotes: 0

Sachin
Sachin

Reputation: 97

There is a way to make labels known to your speech rec. program but i'm not sure about buttons.

label1.Text = string.Format(//your string code in here)

Upvotes: 0

Eric Brown
Eric Brown

Reputation: 13932

Windows Speech Recognition uses MSAA and UI Automation to find the buttons, links, etc., on your application. So, if your app has the appropriate AccessibleRole and AccessibleName definitions set on your controls, WSR should find them just fine.

Upvotes: 3

Related Questions