Problem modifying an action

Hi there,

I’m totally new in Drafts. I upgraded to Drafts Pro and I tried to create my first Action by using an existing Action and trying to modify it. The Action I chose was RegEx Factory v.1.4 (

The problem I’m having is that no modification I make is preserved. In this Action, you can create a new RegEx Group, which I did (a lot of times). No matter what I do. When I run the Action again, I cannot find the RegEx groups that I created. It totally disappears and only the groups that came by default are preserved.

Is there something really obvious I’m doing wrong? I would appreciate any help you can offer.


Maybe the action’s author, @RoyRogers, has some feedback?

Thanks for the quick response.

What puzzles me is that I created a new action by copying and pasting the source code from that Action and the problem still persists.

The Action itself works perfectly with the RegEx groups that it brings as defaults. It’s just that for some reason the modifications I make don’t stick. It seems that nothing is saved even though I do click on the button and it seems to work well. I can run the new RegEx groups I create but when I go back after a while and I try to run them again, they have disappeared and everything is back to the way it was before I made the changes.

That’s why I’m thinking there is something I’m doing wrong and that it doesn’t have to do with the Action but with Drafts. Not that Drafts doesn’t work properly but there must be some setting or configuration that I’m not applying properly.


Hi there,

It may be that you have selected the action by searching in the action pane.
If you then update any action, it will be saved, but if you run it while being filtered by your search string, it will run the old version (from some kind of cache, I assume)


  1. select the action by browsing instead of searching.
  2. Or refresh the action search after update before you run the action.

That’s the only thing that comes to mind :nerd_face:


Again, thanks for your quick responses. This is a nice community.

OK, I’m not sure I understand what you are saying. I’m not familiar with the Drafts terminology but if I understand you correctly, when you say ‘action pane’ you mean the ‘Action List’ that appears on the pane on the right column when you select a particular group, right?

If that is the case, I don’t think that’s the problem. I never used search. All the manipulations of the Actions were done by choosing the RegEx Factory action via browsing. What I have discovered since I last wrote might be relevant to solve my problem, though.

I’ve noticed that if I do the changes via the interface that RegEx Factory provides (the menu where you see the title of the group and you can edit the RegExGroup), then they are not saved. If I edit the script directly, though (that is by accessing the Action via Draft Manage Actions menu, selecting the action and editing the script), then it is saved, no problem.

Does that help you or the developer figure out what is going on? As I said, it is entirely possible I’m doing something wrong. This is the first time I do this. Is it possible, for instance, that I don’t have the right settings in Drafts to save the modifications I make in the right place so that they are accessible in all my devices? Are the scripts one creates saved in a specific folder in iCloud? I don’t know. I have the feeling it is something very stupid.

Again, thanks for your help.


I think I can see a potential issue. Try this slightly modified action and see if it fixes it.

Hi sylumer,

Thanks a lot for your interest and for your help.
Your solution didn’t completely solve the problem but you are definitely onto something. Let me explain.

When I say it didn’t solve the problem is because it still didn’t work when I added a new RegEx Group in the way I had done it initially. I wasn’t specific about this but the way it seemed to me to be easier to introduce modifications to the original Action was by using the option 'Edit all Groups" that becomes visible when you choose ‘Load other Groups’. You are offered an editing window where you see all of the RegEx groups that are available and in principle you should be able to delete them, modify them or add new ones. This is what didn’t work for me before. I saved the changes clicking the available button but the changes were not saved.

With the modified version you linked, this still didn’t work because when I saved my modifications (basically adding some new group) they were not there next time I used the Action. Exactly what happened with the original Action. It looks like what you change stuff in this particular editing window it still does not get saved.

However, with your modified version I was able to preserve the changes if I introduced them in the way that I imagine is the default way to do that. That is, by choosing ‘Load other Groups’ and then using the option ‘New Empty Group’. If I create a group and add a new pattern in this way, your modified version manages to save the changes whereas the original version of the Action does not.

I’m curious to know (I’m trying to learn how to do this) what it was that you changed because it obviously fixed something and I think it is likely fix the other problems if applied in the rest of relevant “places”.


Okay, I think I see why that occurs too.

Try re-downloading the RegEx Factory v.1.4 MOD , I’ve added another change.

The first change was to change the path being used.

//var path = '/Drafts/RegExGroups.txt';
var path = '/RegExGroups.txt';

The root folder Drafts uses does not have a Drafts sub folder in it by default. Therefore, I suspect when it was trying to save, it was trying to save to a directory that you do not have and failing.

The second change I’ve made is in the editAllGroups() function.

A section of the code looked like this:

try {
      } catch(err) {
        return false;

Note that the function that looks like it would do the save is commented out. I uncommented it, and that seems to have enabled it to save the updates to the file. Note that this function uses the path variable amended earlier.


Thank you very much Stephen. That did solve the problem and I learned a little bit more about Drafts scripting.

It’s going to take me a little while to wrap my head around JavaScript. I learned a little bit of Python a while ago and I must say Python looks a little less arcane than JavaScript. I guess it’s all a matter of familiarity, just as with any language of any kind, but I wish one could do Drafts scripting using Python.

Anyway, your help is much appreciated. Being able to use regular expressions in this way is extremely useful for me.


1 Like