Command that opens advanced rename and pastes the clipboard

I would like to create a command that opens the advanced rename dialog and pastes the file names from the clipboard (multiple lines), so I can check what I pasted

I was thinking of something like this but it pastes only the first line in the clipboard to all the selected files.

Rename ADVANCED PATTERN="*" TO="{clip}" IGNOREEXT

Seems to be a feature request.

I don't know, I thought I was doing something wrong, the command already works, but only with one file. With multiple selections and multiple lines in the clipboard it doesn't do what I expected.

Advanced renaming already has a corresponding button, but it seems to have no parameters.

Do you want the clipboard content to go here?

2023-11-12 - 15.38.36 - Rename_-_Directory_Opus

I don't think that's possible.

The TO parameter always fills in this field, which can only hold one line:

Exact !! Now every time, I have to open the dialog, open the clipboard drop-down menu and select paste. I wanted to reduce the steps..

You could use

Rename ADVANCED PATTERN=* TO=* IGNOREEXT

followed by accelerator keys: ALT-CP.

More automation would probably require something like Autohotkey.

1 Like

You can also use rename preset.
Save as preset named "Clip":

function OnGetNewName(getNewNameData)
{
	if (DOpus.GetClipFormat() != 'text')
		return
	var clipText = DOpus.GetClip('text');
	var clipTextArray = clipText.split('\r\n');
	var tab = getNewNameData.tab;
	var selected = tab.selected;
	if (clipTextArray.length < selected.count)
	    return
	
	var item = getNewNameData.item;
	for (i = 0; i < selected.count; i++)
	{
	    if (selected[i] + "" == item + "")
		    return clipTextArray[i] + item.ext;
	}
}

Rename ADVANCED PRESET="Clip"

1 Like

Thank you!!!
Basically it works, the problem arises if there are illegal characters in the clipboard.
With built-in function when I paste it, Dopus corrects them from /\\:*?<>\|"" to ___;#!()_-''
Using the script in some cases generates subfolders

Maybe the text needs to be escaped?

function OnGetNewName(getNewNameData)
{
	if (DOpus.GetClipFormat() != 'text')
		return
	var wld = DOpus.FSUtil.NewWild();
	var clipText = wld.EscapeString(DOpus.GetClip('text'), "r");
	var clipTextArray = clipText.split('\r\n');
	var tab = getNewNameData.tab;
	var selected = tab.selected;
	if (clipTextArray.length < selected.count)
	    return
	
	var item = getNewNameData.item;
	for (i = 0; i < selected.count; i++)
	{
	    if (selected[i] + "" == item + "")
		    return clipTextArray[i] + item.ext;
	}
}

why can't I make script work?

Maybe your clipboard has fewer lines of text than the selected items?

nope

If you just pasted the script, you need to refresh.
image

no, sorry

Working here with Opus 13.0.45 and I'm out of ideas.