Are you running it fullscreen? i ticked fullscreen in the options and it works fine for me in both LB and BB, didnt need any of these extra steps. Also added
$ESC::
{
Process, Close, {{{StartupEXE}}}
}
to running script so it closes the program rather than just stop emulation.