Table of contents
Daily Log
Description
Many people maintain logs of some sort. One of the most popular of these is a journal or daily log. For draft creation we are creating a new draft ever time, and draft appending, we are adding to the same, pre-existing draft every time. With a daily log however, we want to create a new draft each day, and append to it if it already exists. Fortunately Doctor Drafts has a ‘log’ flow to help with precisely that sort of case. In fact it lends itself to ad hoc ongoing logs, weekly logs, monthly logs, etc.
With this flow you can enter some lines of text, they will be prefixed with the current time, and appended to a draft with a heading based on the current date; creating such a draft if one does not already exist.
Flow
The flow to do this consists of just three sequential blocks.
Building the Flow
The first block is an Inputs > Keyword
block, and just sets up the keyword we want to use, in this case dlog
to trigger the flow. It is set to require an argument. This argument will be the text that we type after the keyword and is what will form the basis of what is appended to the daily log draft.
The next block is a Utilities > Args and Vars
block. This passes through the {query}
untouched to the final block, and specifies three additional variables for the draft.
The most important is probably the title
. This is what is used to figure out which draft to append to, and if a new draft needs to be created. It is set to “# Log {date:yyyy-MM-dd}
”, which uses the Alfred date dynamic placeholder to build a title using a datestamp-style format.
The block also sets the tags
variable to be “log
”. Multiple tags can be added here separated by commas, but in this instance we are adding just a single tag, and if a log draft is created, then the tag will be added to it. Note that if a log file with the specified title already exists, but without the tag, the tag will not be added. It is only added at the point of creating a new draft.
The third variable is the prefix
. This is the text that is prepended to the start of every line, other than the title, that is appended to the daily log draft. Once again, we are using an Alfred dynamic placeholder. This time the time placeholder in “{time:HH:mm} -
”, to mark the time at which the line of content was added to the log.
The final step is to link an Outputs > Call External Trigger
block. If you select the Workflow Triggers… button, this will allow you to select from the list of available triggers and will populate the Workflow ID and Trigger ID fields, with no risk of typos. Here we are selecting the drlog
trigger ID from Doctor Drafts.
If you take a look at the Flow - drlog page in the Documentation section, it explains how it works, and what variables it expects to be set. Note in the above screenshot that the Pass input as argument and Pass variables options are set. These are critical to this working correctly.