Insert Templater Template via a button using Meta Bind

I currently have this button in my “Standups” note and it does what I want - it inserts a template (contains today’s date and a few headings):

name Add a Day
type line(32) template
action Standup Day
templater True

I’d like to replicate the behaviour using Meta Bind. I’ve considered the following approaches but none give me the result:

  1. Use the templaterCreateNote action. This creates a separate note. I’d like the button to insert the template at line X.
  2. Use the Command Action to bring up the command palette and Input Action to select the “Templater: Open Insert Template modal” action (like in the example here). However, I’m not sure if and how I can send the “Enter” key as an action.
  3. Use the Run JavaScript Action and a script to trigger inserting a templater note, but I can’t seem to figure out how to insert text at line X using JS Engine.

Has anyone done something similar or has any ideas what else to try?

I don’t think it’s currently a feature for any meta bind buttons to insert stuff other than at the current cursor position. So maybe you should post a feature request, or consider moving the button to that line? (The latter could possibly be done using an inline button if you don’t want that part of the document cluttered with button definitions)

If using templaterCreateNote, could it be an option to let it create (and/or replace) a given note, and then embed that note at line 32?

If using the command action, instead of opening the modal, use the Templater > Template Hotkeys section to create a command specific for you template of choice, and use that command in the command action. Given a template “_templates/xTemplate.md”, the command created is “Templater: Insert _templates/xTemplate.md”.

If using javascript in any incantations, you can use editor.getLine() and editor.setLine() after getting the current view. See Editor - Developer Documentation for a class reference to this part of the API. It does require some coding though… :slight_smile: