Help In Creating Button To Rename Selected File From Clipboard Content

I have looked through the button section of the forum, and could not find an example close to what I'm looking for. Would someone please provide me with the button code to make a button to rename a selected file with the name that is in the clipboard? I would appreciate it very much! Thank you.

If you want to preserve the file extension,

Rename FROM {file} TO {clip} IGNOREEXT

Take out the IGNOREEXT keyword if you want to replace the file extension as well.

Thanks for that Jon, however it's not doing what I'm wanting it to do. When I enter the code of

Rename FROM {file} TO {clip} IGNOREEXT

And having a new name already in the clipboard, with a file selected, what happens is when I click the new button the Rename box pops up, and it's just like I select the Rename function from the main menu. And on top of that, the top two lines on the left have the same name in them, original and new are exactly the same...

So, that's not really what I was looking for. Could I have entered the code wrong? Also, yes, I would like to keep the original file extension.

IGNOREEXT is new in Opus 12. If you're using Opus 11 it won't work and may cause the Rename dialog to open because it thinks the argument is something else.

A rename script could do it in Opus 11 but would be a bit more complicated.


If the aim is something you use from the file display (not as a preset in the Rename dialog), another option is to use F2, Ctrl-V, Return to paste what's in the clipboard over the filename while preserving the extension. The extension is not selected by default when you push F2 so you can paste over the rest of the name without having to adjust anything.


Slight improvement to Jon's command for Opus 12, in case there are spaces or things that look like other arguments in the clipboard:

Rename FROM {file} TO="{clip}" IGNOREEXT

I certainly do appreciate the help, but again, no joy in those suggestions. Yes, I am using Opus 11 Pro V11.19 .

I first tried removing the IGNOREEXT from the button code, selected a file, pressed the button, and I got a pop-up error message.I took a screenshot of it, but I do not see any way to attach the image file here.

It said that "An error occured renaming "WHATEVER.jpg" : The filename, directory name, or volume label syntax is incorrect. (123) So I aborted.

OK, so from there I tried your suggestion of using F2, Ctrl-V, Return with no joy either. First I selected the file, then I pressed F2, but nothing happened. Then I pressed Ctrl-V and a new file was created named Clipboard Text.txt . The Return was not even needed, but I did it anyway, without any obvious result.

Any chance of getting that rename script you referred to?

UPDATE: It seems like I did something wrong the first time I pressed the button, after removing the IGNOREEXT part. I tried the button again, and now it does change the filename to what is in the clipboard, however it removes the ext and does not append anything. So, I'm left with the desired filename, but with no extension.

We're getting close.. Any suggestion as to how to retain the file extension in Opus 11??

Drag images to the post editor to attach them. (Or use the Upload icon above the editor, or Upload link if on mobile.)

If F2 no longer inline-renames files in the file display, you must have customized the toolbars/hotkeys quite a lot and removed the default F2 command (Rename INLINE).

Or were you trying F2 somewhere else?

Well, I feel really dense now, not having noticed the text instructions when I first open the reply editor window, or even more when not noticing the upload button right above this text section. Sorry for being so un-observant, I'm normally not this way..

Anyhow, you are most likely correct in that I have reconfigured the F2 hotkey setting sometime in the past. I've used Opus for so so long, that I just cannot recall. But I'll set it back to what it should be, and try again. Thanks!

This script does more or less the same thing in Opus 11:

@script jscript
function OnGetNewName(getNewNameData)
{
	var clip = DOpus.GetClip();
	if (clip)
		return clip + getNewNameData.item.ext;
}

Or as a command for a toolbar button / hotkey:

Rename PATTERN * TO *
@script jscript
function OnGetNewName(getNewNameData)
{
	var clip = DOpus.GetClip();
	if (clip)
		return clip + getNewNameData.item.ext;
}

Now that works perfect!!! Using the command for a toolbar button code you provided, brings the desired result. Fantastic, thank you !!