TextExpander Snippets within Drafts Action Templates

I can’t seem to find the “Expand in Action Templates” referenced in the linked article. Can somebody point the setting out to me? I want to be able to use a TextExpander snippet within a Drafts template.

Tap on the cog, bottom right, to access settings. Select TextExpander in the list of sets of settings available. It is in the Extensions group.

You should then see a screen like this:


I found this page and enabled those toggles but the snippet is still not expanding, I’ve tried it on my Mac and iOS device.

This is how it looks on my Mac.

Works just fine for me on iOS (I just tested it), but as per the docs for its use I would not expect it to work on a Mac. That isn’t supported.

On iOS, refresh your TextExpander snippets, reboot the device and see if that helps.

I tried to simply put the AppleScript as one of the action steps in the template, I don’t think I set that part up correctly because something is broken.

I use Drafts on my Mac more frequently then I do on my iOS device.

Can you explain what you mean by that? I do not know what template you are referring to, how you are relating AppleScript to TextExpander snippet expansion, or what from that appears to be broken.

As mentioned in the TextExpander article you linked to, the action expansion features are only available on iOS.

If you are trying to fill in text when creating a draft from a template on Mac, you would need to use built-in Drafts scripting/template tag features…or, alternately, just generate your whole template from a TextExpander snippet.

Ok, I have a task list action:

Step 1 insert text

M2W Task List (Week of)

<<;strtme>> <<== This TextExpander snippet didn’t work. Therefore I thought I’d:

Step 2: AppleScript

set theCurrentDate to (current date)
set theWeekday to weekday of (current date)

if theWeekday = Monday then
	set startingDate to theCurrentDate
else if theWeekday = Tuesday then
	set startingDate to theCurrentDate - 1 * days
else if theWeekday = Wednesday then
	set startingDate to theCurrentDate - 2 * days
else if theWeekday = Thursday then
	set startingDate to theCurrentDate - 3 * days
else if theWeekday = Friday then
	set startingDate to theCurrentDate - 4 * days
	error number -128
end if

set dateList to {date string of startingDate}
repeat with i from 1 to 4
	set theDate to startingDate + i * days
	set end of dateList to date string of theDate
end repeat

dateList --> {"Monday, September 6, 2021", "Tuesday, September 7, 2021", "Wednesday, September 8, 2021", "Thursday, September 9, 2021", "Friday, September 10, 2021"}

set {TID, text item delimiters} to {text item delimiters, linefeed}
set dateList to dateList as text
set text item delimiters to TID

dateList -- a string of paragraphs of the dates

The result of the AppleScript should be something like this…

Monday, August 30, 2021
Tuesday, August 31, 2021
Wednesday, September 01, 2021
Thursday, September 02, 2021
Friday, September 03, 2021

But as you can tell by my struggles no method has worked for me.

Drafts has its own template tags, with support for date formatting.

Start with the Using Drafts Templates article, especially the date section with information on strftime formatting.

All you need to get the date formatting you need in an Drafts template is:

[[date|%A, %B %e, %Y]]

Yes, but that’s only for the current date. Drafts has no easy syntax to calculate future dates that I know of. In my workflow, I need something that would look like this…

Monday, August 30, 2021
Tuesday, August 31, 2021
Wednesday, September 01, 2021
Thursday, September 02, 2021
Friday, September 03, 2021

That’s why I tried a TextExpander snippet then I tried simply placing the AppleScript (to accomplish the above) date strings.


@bocciaman, from your description (always better to share the actual action by the way as the picture is incomplete without it) it sounds like you are inserting your template and then just running some AppleScript after it expecting it to operate on and update the inserted text. I am not sure if that was your intention, but that is not how it is designed to work and would explain why it did not work for you.

Instead I think you would want to run the AppleScript, take the output of the AppleScript, and insert it into the editor at the current cursor position.

Here’s a version that does that.


I have modified this particular version to work backwards by 5 and 6 days for Saturday and Sunday respectively to allow for testing this over the weekend. Simply remove those four lines (condition and action x 2) to restore the original script structure.


It is pretty easy to do some date calculations in JavaScript in Drafts. Greg posted a straight forward example earlier this year in response to a question about it.


I have an idea for TextExpander that could workaround something that came up earlier, but there’s an issue with it when I came to put it together. I’ve had to contact and open a support ticket with Smile as I think they have broken/removed something that used to work and would be helpful for a more generic solution.

@sylumer I couldn’t get the Bocciaman AS List to execute, I even tried putting the original script in the AppleScript section and ran it with the additional script. It didn’t work in either case.