GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Copy paths of selected files to clipboard

Hi,

I have a button with this:

Clipboard COPYNAMES

This copies the full paths and the names of the selected files to the clipboard.

Another button has this code:

Clipboard COPYNAMES=nopaths

This does the same, but hides the paths. It copies only the filenames of the selected files to the clipboard.

Now, what I want to achieve is a button that copies all the paths (without the filenames) of the files that are selected (flat view: the selected files have different paths)

I can't come any closer than this:

@nofilenamequoting
Clipboard SET {filepath$|..}

The result is only one path. It's always the path of the last selected file.
I think this code overwrites the clipboard for every selected file.

However, can anyone figger out the right code?

Thanks!

Daan

Use this button to copy the paths including the terminating backslash "" character.

<?xml version="1.0"?> <button display="label"> <label>Copy Paths</label> <tip>Copies the folder paths of all selected files and folders to the clipboard (includes terminating &quot;\&quot;)</tip> <icon1>#copyfilenames</icon1> <function type="normal"> <instruction>Clipboard COPYNAMES REGEXP &quot;(.*\\)([^\\]*)&quot; &quot;\1&quot;</instruction> </function> </button>

Use this button to copy the paths excluding the terminating backslash "" character.

<?xml version="1.0"?> <button display="label"> <label>Copy Paths - noterm</label> <tip>Copies the folder paths of all selected files and folders to the clipboard (excludes terminating &quot;\&quot;)</tip> <icon1>#copyfilenames</icon1> <function type="normal"> <instruction>Clipboard COPYNAMES REGEXP &quot;(.*)(\\)([^\\]*)&quot; &quot;\1&quot;</instruction> </function> </button>

Read This FAQ: How to add example buttons to your toolbars and menus

NOTE: The toolbar buttons above use an icon from this icon set: Opus 9 Unofficial Extra Icons.

You should also realize that you will most likely get duplicate paths in the clipboard using either button above.

This is exactly what I mean

Thanks!