How to copy selected text to clipboard

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

How to copy selected text to clipboard

Post by Papoulka »

My overall goal is to create a user button that will do a Search & Replace on all files in the current folder, deleting from each filename the text that I have highlighted / selected in one of those filenames. My script now looks like this:

Code: Select all

selfilter , f;
 rename s, <clipboard>/, p;
However, I have to press Ctrl-C myself before running it, to get the selected text onto the clipboard. I would like to use:

Code: Select all

#201;
 selfilter , f;
 rename s, <clipboard>/, p;
but #201 drops what I have manually selected and instead selects the whole name.

--> To fix this I need the script equivalent of "Ctrl-C", so that I can highlight part of a filename and have that text (only) copied to the clipboard. Unfortuntately, using #201 does not copy the selected text; it copies the whole filename (less extension).

Thanks for any suggestions.


-----------------
Searching, I did find a thread which indicates that copying the selected text can't be done. However, XY has so much capability, and this seems like such a mundane thing, that I want to ask before I give up.

ref thread: http://www.xyplorer.com/xyfc/viewtopic. ... xt#p118006

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: How to copy selected text to clipboard

Post by bdeshi »

#201 actually copes the selected file. In fact none of the Edit > Copy/Cut/Paste is work with text. They're file operations.

That said, try this script.

Code: Select all

::sendkeys ^c; /* ^ = CTRL*/ wait 1 /*or 10*/; /*sendkeys needs time*/ selfilter , f; rename s, <clipboard>/, p;
I suggest you assign this to a ctb Lclick script. Trying to trigger the script any other way will deselect your text.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: How to copy selected text to clipboard

Post by Papoulka »

Thank you, Sammay! I will try this out.

Post Reply