Drafts ThoughtAsylum Action Groups Updating

After my appearance on the Automators podcast, there was a pleasant boost in interest in the ThoughtAsylum Action Group Suite for Drafts. One of the things that came out of this was people wanting to have a way for the underlying ThoughtAsylum Drafts Library (TADpoLe) to be automatically updated. In this post I’m going to talk about the solution I’ve come up with and the approach taken.

The Request

When the action groups are fist installed, the core action group has an action called TAD-Setup/Refresh that users must run to refresh TADpoLe and some other libraries it utilises. Sometimes however, people don’t read the instructions of forget to do this. The answer therefore seems simple enough. Have Drafts check if an update to the library is required, download it if there is, and then carry on with the processing.

The Challenge

Since I already had a way of manually triggering a library update, the requirement really was to find a way to determine if an update is required, and if so trigger it.

But, that means checking every time you run an action that utilises the library to see if an update is required. That is potentially quite an overhead and particularly for small, quick actions.

The Approach

The TAD action is included in actions that need to use TADpoLe, and so all of the checking and updating logic is added to this. But there are a few factors to take into consideration to try and maintain some level of reasonable performance.

1. Minimise Online Checks

The first thing to maintain efficiency is to check online for updates as infrequently as possible. In this case, it is actually going to be never.

I decided to add something to the action groups to allow them to specify what the minimum required version of the library is. This can be checked against the current version of the library, and so downloading the latest version of the library will only occur where the minimum version is not met.

Rather than this being for each action, or for each action in an action group, the solution actually scans all of the ThoughtAsylum action groups and determines the minimum version overall. This should ensure updates to the library are applied in a timely manner, and more or less in the time frame the user might expect a library update to occur. this is particularly useful in case the user wishes to utilise some newer TADpoLe functionality themselves.

The minimum version number (which has been date based since the first release) for an action group, is held in the description of the instructions action in each of the action groups.

2. Fastest Current Version Check

The version number of TADpoLe is available in the library file, but this is held on iCloud and, in my testing, it is not as fast to access as local storage. Therefore, rather than reading in the version number from the library every time, it will be read from local storage.

If a version number file is not found in local storage, the action will check the version number in the library file, and then write it to local storage before continuing. Every time the auto update triggers a download of the library files, the version number in local storage is updated at that point.

3. Option to Disable

Even if just for my own sake, I added an option to disable the automatic checking. Again, the status is held in a file in local storage for speed of access, and so it applies only to that device. Then when TAD is included and run, it checks for a disabling file and its content. If present and set to disable, it then skips over further checks.

In my testing, the overhead of this check versus before auto updating is negligible. I couldn’t actually measure any difference on any of my devices.


The latest update to the action groups includes the auto updating option (enabled by default), and I’m interested to see how this pans out. the checking felt sluggish to me, but if it meets the needs of the community and is a stable solution then I’ll be happy to leave this in place. But for the next few months I’ll be considering this as a beta feature and if things don’t quite work as hoped in the real world, I will be considering removing it and returning to the previous approach.

Author: Stephen Millard
Tags: | drafts | tadpole |

Buy me a coffeeBuy me a coffee

Related posts that you may also like to read