How Do I Create an Obsidian Link that Executes a Command

What I’m trying to do

Create an Obsidian Link that Executes a Command (from the command prompt). In this case, I’m trying to execute the “Google Calendar: Open gCal Web View” command from the “Google Calendar” plugin

documentation: Obsidian Google Calendar Plugin
GitHub repo: GitHub - YukiGasai/obsidian-google-calendar: Add Google Calendar inside Obsidian

Things I have tried

Plan A: Execute via the plugin id and command id:

[Plan Calendar](obsidian://command?command=google-calendar:open-google-calendar-web-view)

(got the plugin id and command id from the GitHub repo of the plugin)

Plan B: Execute via a defined hotkey (not sure if there’s a way to do it via hotkey triggering)

   [Plan Calendar](obsidian://command?command=hotkey-helper:trigger-hotkey&hotkey=Cmd+Ctrl+Opt+Shift+W)

Obsidian URIs can’t do that. Obsidian URI - Obsidian Help

You’d need to use the Advanced URI plugin. GitHub - Vinzent03/obsidian-advanced-uri: Advanced modes for Obsidian URI

2 Likes

I am not sure even the Advanced modes fo Obsidian URI will do this on its own, without another plugin (if such plugin even exists). The advanced URI plugin supports only commands in obsidian’s command pallet, not OS’ CLI commands as the OP wants to do.

Cheers

Apparently, that plugin can run javascript through eval if I remember reading some of the Issues pages correctly.
Then possibly app.commands.executeCommandById() can be used…

The OP is not referring to OS commands as I read it, but they do suggest a command from a plugin, which I believe the Advanced modes for Obsidian URI supports. And if it didn’t support it, I reckon you could use another plugin like Templater to define user system command functions , which in turn can be called as commands.

1 Like

Upon rereading the OP’s post, you are correct; I read it a bit fast; I suppose because I had my own head buried in terminal, I saw what I wanted to see hehe

Cheers