home *** CD-ROM | disk | FTP | other *** search
/ PC User 2004 November / PCU1104CD2.iso / software / browsers / files / QBrows.exe / {app} / Scripts / Text To Speech / Read.js next >
Encoding:
JavaScript  |  2004-03-13  |  356 b   |  22 lines

  1. // Create the Sapi SpVoice object
  2. var VoiceObj = new ActiveXObject("Sapi.SpVoice");
  3.  
  4. var doc = Document.HtmlDocument;
  5. var text = doc.selection.createRange().text;
  6.  
  7. if( text == "" )
  8.     text = doc.body.innerText;
  9.     
  10. try
  11. {
  12.     VoiceObj.Speak( text, 1 );
  13. }
  14. catch(exception)
  15. {
  16.     alert("Speak error");
  17. }
  18.  
  19.  
  20. // Clean up voice object
  21. delete VoiceObj;
  22.