GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Command: RenameFromClipboard

Thanks tbone, I use the rename tool all the time, generally regular expressions works fine. I am always digging through the form and the manual in order to get more out of Dopus which I consider the most essential software in my computers. I stumbled on your script and I like it.

Thank you very much tbone, exactly what I was looking for (and tried in vain to do) :slight_smile:

Can this be worked into a single button that renames destination files based on source file names?

Maybe! Can you give an example? o)

Sure! Let's say I have a folder filled with Season 12 of The Simpsons that I ripped from DVD. Now let's say I buy it on Blu-Ray and rip better quality versions into a second folder.

It would nice to navigate to both folders, then hit a button to rename the new videos to match the names of the old videos.

That's what it's for.. o)

Select the files in the source and copy their names to the clipboard with "Clipboard COPYNAMES".
Then switch to destination, select the files to be renamed and run "RenameFromClipboard".

You could do all that in a single button, by selecting all, copying the names, toggling focus, selecting all in dest and running the renamefromclipboard command, but unless that's a task you do very regularly, I would suggest adding "RenameFromClipboard" to the context menu for all files and folders, so you have it at hand in other use cases as well. It takes a few more keystrokes then, but you are more flexible.

Thanks. I know that's what it's for - that's how I currently use it. I just wanted to save some keystrokes/mouseclicks since it's something I do a couple times a week lately.

Ok, sorry. I got you wrong then.. o)

Try this..

Select ALL
Set FOCUS=toggle
Select ALL

Cool beans, thanks :slight_smile:

Slight edit, the second line should be Clipboard COPYNAMES=nopaths

Also, how can I tweak the script so it just copies file names, and not file extensions?

Try this..

RenameFromClipboard COMMANDS=Rename FILEINFO FROM="%item.realpath%" TO="%item.new_name%.{ext}"

Thanks tbone. That code keeps the source file extension though. So if I copy names from .avi files to .mkv files, I get:

Video File Name.avi.mkv

Try this one..
Command.Item_RenameFromClipboard.js.txt (26 KB)
With this commandline:

RenameFromClipboard COMMANDS=Rename FILEINFO FROM="%item.realpath%" TO="%item.new_name_stem%.{ext}"

It's amazing, but when I use the command of below to rename a folder and some files, it can't be Undo.

RenameFromClipboard COMMANDS=Rename FILEINFO FROM="%item.realpath%" TO="%item.new_name%.{ext}"

Mhh.. I tried the exact command and DO let me undo the rename just fine (single and multiple files).
Maybe it is location dependent? Were some UNC paths or some other non-standard locations involved?

Did you use the version I uploaded for newguy (I did) or the latest from the thread opening?

I am using the v0.3.
Have you got a folder involved?

Great script! Thanks a lot!

A great script indeed, many thanks!

for testing purposes I regularly rename filenames. my current 'procedure' is as follows:

  • open clipboard manager
  • search for the list of random filenames I stored there
  • clipboard copy a selection (have to estimate how big the selection should be, so there are sufficient filenames in the clipboard)
  • go to Opus
  • perform the RenameFromClipboard

I wonder if, based on the RenameFromClipboard, it would be possible to have a kind of RenameFromFile.

  • the list of randomfiles (that is quite a big list) stored in the Opus folder
  • then perform the RenameFromList

the RenameFromList to:
-open the list of containing random files
-use the names there

to avoid errors when renaming in case of already existing filenames

-remove the name from the filelist (if at all possible of course), so the list of filenames in the Opus folder gets smaller over time
-just add _01 when renaming, so the filename becomes : randomxyzfilename-01.tst

So, in the end: instead of using data from clipboard, use data from a .txt file stored in Opus folder.

What do you think?


After reading this for several times, it seems to me as if you're better of doing it with a separate script or something. I actually don't get where the list of random file names comes from. Could that be generated maybe, is it even necessary? Additionally, I don't get how you determine the number of files to copy from that list. And then, how do you do the required selection in the file display to finally run RFC? Maybe a separate short snippet, which runs upfront to read the file and copy some items from there to the clip is a start/an option.

That said, I think I won't add support for input from files here. This command is deprecated, there is RenameEx (did not upload recent version it seems or still need to merge what I have prepared here, oops! o). Additionally, I thought about a method to streamline script in/output of items, because the "source" question comes up again and again. You want items from file, the next buddy from destination display, someone else likes to pass items by commandline and for me, I might prefer to pass item names by a DO vector for increased script interoperability. So, instead of adding support for the various in/output buckets each time - implemented differently in the worst case (parameter names e.g.), it seems there should be an universal approach, which can be put in place and "done". Making requests like this the past. I've started on that thing already and use it in a script addin not published yet (TFS source control). It's a matter of time (or big money! o), when things will enhance and move on from there into other script commands.

Does this make sense to you? Thanks! o)