TextExpander Snippets within Drafts Action Templates

Is there a script I can run to give permission?

Is this error specific to a certain action? e.g. Are you able to run other actions that use AppleScript, like these examples.

No, they aren’t working either. Here are some examples of what I see:

Here is another:

Do you recommend uninstalling and reinstalling?

Couldn’t hurt to try. I’m a little stumped. Seems like a file-systems permission disagreement, but that’s a bit hard to troubleshoot. The compiled script file was generated by Drafts, so seems like it should have permissions to the folder needed to read it.

1 Like

Uninstalling and reinstalling worked! The action now works. Thanks to you and @sylumer.

I got the AppleScript working in my DraftsApp but it’s still frustrating because I can’t work with it very easily. I’m frustrated with AppleScript because ‘I’ can’t easily manipulate it. I’m ready to chuck my keyboard into the screen. I know that I could create a TextExpander expansion but…

Is there a better way to create this template action:

## My Tasks List Week of Monday, September 27, 2021

#### Monday, September 27, 2021
- [ ]
#### Tuesday, September 28, 2021
- [ ]
#### Wednesday, September 29, 2021
- [ ]
#### Thursday, September 30, 2021
- [ ]
#### Friday, October 01, 2021
- [ ]

Glad to hear you got it working, and as you are probably aware, AppleScript is an unusual language with that many of its users (and I definitely include myself here) find challenging to use compared to other more common languages.

It may be that you were very close to the solution you were seeking, but you have not posted anything you have tried, or details of your results, so that isn’t something anyone could advise on.

Everyone gets frustrated with coding. That really is part of the process in my opinion. But these things are usually possible to work through in time and with the right support and insights available.

As has already been suggested, you could do this in JavaScript. This has the advantage of being cross-platform rather than just macOS. But it would arguably be easier to maintain. Alternatively, Drafts supports calling shell scripts, so you could code and return in any language you may be more familiar with that allows for command line calls - e.g. Python, SwiftUI, C, Go, or even just a shell script directly … though shell scripts often make you jump through a few hoops (i.e. utilising additional utilities) to do this sort of level of manipulation of strings and dates

That being said, for the existing AppleScript, it is relatively straight forward to do, and perhaps you just needed some additional pointers to get you there?

Note 1: If you have an end goal in mind, and want to get there faster, it is best to post that from the start. If you are more interested in the learning journey, then indicate that and people can break down the steps to get you there. I’m assuming that you had this in mind, maybe more (?), from the start.

Note 2: The forum uses Markdown, so if you want to post a draft example containing Markdown, you should post it in a plain text code block to ensure the forum does not format it. In this case that would allow us to see what formatting (headings, bold), what bullet delimiter, etc. As it is, I have just guessed, and you would need to modify them to your requirements.

The following action is a modification of the previous one. It:

  1. Prefixes each date with a level two heading marker (Markdown).
  2. Adds another list item after each date has been added that is the checkbox line.
  3. Prefixes the header line to the concatenated list at the point it is returned.

Hopefully, that covers everything to the point where you can do any final tailoring.

1 Like

@agiletortoise and @sylumer Thank you for putting up with my lack of coding knowledge.

Sorry for not posting in a code block

I’ve created the template as a TextExpander snippet and then in Drafts for iOS created a 1-step action with the step insert text and the TE abbreviation <<list>> just placed in as is.

And thank you all for fixing the template, you didn’t have to do that, I would have lived with using a TextExpander snippet manually in Drafts.

Again, sorry about this, and I went back up and placed it as code.

I’ll post more details as to what I’ve done in the future.