hctspeak.js 1.3 KB

123456789101112131415161718192021222324252627282930
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // hctspeak.js //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. ///////////////////////////////////////////////////////////////////////////////
  9. // This script uses the Speech API to speak to the user.
  10. //
  11. // Useful for batch scripts or typing on the command-line to compensate for
  12. // short attention spans (or multitasking).
  13. //
  14. // Usage:
  15. // hctspeak.js -- says 'Task complete'
  16. // hctspeak.js /say:"Hello, world!" -- says 'Hello, world!'
  17. eval(new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(new ActiveXObject("WScript.Shell").ExpandEnvironmentStrings("%HLSL_SRC_DIR%\\utils\\hct\\hctjs.js"), 1).ReadAll());
  18. var text = WScript.Arguments.Named.Item("say");
  19. if (text == null) {
  20. if (WScript.Arguments.Unnamed.length === 1) {
  21. text = WScript.Arguments.Unnamed.Item(0);
  22. } else {
  23. text = "Task complete";
  24. }
  25. }
  26. Say(text);