New draft at meeting start time

I’d like an action that when a scheduled event starts on my Exchange calendar, a new draft is opened with the date and meeting title.

I’m new to, but not intimidated by, actions.
If it would help, I can use Keyboard Maestro to help.

I am happy to see if I can figure it out, but am pretty new to these tools. I can script in Python, but haven’t learned the syntax for any of these tools, or for instance, how to get an event name based on current time. Any hints or existing actions would be greatly appreciated.

Glad to find a community to ask for tips!

Do you want to run an action automatically for every single event when it starts, or would you like an action that you can run that will retrieve the current (or next?) event details and create the draft from that?

When you say “opened with the date and meeting title”, do you mean on separate line or a single line? Is there any formatting you want to apply (e.g. level 1 Markdown heading, standard ISO date format for the date and a colon followed by a space separating the date from the event name).

Drafts actions can retrieve calendar events via the scripting action (JavaScript-based). There shouldn’t be any particular need to do any processing of this outside of Drafts unless you are particularly keen to. if you want to get more familiar with Drafts actions, I would suggest this is a good opportunity to do so.

Do you ever have overlapping calendar events, in particular calendar events? If you do, you might want to consider having a user prompt to select the event for which to create the draft.

That could be useful for scheduling a check on your calendar and triggering an action if you did want to automatically do things. But, do keep in mind if you do want to automate that far then you could end up automatically switching away from something you are doing.

Also if you wanted to have a global hotkey you could trigger from any app to run a Drafts action to create your meeting draft, Keyboard Maestro would be a good option (you can trigger an action via a URL call).

Great questions and thanks so much for taking time to help me clarify what I’m hoping to accomplish.
It makes more sense, now that you ask to have an action that I run, prompting me to choose from events that are running currently.

I title meeting notes with the first line in markdown with a date format of # YYYY-MM-DD {Event Name}

Okay so here are my suggestions for building it yourself:

  • Use a script step in your action. That means learning a bit of JavaScript if you don’t happen to know any already; recommendations are made on this forum if you search :wink:
  • Just like you would in Python, break it down into small parts and build it up.
  • Scripting documentation:
    • I already referred you to the Calendars page for retrieval of your events. You’ll be processing an array of event objects each with their own set of properties. Hopefully your array will have just one entry. If it has multiple, you’ll need to prompt for user selection. If it’s zero you need to decide what it make sense to do.
    • Prompt - this will let you build a prompt to display and choose between multiple events if you have them. Should that not be enough, there are more advanced HTML prompts, but my advice would be to stick with the standard prompt and revisit it when you have everything functional - it can add quite a bit of complexity.
    • strftime - will help with your date formatting for your title.
    • Draft - you should be able to pick up from here how to create a new draft with the content you want.
    • Editor - just for loading in the draft at the end.

That’s hopefully enough pointers to get you started, without giving you all the answers. I’m assuming from your initial post that you want to build this yourself.

Actions in the directory are a great source of code examples to do things, so do search for things that may do some similar actions and check them out.

Similarly there are lots of code examples on this forum which is thankfully searchable.

Finally, you can always add questions on this thread to get additional suggestions.

Hope that helps.

1 Like

Thank you! Fun - and wish me luck! I’m off to find the “Hello World” of Drafts JavaScript to get started. Appreciate your time so much. What a great community.

1 Like

Please share your result if you where successful :wink: