Autohotkey: launch viewer, then also focus it

An autohotkey script launches Windows’ default viewer for a file %XX%
with the command
Run "C:Windowsexplorer.exe" %XX%.
The launched app depends on XX’s file type: a .mp4 might launch VLC,
a .jpg might launch IrfanView, a bare folder would launch Explorer itself.

Sometimes, randomly, that app is not given focus.
(But it always gets focus when that command is given in PowerShell.)
Can that app be given focus, even without knowing its name beforehand?

  • Find the most recently opened window, and focus that?

  • Figure out which viewer Windows must have launched, and if that viewer has more
    than one window open, figure out which one came from Autohotkey?

  • If it’s some kind of race condition, add a sleep or something to the script?