Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 22nd, 2008, 11:23 AM
Friend of Wrox
 
Join Date: Dec 2006
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post
Default Running SAPI.SpVoice with HTA or WSH


Chaps,

After several hours of googling and testing i have got a very simple text to voice javascript command to work.

Code:
<script language="javascript" type="text/javascript">
        var VoiceObj = new ActiveXObject("SAPI.SpVoice");
        VoiceObj.Speak("Voice Test");
    </script>
The issue i have is when i run it with no IE security changes i get "Automation server can not create object".

By further investigation i have found by enabling "Initialize and script ActiveX controls not marked as safe for scripting" in custom security settings / IE the script works fine.

I have found a non p2p forum posting which indicated that the scripting environment should be either HTA or WSH to combat the issue but have not found any working examples.

Has anyone got a better understanding of the two environments where SAPI.SpVoice has been integrated correctly.


Thanks

Aspless






 
Old May 23rd, 2008, 03:33 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well you can either have a standalone script with a js extension that just contains the code you posted, no script tags, or you can rename your html page to be hta and then it becomes a scripted exe.
You can search for HTA on msdn.com for examples. Basically speech capabilities are quite dangerous, there are examples of people with speech recognition software running that have had files deleted by scripts that have spoken commands so unless your web app is running on a corporate intranet and you can make it a trusted site it's not suitable for general web use.

--

Joe (Microsoft MVP - XML)
 
Old June 18th, 2008, 06:56 AM
Friend of Wrox
 
Join Date: Dec 2006
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post
Default

Thanks joefawcett

I have created a policy for the trusted zone .. now works well.

Cheers

Aspless






Similar Threads
Thread Thread Starter Forum Replies Last Post
SAPI Jigna VB Components 0 March 6th, 2005 10:12 AM
CALLING a EXE from a HTA (or HTML) stalker Javascript 1 November 1st, 2004 02:18 AM
MS SAPI mega Classic ASP Professional 0 October 17th, 2004 12:46 PM
Can't find Sapi folder kara333 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 September 5th, 2004 07:38 PM
WSH jgoodrow Pro VB.NET 2002/2003 1 August 17th, 2003 07:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.