Creating a Draft with an Apple Script

not sure if this is the right section - apologies if it isn’t.

I want to use Drafts with keyboard maestro to Create a draft from my clipboard WITH specific tags.

The clipboard is plain text and use variables from the Keyboard Maestro Macro.

So right now I found a workaround which is typing a keystroke to launch drafts wih alfred,
then keystroke again “CMD OPT N” to create a new draft from clipboard.

Works fine, but the only issue is that i still have to add the tags manually.

So I thought that this could maybe be solved using an Apple Script?
After searching on the forum I didn’t really find anything that could help.

If anyone could help to find a workaround (with apple script or without…)

Thank you

Have you seen the AppleScript example in the documentation? It includes tags in the properties.

tell application "Drafts"
    make new draft with properties {content: "My Draft Content", flagged: false, tags: {"blue", "green"}}
end tell

I didn’t see that. Thank you very much @sylumer (as usual!)

The only issue with that is that my KM variables are not pasted into the draft.
They are pasted as they are, i.e: %Variable%ThisIsTheVariable%.

So I stumbled across this:

Still trying to implement it now (without great success)

This works for me when I bring the the Drafts example and the Keyboard Maestro example together

When run, I get this.