fishy1988 Posted August 15, 2023 Share Posted August 15, 2023 Hello. I have an additional app .exe that is run at the startup of my MAME lightgun games (a script which I will soon do for all of my 4:3 lightgun games). It's purpose is to send a serial command to my Gun4IR lightguns to tell them to use a setting called "content aspect ratio" - whereby the default setting is for fullscreen (you need to differentiate with Gun4ir for it to work properly). Long story short I am using a compiled script from a youtuber Brad D which accomplishes this perfectly (below - where M3.1 is the serial command which switches the gun to content aspect ratio, and M3.0 switches it back to fullscreen). Run, %COMSPEC% /C echo M3.1 > COM3 Run, %COMSPEC% /C echo M3.1 > COM4 Escape:: Run,%COMSPEC% /C echo M3.0 > COM3 Run,%COMSPEC% /C echo M3.0 > COM4 ExitApp return The problem is once I hit ESC to exit my game, it will kick me back to Launchbox and MAME remains open but minimised. Can someone please point me in the right direction so MAME closes as well with this arrangement- I am obviously hopeless with this stuff. Thanks very much in advance. Fishy Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted August 15, 2023 Share Posted August 15, 2023 3 hours ago, fishy1988 said: Can someone please point me in the right direction so MAME closes as well with this arrangement Assuming you use this script only for MAME and you're talking stand-alone MAME (vs Retroarch MAME core) and that it does indeed work to set and reset the COM ports, respectively, have the script also close MAME after resetting the COM ports. Run, %COMSPEC% /C echo M3.1 > COM3 Run, %COMSPEC% /C echo M3.1 > COM4 Escape:: Run,%COMSPEC% /C echo M3.0 > COM3 Run,%COMSPEC% /C echo M3.0 > COM4 WinClose, ahk_exe mame.exe ExitApp return 1 Quote Link to comment Share on other sites More sharing options...
fishy1988 Posted August 16, 2023 Author Share Posted August 16, 2023 On 8/15/2023 at 10:35 PM, JoeViking245 said: Assuming you use this script only for MAME and you're talking stand-alone MAME (vs Retroarch MAME core) and that it does indeed work to set and reset the COM ports, respectively, have the script also close MAME after resetting the COM ports. Run, %COMSPEC% /C echo M3.1 > COM3 Run, %COMSPEC% /C echo M3.1 > COM4 Escape:: Run,%COMSPEC% /C echo M3.0 > COM3 Run,%COMSPEC% /C echo M3.0 > COM4 WinClose, ahk_exe mame.exe ExitApp return Yes correct I'm using standalone MAME. Thanks Joe I will try this tonight. 1 Quote Link to comment Share on other sites More sharing options...
somail Posted January 11 Share Posted January 11 Hi, Bumping this topic back to the top as I have a similar question. What if I want the second part of this script to run but only at exit of MAME. NOT when I press escape. For example, if I am in a MAME menu and press escape I just want to go back to the game or back one menu, not exit mame. As it is currenlty written it will exit Mame. Can this be modified so it watches when MAME exits on its own and then runs the script? So basically at start (which currently works): RUN, %COMSPEC% /C ECHO M3.1 > COM7 RUN, %COMSPEC% /C ECHO M3.1 > COM8 On Close (when MAME closes on its own): RUN, %COMSPEC% /C ECHO M3.0 > COM7 RUN, %COMSPEC% /C ECHO M3.0 > COM8 Thanks for the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.