Author Topic: "Nuclear Option" key combination for Windows: my Auto Hotkey script  (Read 619 times)


  • Newbie
  • *
  • Posts: 4
    • View Profile
On another thread there is some discussion about Attract Mode not getting focus sometimes when Mame exits (Windows 10 but might be other versions of Windows that have this issue as well).  Alt-tab or mouse clicking on Attract Mode seems to work, but if you don't have keyboard and mouse handy or if the kids aren't able to do this easily, a "kill everything and restart" might come in handy.

This is also helpful for me if something just freezes (either Mame or Attract Mode).  It is a very simple Auto Hotkey key command that calls a script that I call "The Nuclear Option".  Something I taught my six year old to do and it seems to work very well.

First of all, you need to create a batch file.  I have everything in my d:\mame folder so you'd need to change the following folders as necessary.  Here is the script:

Code: [Select]

@echo off
taskkill /IM attract.exe
taskkill /IM mame64.exe

timeout 2

cd D:\Mame\attract-v2.1.0-win64\
start attract.exe

The last three lines can probably be changed to this as well:

Code: [Select]

start D:\Mame\attract-v2.1.0-win64\attract.exe --config d:\mame\attract-v2.1.0-win64

I seem to remember having problems with using it all on one line for some reason...

Name your batch file to "AttractReset.cmd".

Next, create the following .AHK file.  I have it mapped to "hold down 3 and then press 4" which is my Left and Right pinball buttons on my Xarcade.  This is a key combination that doesn't get pressed by accident on my control panel.  You might want to map it to something else that's easy for the kids to remember...

Code: [Select]
; semicolon, such as this one, are comments.  They are not executed.

3 & 4::run, d:\mame\attractreset.cmd

Finally, have your .AHK launch when Windows boots up.  Download and install Auto Hotkey here: - look for instructions on having it launch with Windows.

Now if you ever have anything on the computer that just seems to mess up, Nuke everything and restart Attract Mode!

Note:  you may have to play around with making sure the batch file runs elevated if needed.  I think there are options in AHK for that.

Let me know if you have any ideas for improvements...