You can use a autohotkey script or, if you have the registered version of FSUIPC, a lua script for this.
As an example, I have the following FSUIPC lua script to to switch to VirtuaWin desktop #2 and focus FSX if I press any button on my yoke or joystick:
function focusfsx(joynum, button, downup)
if not ext.hasfocus() then
handle = ext.gethandle("VirtuaWinMainClass")
ext.postmessage(handle, 1034, 2, 0)
ext.focus(0)
end
end
event.button("Y", 255, "focusfsx")
event.button("J", 255, "focusfsx")
|
(I have PF3_Display running on virtual desktop #1, so I can switch to it by using a VirtuaWin hotkey, in my case Flag key + 1, but when I switch back to FSX using Flag key +2, sometimes FSX does not have focus, because of that I wrote above script)
But you can ignore the VirtuaWin stuff and just use ext.runif to start PF3_Display, which returns a handle. You can then use ext.focus(handle) to focus this window. Perhaps ext.gethandle can be used for this, too, but I'm not sure.
If you want to use autohotkey (free as in free beer and free speech), you could search for "autohotkey focus window" to get some ideas how to configure it.