Run Command Palette command when opening file depending on e.g. tags

I’m using Recipe View for my recipes. Everytime I have to press the Recipe View toggle button or use the toggle though Command Palette.

Is there a way, to automaticly run selected commands from Command Palette when opening a file?

I was thinking about a tag or something like

---
run_command: "Toggle xyz"
---

I didn’t see find any plugin or infos how it could be possible to accomplish it.

I don’t know about any plugin which could do this automatically but there’s at least the plugin Commander with which you can trigger a command (or macro) by clicking on a button/icon (you can place pretty much anywhere) :blush:

Note toolbar could also potentially help …

You can achieve this in three common ways:

Buttons community plugin

Example:

```button
name Toggle spellcheck
type comand
action Toggle spellcheck
color blue
```
^button-spellcheck

 

Advanced URI

with external link syntax i.e.

[Toggle spellcheck](obsidian://adv-uri?commandid=editor%3Atoggle-spellcheck)

Search Copy URI for command in command palette to create links for commands. Buttons have similar functionality to create buttons.

 

QuickAdd

Offers macros which can include templates together with Obsidian native commands or just commands. This is allows you to execute commands automatically when creating files from templates. Currently configuration of QuickAdd is burried in settings–>plugins but you can use Open Plugin Settings plugin for quicker access. QuickAdd allows you to use templates with robust configuration so you probably want to use this plugin for several use cases.

Edit: macros offer also to open existing files or running conditional commands. Setting up conditional commands is obviously for advanced users.