Table of contents
Flow - drinsert
Description
Appends or prepends text to an existing draft. If the UUID for an existing draft is not passed in via a variable, the user will be presented with a content-based filter search to select the draft to insert the text into.
Variables may also be specified to specify a text prefix for each inserted line, and the name of a Drafts action to be run on the updated draft.
Inserting text into an existing draft is currently only possible via a URL scheme call, and so Drafts will temporarily come to the foreground to carry out the operations. The flow will switch back to the previous application when processing has completed, leaving the updated draft loaded into the Drafts application editor.
Variables
Used
The following variables can be passed in and will be processed by the flow.
Variable | Description |
---|---|
query * | The base content to insert into the draft. |
insertMethod * | Set to append or prepend , and determines the route through the flow. |
UUID | The (optional) unique identifier of the draft to be appended to. |
prefix | The text to prepend to each content line. |
action | The name of an action to execute on the new draft once it has been created if the draft is to be opened. |
* These are mandatory for triggering this flow.
Created
The following variables are set-up by the flow.
Variable | Description |
---|---|
content | The (modified) content to populate the new draft with. |
appPath | Set with the path to the app that is in the foreground when the flow is triggered. |
UUID | The unique identifier of the draft to be appended to. Set by a search operation if no UUID was passed in originally. |
NotificationTitle | The title to be shown in any completion notification. |
NotificationMessage | The message to be shown in any completion notification. |
Termination
- External Trigger:
drcomplete
Flow
Scripting
Sample Code (AppleScript)
tell application id "com.runningwithcrayons.Alfred"
set configuration "UUID" to value "60348DD9-C3B3-4CFF-891F-E749CBED1E40" in workflow "com.thoughtasylum.doctordrafts"
set configuration "insertMethod" to value "append" in workflow "com.thoughtasylum.doctordrafts"
run trigger "drinsert" in workflow "com.thoughtasylum.doctordrafts" with argument "Lorem ipsum dolor sit amet"
end tell
URL
This flow has multiple mandatory settings and so is not enabled for triggering via URL. See drappend
and drprepend
for URL triggerable alternatives.
Notes
- Supports new lines from Alfred input as “
\n
”. - Supports tab characters from Alfred input as “
\t
”.