for me, i have compile the script to exe with Autohotkey (named FX3exit.exe for me) :
~Esc::
KeyWait, Escape ; Wait for user to physically release it.
if WinExist("Pinball FX3")
WinKill ; use the window found above
ExitApp
then, in the Launchbox (Script Autohotkey of the emulator) put this :
Change PATHofEXE with the real path of your new FX3exit.exe
Run, "PATHofEXE\FX3exit.exe"
Like this, the Esc work as intended
PS : sorry for my bad english
Cheers