GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes Error while invoking SAPI with Java Script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Error while invoking SAPI with Java Script " Watch "Error while invoking SAPI with Java Script " New topic
Author

Error while invoking SAPI with Java Script

Sreek Gupta
Greenhorn

Joined: Mar 08, 2006
Posts: 24
Hi ,
I have installed WINDOWS Xp on my machine. SAPI (Microsoft Speech API) is in built in WINDOWS Xp. I am trying to implement Text - To - Speech using a java script. But i couldnt succeed.

Following is the code snippet i am running.

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
var VoiceObj = new ActiveXObject("Sapi.SpVoice");
var my_test = "my test for you today is an amazing example";
function SpeakText() {
VoiceObj.Speak( my_test, 1 );
}
SpeakText()
</SCRIPT>
</HEAD>
</HTML>

Above script is failing at the following line :
var VoiceObj = new ActiveXObject("Sapi.SpVoice");

Can anyone tell me what is wrong with the above script. Do i need to install any other software on WINDOWS Xp to make Text - to - Speech work ?
Can anyone tell step by step procedure to implement Text - To - Speech on Windows XP machine using Java Script.
Code snippets are appreciable.

Regds,
Sreek
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You have ActiveX enabled?

Eric
Sreek Gupta
Greenhorn

Joined: Mar 08, 2006
Posts: 24
Hi,
Can you please tell me how can i check ActiveX enabled or not.

Regds,
Sreek
Sreek Gupta
Greenhorn

Joined: Mar 08, 2006
Posts: 24
Hi,
Is it the way to check activeX enabled or not?

On the Tools menu in Internet Explorer, click Internet Options.

Click the Security tab.

Click Custom Level... to bring up the Security Settings.

Under ActiveX Controls and Plugins enable "Download Signed ActiveX Controls."

Disable or prompt "Download Unsigned ActiveX Controls."

Disable or prompt "Initialize and Script ActiveX Controls Not Marked as Safe."

Enable both "Run ActiveX Controls and Plugins" and "Script ActiveX Controls

Marked Safe for Scripting."

Under Scripting, enable "Active Scripting."


Regds,
Sreek
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Those would be the settings....

Eric
Sreek Gupta
Greenhorn

Joined: Mar 08, 2006
Posts: 24
Hi,
Then please let me know how can i check whether activex is enabled or not.
I am new these technologies so i do not have idea.
Please help me.

Regds,
Sreek
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If the settings say it is diabled then it is disabled.

That is how you check.

I have never used SAPI so I have no clue about it.

Eric
Sreek Gupta
Greenhorn

Joined: Mar 08, 2006
Posts: 24
Hi,
Activex is enabled on my machine, Still i am getting the error while executing.
Error says:
"Automation server cannot create object".

Any idea what is this error?

Regds,
Sreek
Henry Vasutti
Greenhorn

Joined: May 12, 2006
Posts: 1
Good day, forum users!

As you can see, this is my first post. I'm a student of the University of Brescia (engineering, Italy). I've already implemented a working speech via Javascript, so I post a reply with question here.
My thesis project is about a multimodal Ajax prototype.
All is done, but there is a problem with the sentences reading in the ActiveX modality: it must complete the reading of one sentence before reading the next.
I've read this is a priority problem, but I wasn't able to adjust the priority.
The integration is done in this way:

and via Javascript I call:
It works, with the issue mentioned above.
Tried the following: adding VTXT as a parameter
with the value translation of the parameter:
Also tried with StopSpeaking

No results! It simply stop speaking at all.
Could someone help me?
Thank you to all! You are my last hope (I haven't found any other forum to post in).
Enrico
 
GeeCON Prague 2014
 
subject: Error while invoking SAPI with Java Script