Page 1 of 1

script question: copy path

Posted: 25 Aug 2015 15:35
by Gogolo
Hi

I'd like to have a script which automatically copies the full path (e.g. "c:/adb/adb.exe") of a file to the clipboard when I click on it (open it). Is this possible? If so, can somebody help me doing this? That would be very kind, thx!

Greetings
Olivier

Re: script question: copy path

Posted: 25 Aug 2015 15:38
by highend
Although this is possible (via a CFA), I wouldn't recommend it. Why don't you use Ctrl+P (File | To Clipboard | Item Path/Name(s))?

Re: script question: copy path

Posted: 25 Aug 2015 15:52
by Gogolo
Thanks for your answer! Why shouldn't this be done?

something like: "if a file is selected, copy path to clipboard" should not be done?

it would be helpful beacause of a workflow opening pdfs and paste the paths to it later in a knowledge management tool (with the surface 3 tablet, so shortcuts would be complicated and one tap opens the file directely)

Re: script question: copy path

Posted: 25 Aug 2015 16:45
by highend
(open it)
CFAs are only available when a file is opened, not when it is just selected.

The only option would be: https://github.com/XYplorer-Scripts/ItemUnderMouse
but ofc you would need to edit that to suit your needs...

Re: script question: copy path

Posted: 25 Aug 2015 17:17
by Gogolo
sorry I didnt write it correctly, I want the path to be coppied when I open the file, not just select it. precicely: When I click on a file the path is copied to clipboard AND it opens (with the default application).

I looked into PFA but cant accomplish it. When I put *>::copytext <curitem> on top it copies the path but no file is being opened anymore. :( is it possible to use sort of AND function? thx!

Re: script question: copy path

Posted: 25 Aug 2015 17:42
by highend

Code: Select all

*>::copytext "<curitem>"; run """<curitem>""";

Re: script question: copy path

Posted: 25 Aug 2015 17:44
by Gogolo
:appl: perfect, thx very much!