OnGetNewName event and its parameters

When is OnGetNewName event called? Is it called both times - for preview and for actually renaming the files? If it's called for both times, can you add a parameter indicating the context of the call i.e. whether it's for preview or for actual rename operation?

In another thread, I discussed possibility to use a different command to rename. This request is in continuation of the same. Having a context parameter would allow us to trigger a custom command to rename the file while returning "True" so that DOpus doesn't actually attempt to rename it.

It's called for both, otherwise the preview wouldn't work. You can put some DOpus.Output lines in your script to see when it's called.

We could probably add a parameter which tells the script if it's being called for a preview. What kind of thing are you doing where the preview and actual rename need to do different things?

I plan to return OnGetNewName=False or OnGetNewName="string" during preview and OnGetNewName=True when actually renaming the files. So, I'd handle the rename operation in the script itself instead of letting Opus rename the files. This way, I can execute a special rename command like git mv <old name> <new name> for each file instead of the default filesystem rename command.

1 Like

Makes sense! We've added that for the next beta.