Action to dictate text to the same draft

new here. Pro user since several months. I’m in need of an action to dictate words and add the date and time with a line break below.
Running the action should not create new drafts but adding the dictated text to the opened draft. Seems not too complicated but unfortunately I have no knowledge in programming. Could some provide an action described above? Would really appreciate it.

There is an example Insert Dictation action in the directory that inserts the result of the dictation in the current draft (at the cursor position).

(Ships with app in “Editing” action group)

I would need minor modifications to insert the timestamp, and possible always insert at the end of the draft, if that is what you are needing.

Wasn’t aware about the availability of the source of this snippet.
How could I add the timestamp or another linebreak for example?

Could someone give me an example how to implement a linebreak and timestamp in the code?

Something along these lines should do it. This will prompt for dictation, and then append to the end of the current draft with a timestamp and the dictated text. It utilized template tags. The template variable can be edited to change the format of the appended element.

// define a template
let template = `
# [[time]]

// dictate
var s = editor.dictate();
if (s.length > 0) {
    draft.setTemplateTag("dictated-text", s);
    draft.content = draft.content + draft.processTemplate(template);
1 Like