Sequential Command


Run a series of commands in order, waiting for the previous command to finish before starting the next. The Sequential command finishes after all its child commands have finished.

Properties

The Sequential command has the properties shown in the following table, in addition to the common command properties. Set the type property to Sequential.

In the following table, the "Default" column shows "Required" for properties that must have a value for the command to run. Otherwise it displays the default value, which might be none.

Property Type Default Description

catch

Array of Commands

[]

An ordered list of commands to run if this sequence stops early.

commands

Array of Commands

REQUIRED

An ordered list of command to run in series.

repeatCount

Integer

0

Additional number of times to run these commands.

finally

Array of Commands

[]

An ordered list of commands to run after the normal commands and the catch commands

In normal mode the commands run in order, followed by the finally commands. The repeatCount only applies to the regular commands.

In fast mode the commands run in order without repeating, followed by the finally commands.

If one of the commands stops early (in normal mode), the catch commands and finally commands run in fast mode.

If one of the finally commands stops while running in normal mode, the remaining finally commands run in fast mode.

catch

catch requires APL 1.1 or later. Provide an alternate experience for devices running older versions of APL.

The catch commands run if the Sequential command stops due to another command running. The catch commands run in "fast" mode – that is, all durations are ignored and commands jump to their final values. The catch commands run before any finally commands.

The catch commands run one time. The repeatCount property doesn't apply to catch commands.

commands

An array of commands to run. The commands run in array order, and each command must finish before the next one can begin. The delay value of the Sequential command and the delay value of the first command in the sequence are additive. In the following example, the first SendEvent command runs after 3000 milliseconds.

{
  "type": "Sequential",
  "delay": 1000,
  "repeatCount": 2,
  "commands": [
    {
      "type": "SendEvent",
      "delay": 2000
    },
    {
      "type": "SendEvent",
      "delay": 2000
    }
  ]
}

finally

finally requires APL 1.1 or later. Provide an alternate experience for devices running older versions of APL.

The finally commands run after the normal sequential commands finish or after the catch commands run due to the command stopping early. The finally commands run in normal mode unless (a) the entire Sequential command ran in fast mode or (b) the sequential command stopped early.

The finally commands run one time. The repeatCount property doesn't apply to finally commands.

repeatCount

The number of times to repeat this series of commands. Defaults to 0. Negative values will be ignored.

Reinflation strategy

When the Reinflate command runs, the Sequential command can resume after Alexa reinflates the document. The command resumes when it runs on a sequencer that is specified in the preservedSequencers array on Reinflate. The command saves the current repeat number, repeat count, and list of commands.

When Alexa reinflates the document, the currently running command continues to run as specified by its reinflation strategy.


Was this page helpful?

Last updated: frontmatter-missing