2

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?

2
  • 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
    Commented May 5, 2015 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
    Commented May 5, 2015 at 20:01

1 Answer 1

3

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"})
1
  • Thanks Alan! I'd tried to use ScriptEditor.say({text: "Hello", using: "Alex"}), but clearly I'd misread the directions.
    – drew
    Commented May 6, 2015 at 13:39

You must log in to answer this question.

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