Removing Spaces in Send to Evernote Action

I created a new action to send to Evernote. (see below)

With [[draft]] as the Note, after exporting to Evernote all of the spaces in the title are removed.

Is there syntax to have the complete first line of the [[draft]] be the Note title?

Just try [[title]] in the Field for Note title :slight_smile:

I know I wish it were that easy! Whatever the text is in the body, all the spaces are removed. :slight_smile:

Maybe try the ENML option instead of Text

I think you might be running into this long running Evernote issue. I’m working with someone else seeing this issue in support, but it’s not widespread and I’m pretty sure Drafts is sending the right information because it works for most every one.

It may be a bug in the SDK code, or something else, but I’m not sure what is different for the people seeing the issue. Is your Evernote account a business account, or is it affected by writing to different notebooks or with different content in the draft?

2 Likes

Ok, so today this is working. I didn’t make any changes versus my testing last week. There was an iOS update so maybe this issue benefitted from a reboot…?

Been working through this with a few other users in private support…and have found many related posts (which have nothing to do with Drafts) on Evernote’s forums. None of them very conclusive, but it seems to be an intermittent issue with Evernote. Hopefully just a temporary one that will not recur for you.

2 Likes

@agiletortoise let me know if you need other examples or additional test cases. My uploads to Evernote all exhibit this issue (stripped spaces in note title). Glad to help troubleshoot this.

Becoming more of a problem for me thanks to ever increasing use of Drafts as input path to Evernote! —jay

Try to forget your Evernote sign-in in Settings > Credentials. I’m starting to suspect this is sometimes related to a particular auth-token. Doesn’t make much sense, but worth a try.

Unfortunately, that didn’t help. Tried it twice, including re-boot in between (for good measure!). No luck… StillMashingTheTitleTogether…

Anything unique about your Evernote account? (Business account?) or any affect if you target different notebooks, or had code note names?

Normal account (not business)

Your questions prompted me to try different combinations.

  • Hardcoded titles work as expected
  • Changing notebooks makes no difference
  • A simple note with no manipulation of draft content works as expected << hmmmm… maybe something with how I’ve reformatted draft text is causing the problem??

With that revelation, I stripped all of the formatting of the draft text (this is part of a meeting notes action) to the bare minimum. Could the reconstruction of the draft change a character in the first line of the draft which in turn impacts the [[title]]?

N.b. This script is stripped of most logic for simplicity of debugging, thus the begin/end concepts seen below don’t make sense. However, even in this simple form, the problem persists.

Here is the example Action

Script logic:

const lines = draft.content.split("\n"); let begin = ''; let end = '';

for (var line of lines) {
begin += line + " \n";
}

begin = begin.slice(0,-1);
end = end.slice(0,-1);
alert(begin);
draft.content = (begin + " \n" + end);
draft.update();

Quick update… in fact, it does seem to relate to how I’m reconstructing the draft. I tested a version where I modified the final draft.content statement by adding in the original draft.title.

draft.content = (draft.title + "\n" + begin + " \n" + end);

This version works (though, of course, now the first line is duplicated). I’ll keep hacking on this… I need to figure out how I’m mangling the first line of the modified draft

I get the same problem. Is there any real answer to this one?

More information: I have created a Workflow to simulate the Drafts action for passing a Markdown note to Evernote. The entire workflow is comprised of the ‘Make Rich Text from Markdown’ action passed into the ‘Create New Note’ from Evernote action, and it works perfectly.

My initial thought had to do with the Markdown engine Evernote uses vs that which Drafts uses, which may be correct, but I don’t think that’s what’s going on. In the Workflow action from Evernote to create a new note, entering a title is optional. In Evernote I have the option turned on which titles the note from the first line of the text passed to it. If the Drafts action could have that ‘Title’ field made optional, we might get this to work.

While ugly (and l imagine there is a better way to do this)… I “resolved” this by adding the following to the end of my script. The action has been working fine since I added this back in May. — jay

// the following is a kludge to workaround malformed title line
// added the first line to be the properly formed title line (text followed immediately by \n)
// the Evernote action uses the [[body]] tag so the first line of the draft is skipped
// 
begin = draft.title + "\n" + begin.slice(0,-1);
end = end.slice(0,-1);
draft.content = (begin + "  \n" + end);
draft.update();

That’s just weird. Still very hard me to troubleshoot since I’ve never been able to reproduce it and it only seems to be happening for a few lucky users.

I can confirm the same issue - drafts to Evernote removing spaces in the title

Hi Jay,

did you just add this as a “script” as a second step in your draft action?

Thanks,
Brandon

Brandon, the good news is my script has continued to work (and I use it frequently). I couldn’t remember how I last left it, so I just checked.

Two Steps:
Script
Evernote

The Evernote step uses
Note - Meeting: [[title]]
Template - [[body]]

The end of the script includes the following logic:

// the following is a kludge to workaround malformed title line

// added the first line to be the properly formed title line (text followed immediately by \n)

// the Evernote action uses the [[body]] tag so the first line of the draft is skipped

//

begin = draft.title + "\n" + begin.slice(0,-1);

end = end.slice(0,-1);

draft.content = (begin + " \n" + end);

draft.update();