Jump to content
2019 Calendar Templates Read more... ×
Gorkycreator

Command-line argument "showNotes" does not permit phrases

Recommended Posts

I recently learned about passing arguments to ENScript.exe through cmd to call up searches in Evernote, and have successfully tested it with notebooks and tags, but I run into a problem when I attempt to find a search that requires spaces in a tag or notebook title. The standard search terminology that I would enter into the Evernote search bar would be:

notebook:"Some Things" tag:"My tag"

Unfortunately, because of some way the arguments are being processed, when I execute this command:

>>> ENScript.exe showNotes /q "notebook:SomeThings"

…it opens Evernote to a notebook called "Some" and notes containing the word "Things". Shuffling and/or adding quotations around in various combinations didn't seem to solve anything. Has anyone else ran into and/or solved this issue, by chance?

Share this post


Link to post

You"ll find it easier to work with names if you don't embed spaces.  
Drop the space, or use _ ; otherwise you have to use quotes to define the name.

A solution using the \ escape character was presented here

 

  • Like 2

Share this post


Link to post
8 hours ago, Gorkycreator said:

Unfortunately, because of some way the arguments are being processed, when I execute this command:

>>> ENScript.exe showNotes /q "notebook:SomeThings"

I think that Evernote could be better at handling space-delimited arguments end-to-end from ENScript to the Evernote application. I'm not sure where it's going wrong, but if I recall correctly, the ENScript receives quoted command line parameters like "notebook:Some Things" as a single parameter without the quotes, and uses that to build a search for Evernote.exe. Hard for me to tell.

The good news is that you can make this work by adding an extra set of quotes in a tricky way: "notebook:\"SomeThings\"". The '\' characters cause the following quotes to be retained, so that they're passed along to Evernote.exe as notebook:"SomeThings" and that will be interpreted correctly.

Edit: Ha-ha -- I just followed @DTLow's link to @emerick's identical solution, which I'd forgotten.

Share this post


Link to post
32 minutes ago, jefito said:

I think that Evernote could be better at handling space-delimited arguments end-to-end from ENScript to the Evernote application.

I don't think we can blame Evernote for this.
We have the OS launching ENscript launching Evernote.

The OS is parsing the command line, including all quotes.  
We need to escape this parsing for specific Evernote quotes; hense the use of the \ escape character.

Share this post


Link to post
6 minutes ago, DTLow said:

I don't think we can blame Evernote for this.
We have the OS launching ENscript launching Evernote.

I'm not going quite so far as blaming Evernote for this, but it  certainly is possible for Evernote to change ENScript to avoid this situation, if the problem is what I think it is. It's true that the the command-line processing by the OS (or in this case, cmd.exe) strips external quotes when handing the arguments to ENScript, but the escaped quotes are retained, which is why the suggested fix works. But people can get tripped up by this if they don't know about escaping. ENScript could remedy that by  just automatically adding quotes -- if they aren't there already -- to the arguments of tag:, notebook:, stack: and other special terms before passing them along to Evernote.exe. This would make space-delimited arguments work; arguments that aren't space-delimited wouldn't be affected. And if the user has properly escaped their arguments, then that should work as well. Sure, escaping quotes (and other characters) is technically correct, but non-technical users don't have a good chance of figuring that out. Doing this means that users that couldn't figure out the escaped quotes trick wouldn't be surprised. This would go under the notion of "could be better at handling space-delimited arguments", and also fits with "Postel's Law" ("Be conservative in what you produce, and liberal in what you accept")

Share this post


Link to post

Use a . or _ versus the space and the discussion is moot.   Non encript actions will be simpler as well.

Share this post


Link to post
On ‎11‎/‎7‎/‎2018 at 4:18 AM, DTLow said:

A solution using the \ escape character was presented here

 

Ah, thank you! I hadn't considered using escaping quotations to include the quotations for what was being parsed into Evernote.

Non-embeded spaces are a good workaround, but I'd rather put in the extra backend work for easier front-end legibility!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×