Configuration/Setup sending Drafts docs to iA Writer

I was using the Drafts action to send files to iA Writer (written by @davenicholls) and sometimes it works and sometimes it doesn’t.

I thought it was the files that have emoji as the first character as the problem, but I just tried ones without that and I get an error. A Red notification slides down from the top for a split second and I’ve tried tapping the notification but nothing happens.

What’s weird is, a few docs did move over when I tried this.

Thanks for any help.

Bob in Brooklyn

When it fails could you look at the action log and post what it says (it a screenshot).

You can get to the action log from the middle icon at the top of the action list (it looks like the drafts icon). You’ll see a list of actions that you’ve run with the most recent at the too. Tap on the failed one at it’ll give more details as to what went wrong

Dave, you are a genius. It’s not the emoji it at all. It’s that I have a long sentence/graf and it’s trying to use the whole first graf as the file name. So it says it’s invalid.

Is there a way to tell the script to use the first 20 characters of the file as the file name?



Assuming you’re using the action that sends a single file, if you edit the script and change this line:

cb.addParameter("path", basePath+draft.processTemplate("[[safe_title]]"+".txt"));

To this:

cb.addParameter("path", basePath+draft.processTemplate("[[safe_title]]").substr(0,20)+".txt");

It will limit the filename to 20 characters. You can see in the line where it sets the 20 so you can set it to whatever value you like.

If you’re using the action that sends multiple files you’ll see a very similar line, which can be changed in the same way.



1 Like

Holy nerdness! I’m going to try it! Thanks, Dave!

You’re welcome.

Have fun.


I’m getting an error saying “’(my file name)’ doesn’t exist”

I copied it carefully and checked it twice.

Could you screen shot the error and post it here along with a copy and paste of the part of the script that you changed?


I changed this line as you stated (to this):

cb.addParameter(“path”, basePath+draft.processTemplate("[[safe_title]]").substr(0,20)+".txt");

And here’s the error…

That is a bit confusing. I thought it might be the emoji but that works for me.

It’s also not clear why the filename that it’s saying doesn’t exist is longer than 20 characters.

Could you go into iA Writer and tidy up the files that have been created by the action (delete them and then choose another file to look at). I saw a similar message to the one you’re seeing, but it was in iA Writer not Drafts. I think it happened because I had deleted the file in IA Writer on my Mac while still having it open on my iPad. Tidying up the files before running the action should avoid that problem (which I’m hoping is linked to yours)


I deleted the old ones that didn’t work and then I tried a totally new file and get the same “The file (new name) doesn’t exist.”

I’m still unsure as to what’s happening here. I’ve done some more testing and it works every time for me.

Could you share your updated action? If you edit the action and scroll to the bottom you’ll see the “Share to action directory” option. You can share it as unlisted so it doesn’t appear int eh public directory and then send me the link to it.




You are a kind soul!



I think I may have found the problem.

Near the top of the script you’ll see this line:

const basePath = "/test/drafts/";

It sets where in the iA Writer folder structure the files will be written. If this path doesn’t exist you get the error that you’re seeing.

Do you have those folders?

If not you’ll need to either create them, or change that line to suit your iA Writer folder structure.


Dave! You did it! I just tried three random ones and they all worked!. Take the rest of the day off!

I’m going to make comments in the file so I remember. :slight_smile:

Thanks again!


To be clear, I changed the path to be the folder that I wanted to use.


I’m glad it’s sorted out and that you’re finding the action useful.

Your comment about taking the rest of the day off is quite funny. I’m in the UK and it’s 23:55 :grinning:



I hope you took the opportunity to sleep longer today!

I’m using the same action today, however it fails on my iPad and works on my iPhone.
I checked the configuration on both devices are same.

How is your action configured? Is it one you configured yourself? I’m not seeing one with that name in the Action Directory.

Is there any detail of the error in the log if you tap on the error entry?