Executes an Obsidian command 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 Get Available Commands 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
Type: Command reference
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):
- Get Available Commands action. Set "Vault" to your vault.
Run it once.
Workflow 2 (Executing commands):
- This here action, "Trigger Command". 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 Command" 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.
Related Links
- Search the Actions for Obsidian community forum for "Trigger Command"