How to auto-skip locked files in VBScript rename operation

I'm using the following VBScript as a Rename preset, to rename specific files that match certain criteria.

Option Explicit
Function OnGetNewName(ByRef getNewNameData)
	Dim idx
	Dim item
	Set item = getNewNameData.item
	If LCase(item.ext) = ".mp4" Then
		idx = Instr(item.name_stem, "_chr2_prob3")
		If idx > 0 Then
			OnGetNewName = Left(item.name_stem, idx - 1) & " (4K, 60 fps)" & LCase(item.ext)
		End If
		idx = Instr(item.name_stem, " 4K_prob3")
		If idx > 0 Then
			OnGetNewName = Left(item.name_stem, idx - 1) & LCase(item.ext)
		End If
	End If
End Function

It works fine, but the only problem is that, if one or more files are locked (i.e., open in other applications) I get a dialog pop-up asking me if I want to skip the rename operation on the locked files. What I want to do is to auto-skip all locked files and proceed with renaming all unlocked files.

Is this possible, and how can I do it?

Many thanks.

There's a Skip All option in the dialog:

Also accessible by holding Shift and clicking Skip.

Hi Leo, thanks for the reply.

Yes, I know about this, and I should have made it clearer in my first post. I would like to suppress this dialog entirely. The reason is that there will almost always be one or more files that are locked, so this dialog will almost always pop-up, and I will have to always repeat the exact same "Skip all conflicting files" action.

I was (still am) hoping that there is a way to completely suppress this dialog and skip all conflicting files silently, so only the unlocked ones will get renamed. Something like

On Error Resume Next

which, unfortunately, doesn't work in my case.

Thanks, that makes sense!

We'll add a way to do that in the first beta after 12.23 is out, which should be fairly soon.