Skip to content
Actions for Obsidian icon Home Actions for Obsidian 2024.1.3 › Actions

Actions for Obsidian › Actions › Trigger Sequence Of Command

Executes up to 10 Obsidian commands in sequence, just like you’d do manually using its command palette.

Due to the way Shortcuts and Obsidian work together, with Actions for Obsidian as translator in-between, AFO needs to maintain an internal list of commands available in your vault(s). So before you can use this action, the list needs to be fetched at least once using the “Get Available Commands” action in order to populate the list of commands that is shown in the Shortcuts editor.

Parameters

Vault

The vault to work in.

Type: Vault reference

Obsidian Command 1

Type: Command reference

Optional Obsidian Command 2

Type: Command reference

Optional Obsidian Command 3

Type: Command reference

Optional Obsidian Command 4

Type: Command reference

Optional Obsidian Command 5

Type: Command reference

Optional Obsidian Command 6

Type: Command reference

Optional Obsidian Command 7

Type: Command reference

Optional Obsidian Command 8

Type: Command reference

Optional Obsidian Command 9

Type: Command reference

Optional Obsidian Command 10

Type: Command reference

Pause between commands

Your commands may need some time to execute, and to avoid race conditions, you can add pauses from 0.2 up to 2 secs between them.

Options:

  • 0.2 secs
  • 0.4 secs
  • 0.6 secs
  • 0.8 secs
  • 1.0 secs
  • 1.2 secs
  • 1.4 secs
  • 1.6 secs
  • 1.8 secs
  • 2.0 secs

Usage

As mentioned, AFO needs to know the list of available commands in order to let you select from it via its “Obsidian Command” parameter. So prepare two workflows, one for getting the list of commands from Obsidian and which is run occasionally and only when necessary, and another one for executing one or more commands from the list.

Workflow 1 (Getting the list):

  1. Get Available Commands action. Set “Vault” to your vault.

Run it once.

Workflow 2 (Executing commands):

  1. This here action, “Trigger Sequence Of Commands”. Select a command from the list.

Notes

The Shortcuts workflow editor will get the list of commands from AFO when the action is initialized, which happens when you add a “Trigger Sequence Of Commands” action to the workflow, and also (later on) when you re-open the workflow in the editor. The action will not be updated on list changes while it is open in the editor, though. (I wish I could work around that but at the time of this writing, I’ve yet to find a way.)

For example, when you have the two workflows described in the “Usage” section above open in the editor, side by side, the command list in Workflow 2’s action will show whatever it contained at the time of the action’s initialization in the editor. Running Workflow 1 will not change that, since the Shortcuts editor will not update the Trigger action in Workflow 2 with the new data. Only closing and re-opening Workflow 2 in the editor will do the trick.