How to copy path to clipboard?

When a file or directory is selected, I want to press Ctrl+P to have its path copied to clipboard.

Examples:

With a folder selected, upon Ctrl+P, "C:\share\Work Related\Demos\Joann Stores\Output" (w/o the quotes) should be copied to clipboard.

With a file selected, upon Ctrl+P, "C:\share\Work Related\Demos\Joann Stores\Output\latest.tbk" (w/o the quotes) should be copied to clipboard.

Possible?

TIA.

Clipboard COPYNAMES={filepath} 

seems to be a starting point. Ctrl+P now copies the full path of the folder or a file.

But if it's a folder that's currently selected, I would like to have a "" appended to the path.

Possible?

I can't think of a good way to add the \ at the end when directories are selected, except by writing some VBScript to do the job (which seems like overkill but if you really need it it could be done).

By the way, Clipboard COPYNAMES={filepath} is wrong and only works by chance. See HOW TO: Copy selected filenames to the clipboard for the correct usage.

There's also Clipboard SET which can set the clipboard to any string. Clipboard SET {filepath} is valid and does the same thing as the basic Clipboard COPYNAMES, except that the SET version won't properly handle more than one selected filename while the COPYNAMES version will.

[quote="sri"]Clipboard COPYNAMES={filepath}

seems to be a starting point. Ctrl+P now copies the full path of the folder or a file.

But if it's a folder that's currently selected, I would like to have a "" appended to the path.

Possible?[/quote]

i need this too, are there any new developments to allow this?
i have 2 wishes:
1] a button that will take the current path of a selected file and put in the clipboard only only the path portion, not the file name itself, and have a trailing
2] same as above except when acting on a folder supply the trailing \

This will do that:

Clipboard SET {filepath$|..}\

You want the parent path of the folder, or the path to folder itself?

This will do that:

Clipboard SET {filepath$|..}\

You want the parent path of the folder, or the path to folder itself?[/quote]

Thanks Leo!
#1 worked nicely, maybe someday i will figure this stuff out

for #2 the same also does just what i want when i select a folder

where do i look to learn about this under 'SET' ?, esp about the |..

thanks again for your help
ds

where do i look to learn about this under 'SET' ?, esp about the |..

Open the Opus Help file and in the index look for the page named Command Control Codes.

Basically this is the breakdown of Leo's [b]Clipboard SET {filepath$|..}[/b] command.

Clipboard set means what follows it will be copied to the Windows clipboard.

{filepath$|..} filepath$ by itself would return the selected item's full file path and name while |.. modifies it to return just the parent folder's full filepath.

\ is simply appended to the end of it.

[quote="JohnZeman"]where do i look to learn about this under 'SET' ?, esp about the |..

Open the Opus Help file and in the index look for the page named Command Control Codes.

Basically this is the breakdown of Leo's [b]Clipboard SET {filepath$|..}[/b] command.

Clipboard set means what follows it will be copied to the Windows clipboard.

{filepath$|..} filepath$ by itself would return the selected item's full file path and name while |.. modifies it to return just the parent folder's full filepath.

\ is simply appended to the end of it.[/quote]

so looking at this help i am more confused than before, in the first section titled {filepath} near the end of that block it shows
{file} (not {filepath}, why ?)
{file|..} would insert C:\Data\Letters /
why is there a space then foward slash ?
ok, i guess it is a terminating character but since |noterm was not used why did it not show in Leo's example?

BTW, what is driving this is that i have a few applications that are very brain dead about where they go for file save and file open applications

by having Dopus open to a desired target folder i can copy the target path and paste that into the other apps file save box in front of the filename which saves a ton of clicking to navigate across drives and long paths over and over again

{file} is just the file name without any path. {filepath} is the full path, including the name on the end.

Don't use {file|..} as that doesn't really make any sense: You're telling Opus to get the parent of a file name, not a file path.

@dsicon:

Besides any 'academic' value discussing the mechanics of what, why and how the command does what it does might have, since the one command worked for both your 'selected' file and 'selected' folder cases... you should know you can also use the command: Clipboard SET {sourcepath}

This is because in both file and folder cases, you seemed to want the 'path' to those files and folders without the file or folder name... and the 'path' to any selected item is always in {sourcepath}. This control code also automatically appends ythe trailing [b][/b] character...

If you're in a collection then {sourcepath} will be wrong but {filepath|..} will still work.

I have the button command
Clipboard COPYNAMES {full}
and i want to add a trailing \ into the clipboard contents

Clipboard COPYNAMES {full}
does not work

am trying to get the full path of an empty folder including the folder itself and a trailing \ into the clipboard

Clipboard COPYNAMES {full}
is working nicely for what i want to do except for the lack of the trailing \

thanks

Clipboard COPYNAMES REGEXP (.*) \1\

well thanks but not quite
if i have an empty folder and in the FOLDER TREE
i use
Clipboard COPYNAMES {full}
then except for a trailing
this does what i want

your command does not seem to work in the folder tree
but does work in the files list

Jon's command works fine with the folder tree for me.

You have to click the button when the folder tree has focus. i.e. The tree should be the last thing you clicked on and there should be a dotted line around the selected folder there.

If the file display has focus instead then the button will run on whatever is selected there (even if that means nothing).

BTW, the {full} in your command doesn't mean anything and Opus is ignoring it. It's the same as doing

Clipboard COPYNAMES {bananas}

:slight_smile:

How can I copy the target path (without file name) of an .lnk to the clipboard?

The quickest way without a script is running

Go OPENCONTAINER=target

and then copying the location bar (Ctrl-L, Ctrl-C).

Thanks, I've seen this command in the context menu, but didn't think it was the only one. So there's really no variable like {targetpath}? :unamused:

I've tried out this:

Go OPENCONTAINER=target
Clipboard COPYNAMES=unc FILE {sourcepath}

But it's not good enough, because it navigates there (which I don't want) and even if I expanded on the function by navigating back or saving the lister layout, it would still be visible.

Is there a way to execute such commands in the background without changing anything in the current lister ?

If you link your account I can show you how to do it.

Sure, thanks... One license was already ordered for my work PC last week and should arrive soon and I plan to buy another one when my 60 days trial period ends.