Double quotes in user description

I'm using the following to enter clipboard text as the
I'm using the following to enter clipboard text as the User Description:

SetAttr DESCRIPTION "{clip}"

  • which works fine unless the clipboard contains any double quotes. Modifying the clipboard contents to escaping the double quote with a single quote doesn't improve things. Repeating the double quote works, but results in the description text containing the repeated double quote. If I invoke the Set Description dialog by omitting the "{clip}" argument above and then manually paste clipboard contents that include double quotes, it works fine. Any ideas?

Easiest solution is to avoid double-quotes, and turn them into something else, otherwise you'll be fighting the argument parsing.

Using the 66 99 unicode quote characters is one option. For example, this works without issues:

SetAttr DESCRIPTION "The cow said “Moo!”"

A script could automatically modify the clipboard text as part of operation.

There are some other tricks that can be used instead but I'm not sure if they're guaranteed to keep working, as they may rely on quirks of how the argument parsing works which could change over time.

Thanks, Leo. That was the conclusion I'd essentially come to, but it's nice to have it confirmed by someone who actually knows. I haven't tried a script within DO, but I do have AutoHotkey macros to remove newlines in clipboard text, so my first approach was to simply add a line there that also removed or replaced double quotes. And I've considered a macro that invokes the Set Description dialog and pastes the clipboard text there, but I was hoping for a slicker solution within DO.

I would be interested to hear some of those other tricks you mentioned, if you're inclined, just as a way to maybe gain more insight into the workings of DO. Thanks again.

If you double quotes at the start or end, that seems to work. Quotes inside the string seem to work as-is provided they aren't next to a space. Replacing spaces that are next to quotes with other characters that look the same (e.g. a non-breaking space) may work for those, although I didn't test that.

We could potentially add a second description argument that uses the Raw argument mode so it takes the rest of the command line as-is.

I definitely vote for the Raw argument mode addition as it sounds like the best idea for a fix, but I have to admit this falls under the category of "nice to have", not "got to have".

1 Like