1

In Applescript, I can specify the voice the system uses to speak text as follows:

say "Hello" using "Alex"

In Javascript, I can do something similar:

var ScriptEditor = Application("Script Editor");
ScriptEditor.includeStandardAdditions = true;

ScriptEditor.say("Hello!")

But I don't know how to specify the specific voice; I always have to use the system. Is there a way to specify the using parameter, or another version of say that allows the code to specify the voice?

  • Don't use Javascript it's really not made to make automated workflows. It very basic and not at all better in any aspect. – user14492 May 5 '15 at 19:59
  • I'm more familiar with JavaScript. I'd like to know if it's possible in JavaScript before I fall back to AppleScript. – drew May 5 '15 at 20:01
2

Apple's documentation describes how to call commands which have both direct parameters (the text) and named parameters (the using). In this case, you would do this:

var ScriptEditor = Application("Script Editor");
ScriptEditor.includeStandardAdditions = true;

ScriptEditor.say("Hello", {using: "Alex"})
  • Thanks Alan! I'd tried to use ScriptEditor.say({text: "Hello", using: "Alex"}), but clearly I'd misread the directions. – drew May 6 '15 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .