For me is easyer with Xpadder because i use a profile anyway for the controls even if i don't need a key to exit, i even have a profile to control mGalaxy
If you want you can easy modify the script and add a Function Terminate with Esc key
there are examples even on this forum
As for Xpadder or JoytoKey (this one is good too) if you want a free program
-it Autostart with Windows
-you can bind any key or combinations of keys on one button you choose, like your Esc on machine
EDIT: i see you got the ideea as i was writing it
That should work but need a little edit
HotKeySet("{ESC}", "Terminate")
{ your other code }
Func Terminate()
ProcessClose ( $app )
Exit 0
EndFunc
try it and see if works for you