The F9 solution is neat - Thank you! Works well for me too.
You said:
I added a command line at the end of the script so that when you press OK or CANCEL the image viewer moves on to the next image.
What is this command? I might try it too.
I have another problem though: my joy for having a 'perfect script' for changing the picture metadata was short-lived. The 'Date Taken' field when changed in Opus (be it in the metadata panel or by script) is not recognized by picture editing programs like Lightroom. But when changed in these programs is seen OK by Opus.
I created a separate post about it 'Date Taken' metadata Pandora's Box & Lightroom.