Is it Possible to Call Command Palette Commands from a Templater Template?

Things I’ve Tried

I looked at a bunch of examples and searched Google, but I’m not finding what I’m looking for.

What I’m trying to do

I have been working on a fork of the Day Planner plugin that lets you use templates for the Daily plan. But, what I really want is to be able to insert the Day Planner template into my daily note template. This works, except it doesn’t call the Day Planner code to parse the template and make it a plan. So, my next thought is to call the existing code in Day Planner to insert an agenda into any note. Ideally, I could do this right in my Daily Note template rather than using a file include for the Planner template.

3 Likes

Heyy, I was looking for the same exact thing actually. Did you find any way to solve this by any chance? I also thought that it would be very intuitive to be able to to run commands from the command pallet by using Templater.

1 Like

Obsidian Advanced URI should be able to do that, but the question is if you really want to depend on 3 different plugins on one workflow.

Also it looks like that Day Planner and Templater are not maintained anymore.

why do u think templater is not maintained? a issue was closed by the maintainer 3 days ago: Issues · SilentVoid13/Templater · GitHub

@amykhar @UserOfName Since you can run any Javascript inside a templater template using <%*, you can access app.commands which seems to be the way to get information about command palette commands. The QuickAdd plugin has code for getting the full command list, for example. You’d remove this. but presumably you can use that to find the id of the command you want, and then can put in your template app.commands.executeCommandById(_) the correct id.

Note: I don’t think you can use tp.obsidian for this because I could not find a way to get the command list from the Obsidian API. I asked about this on the forums just now, so maybe someone else knows how to do it. Good luck!

3 Likes