Surround file URL with quotes?

Hi,

I use the command Clipboard COPYNAMES=url to copy a file URL to the clipboard. Doing this DOpus automatically replaces spaces with "%20".

How can I get DOpus to additionally surround the URL with quotes if the URL contains spaces?

Did you try the escape character?

Not sure what you mean.

The escape character in Opus is the apostrophe ', that has to be put before the character, which is to be escaped. Maybe you can read a few example posts, searching for "escape" & "character" in these forums.

Still not sure how the Escape character could help with the problem I posted above.

To better clarify the problem:

  1. Select a file or folder in DOpus.

  2. Excute the command Clipboard COPYNAMES=url (e.g. from a button or a Key command).

3a. If the path of the selected folder for example was F:\delphi\LAM DOpus then DOpus copies the text file:///F:/delphi/LAM to the clipboard. This is good.

3b. If the path of the selected folder for example was F:\delphi\LAM (Lightning Attachment Manager) DOpus then copies the text file:///F:/delphi/LAM%20(Lightning%20Attachment%20Manager) to the clipboard. This is also good. But I want that in this case (when the original path contained spaces and the text copied to the clipboard by DOpus now contains "%20") the text copied to the clipboard by DOpus should be surrounded with quotes. I.e. the text copied to the clipboard by DOpus in this case should be: "file:///F:/delphi/LAM%20(Lightning%20Attachment%20Manager)"

You can't. You could use the regex option to add the quotes in all the time but there's no way to have it happen automatically. Why do you need this anyway? The quote character isn't valid in URLs any more than spaces are.

I have a program KeyNote. In this program, when a folder/file URL contains "%20" AND ends with a parenthesis it does not work unless it is surrounded by quotes.

OK, this doesn't happen very often and is a bug inside the program which seems I have to live with.

Well why not just always add the quotes then? Or does Keynote fall over if there are quotes when it doesn't contain a percent sign or something?

This does what you want:

Clipboard COPYNAMES=url REGEXP "(.*%20.*)" ""\1""

A better solution (since it keeps the URL valid in other programs), is to escape the brackets as well:

Clipboard COPYNAMES=url REGEXP "(.*)\((.*)#" "\1%28\2" "(.*)\)(.*)#" "\1%29\2"

Leo, you really are a genius, thank you!!

(I now use the second solution and it works like a charm!)