Extended functionality for F2

I wanted to familiarize myself with Directory Opus a bit, so wrote the following replacement for the 'F2' keyboard shortcut.

Out of the box, 'F2' will put the selected file in inline rename mode.
Using the following code, that behaviour stays the same, but pressing 'F2' when multiple files are selecetd, will open Advanced Rename for these files.


  • Right-click the Directory Opus title bar
  • Select Customize
  • Activate the Keys tab
  • Double-click 'F2'
  • Fill in the fields as below
  • OK
  • Done.

There are probably better ways (please post them!), but I had enough after an hour and a half trying to figure things out.
Maybe it can help someone ...

(The forum has instruction on how to post button-code, etc on the forum, but couldn't figure out how to post hotkey-code. This is the best I could think of)


'  Pressing F2 when single file selected => Inline rename
'  Pressing F2 when multiple files selected => Advanced rename
'  (do nothing in other cases)

Option Explicit
Function OnClick(ByRef clickData)

	Dim selectedcount

	selectedcount = clickData.func.sourcetab.selstats.SelItems
	If selectedcount = 0 Then
		DOpus.Output "No files"
	ElseIf selectedcount = 1 Then			' Single file
		clickData.func.command.RunCommand "RENAME INLINE"
	ElseIf selectedcount > 1 Then			' Multiple files
		clickData.func.command.RunCommand "RENAME ADVANCED"
		DOpus.Output "Something is really wrong here"
	End If
End Function

1 Like

There's a built-in command which does the same thing:

Rename INLINE=single
1 Like

O wow! That makes life a lot easier :smile: Thanks!

(nevertheless: learned a lot in the process and that was my goal)


This is the solution to a question I was about to ask. I thought there might be a setting in Preferences that automatically opened the mass rename dialog if more than one file is selected.