Skip to content

Understanding Grammar and Choices #7

@Laanan

Description

@Laanan

Hi there,

I am tinkering around with some initial scripting with Hot Voice and want to make sure I am understanding how it works. First script is to set a voice controlled volume up and volume down command, and I am using the Choices script as a template...I am aiming for the user to be able to say "Volume Up" to raise the volume and "Volume Down" to lower it. Later I am to add things like "Open Sesame" to open one app and "Open Banana" to open another.

It looks like grammar pieces are added to an array, and then choices are appended to that array. Does Hot Voice take the first input as item [0], and then wait for any further inputs [1,2,3,n], or do I need to make a function with conditionals that takes the inputs and checks them/parses them, like:

if "volume" --> if "up" --> do this; else if "down" --> do that

or, a bit closer to the actual syntax:

if (grammar[0] == "Volume") {
if (grammar[1] == "Up") {
SetSound, +5
}
else if (grammar[1] == "Down") {
SetSound, -5
}
else {
break
}
}

Something like that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions