Here is how to exit Visual Pinball with just the escape key (since by default it brings up the Visual Pinball menu, rather than a direct exit):
____________________________
HotKeySet("{ESC}", "KillDaWabbit")
HotKeySet("{PAUSE}", "Terminate")
While 1
Sleep(100)
WEnd
Func KillDaWabbit()
ProcessClose("vpinball8.exe")
EndFunc
Func Terminate()
Exit
EndFunc
______________
I found the solution here:
https://www.autoitscript.com/forum/topic/6089-trying-to-exit-visual-pinball/Just rename vpinball8.exe to the version you want to close.