Rename as above file

In the Excel there is a shortcut key combination [CTRL]['] that automatically gets the cell content from its direct above cell and copies it to the edited cell.

I would like to reproduce the same behavior in inline renaming mode. Is this possible?

i.e. Having following file sequence:

02.S2. Automatic for the People.avi 02.S2. Automatic for the People.srt 03.S2. The Mousetrap.avi 03.S2. The Mousetrap.srt 04.S2. Allison From Palmdale.avi 04.TSCC.Allison.From.Palmdale.XVID.NOTV.srt

--> so - when being focused on the last file (04.TSCC.Allison.From.Palmdale.XVID.NOTV.srt) in inline renaming, pressing [CTRL]['] automagically gets the name from above file (04.S2. Allison From Palmdale), leaving the extension intact.

Resulted in:

04.S2. Allison From Palmdale.avi 04.S2. Allison From Palmdale.srt

I tried this, but of course it was too naive :slight_smile:. However I was surprised to see that Select PREV is actually not focusing the list item for further actions. Is there any way to work around this? Plus, I don't like the idea to use clipboard for such a simple task.

Select PREV
Clipboard COPYNAMES=nopaths REGEXP "(.*)\.(.*)" "\1"
Select NEXT
Rename REGEXP PATTERN="(.+)(\.[^.].+)" TO="{clip}.\2"

I think the problem with that was that the Select PREV/NEXT commands don't affect which files the button works on. They effectively only change the selection after the button has completed.

You can work around that by using DOpusRT to run each line as a standalone command:

dopusrt /cmd Select PREV
dopusrt /cmd Clipboard COPYNAMES=nopaths REGEXP "(.*)\.(.*)" "\1"
dopusrt /cmd Select NEXT
dopusrt /cmd Rename REGEXP PATTERN="(.+)(\.[^.].+)" TO="{clip}\2"

(Note that I also removed an extra . on the last line. The original line added an extra . before the file extension.)

Below is a slightly different version which I think is better because it doesn't trash your clipboard. With this version you should highlight the file above the one you want to rename (i.e. the one whose name you want to use) and not the file you want to rename:

@firstfileonly
@nofilenamequoting
Select Next
dopusrt /cmd Rename REGEXP PATTERN="(.+)(\.[^.].+)" TO="{file$|noext}\2"

[quote="leo"]I think the problem with that was that the Select PREV/NEXT commands don't affect which files the button works on. They effectively only change the selection after the button has completed.

You can work around that by using DOpusRT to run each line as a standalone command:

dopusrt /cmd Select PREV dopusrt /cmd Clipboard COPYNAMES=nopaths REGEXP "(.*)\.(.*)" "\1" dopusrt /cmd Select NEXT dopusrt /cmd Rename REGEXP PATTERN="(.+)(\.[^.].+)" TO="{clip}\2"
(Note that I also removed an extra . on the last line. The original line added an extra . before the file extension.)
[/quote]

Thanks for your effort Leo!

IMHO, such Select PREV/NEXT behavior has no purposeful meaning, but I'm fine with the developer's decision on that one. I'm the developer myself, so can't complain. :slight_smile:

Anyway, the first solution is better to me regardless that it trashes the clipboard, as I went on with the idea to mimic [CTRL]['] shortcut key. BTW, for a test I tried to get it working as a context menu on 'all files' filetypes. It just doesn't work. I guess I should configure it as a 'MS-DOS Batch function'? I am not sure if the scripting could help on this one, as I never really looked into the Opus scripting reference.

I am considering to file it as a feature request, as any of these solutions are obviously lacking something.

It shouldn't be an MS-DOS Batch type function. (At least, it doesn't need to be one. It might not matter either way, though.)

Anyway - it doesn't work for me neither if I run it as MS-DOS nor as Internal. Have you tested it maybe?

I tested it, yeah. Both the commands I posted seemed to work for me in 9.1.3.0

Nope. Ain't working properly. It behaves completely erratic. Sometimes it picks up upper, lower or some random file from the listview. Sometimes the only thing I get is a newly created "dopusrt" folder along with an error message. It could be something with my current DOpus configuration. :frowning:

Does it always do the same thing for each particular file?

If so, what's the name & path of one of the files that goes wrong?

It doesn't matter files, listers or HW configuration. I.e. I run Vista x64 at home. I also tried it at work where I run XP x86. On the other hand my friend has tested it as well and it works well for him. He's got more vanilla-like configuration. All latest versions (no Illuminati).

I can easily reproduce the problem:

(1) Select a file, move up, down with the arrow keys, fiddle around, click it... The script then renames relatively to the filename of the file not currently selected, but the file that was selected before it. It means - if I run "rename as the above" two times in a row, then I got myself correct result.

(2) Close the Opus. Reopen. Click "rename as the above". As the clipboard cannot get filled, the name of the file disappears, leaving only the extension. In this case repeating the action would not help, as the file has lost its name and has only the extension.

I still believe that I should file for a feature request for inline rename. We already have supported [CTRL]-- +[U], +[L], +[P], +[W], +[arrow down], +[arrow up]... so... I would like +['] that would pick up the upper file name.

Leo, don't you think SELECT PREV / NEXT should actually really select respective file/folder for perspective operation on it that would follow? I really don't see too much use about it otherwise.

If it due to the difference between the selected item(s) and the item with the keyboard focus (dotted line around its name)?

Maybe it should but the command wasn't intended for this sort of thing. It was added so that people could create hotkeys which select the next or previous file.

I am not sure if it's really selected since you cannot access it. I guess it's the matter of context and programmers' intent.

Regarding the 'script' - who knows what's wrong... Anyway, I don't feel like reconfiguring Opus all over again just to find out that it's dependent on something other cool thing that's also needed. Not to mention how much love I put into the customization... but then again, new customization means new adventure. :slight_smile:

To close - I think this inline upper rename is a nice thing to have since there are many dependent files out there. I really think it should be supported by default, just like other key combinations. Be it a [CTRL]['] hotkey or some other - it's less important. Therefore - I filed a feature request. :slight_smile:

Leo, thanks for all your involvement.

It's been 4yrs since this last post. Is there a hotkey for this functionality now, maybe?
I'd still like to have it, bypassing the clipboard.

I just push up, ctrl-c, down, ctrl-v if I want to copy the name above, which seems quick enough. (Or ctrl-f/ctrl-c when still on the previous file, before moving to the next, which will also put the filename into the clipboard excluding the extension.)

There still isn't a way, beyond some advanced scripting perhaps, to do it without using the clipboard. I don't think anyone else has asked for it so I don't think there is much demand, although it could still be added if it's not a lot of work (I'm not familiar with this code so I couldn't say off the top of my head).

We'll add this in the next update.

Is this because you did something to that other request "option to disable ctrl + up/down in inline rename"?

No.

Just thougt I got a clue on how you guys choose things to fix/add. o)
Your sudden replys to some threads from the past, telling that things got enhanced, made me wonder.
And.. I understood, will be silent now! o)

Hi! I'm a relatively new DO user here; I love the software!

I too would use 'rename as same' functionality. I often need to change subtitle SRT files to match their corresponding video names. Was this ever added to DO? This thread is the latest info I could find.

Thanks so much for your help!

Welcome to the forum!

Yes this was added a while back, to access it press Ctrl+Shift+Up or Ctrl+Shift+Down to copy the previous or next filename (hold the Alt key as well to copy the file extension too).

More information about inline rename features can be found here.