GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Paste from clipboard into internal command


#1

I want to use the contents of the clipboard to rename a file using the rename internal command.
So I tried this:
rename PATTERN "(.*)(\.*)" TO "clipboard paste \2" REGEXP
Should that work?
The closest I find when I search is an apparent attempt to do the same with the DO internal command but I am not sure if I am reading that post correctly.

Thank you, thank you...


#2

I assumed DO was an internal command but I dont see it in the internal command reference
So i dont know that that post is about


#3

Reading that same post again it occurs to me that DO is Directory Opus. Doh!!!!!


#4

You can use {clip} in commands to insert the clipboard contents:

(You can also access it from scripts if you want to do extra checks to make sure it's the right type of data, or extra processing on what's in the clipboard before sending it to the command. Opus provides methods to both get and set the clipboard.)


#5

Thank you Leo......


#6

When I try this it does not work:

rename PATTERN "(.*)(\.*) TO "{clip}\2" REGEXP

I am runniing that with one file highlighted from the CLI prompt >
I am expecting the file to be renamed to XXXXXX.ext because I have XXXXXX in the clipboard at the time of execution.
When I execute the command above the Rename dialog is bought up
Any ideas...?


#7

There are an odd number of quotes in that command. That would make it fail by itself.


#8

Thank you Leo as always.
For reference this works with ONE file highlighted. Multipe files will give a duplicate file name error:

rename PATTERN "(.*)(\..*)" TO "{clip}\2" REGEXP


#9

Do the files have the same extension? They'd get the same names in that case.


#10

I am often wanting to rename a file with the contents of the clipboard.
So I am only interested in a single file.
The rename command above is indeed only suitable for one file
My thanks once more