Build Your Own Arcade Controls Forum
Main => Main Forum => Topic started by: LeedsFan on February 19, 2026, 07:54:00 am
-
Sorry if this is in a wrong forum.
I'm no good at writing stuff like batch files. I did do a google search and AI did come up with something, but said it might not work.
I have a cabinet that has a dedicated dual stick control panel running Win10. It only plays about four games and I don't even want to use a front end.
I'm quite happy for Mame to start on boot and auto run a game.
I can exit game to the Mame menu itself (as only 4 games very short menu). But on exit of Mame I want the PC to shutdown.
I have no idea how to write this. :banghead:
-
This is a going to be a little clunky...any
I would use autohotkey (AHK). Then I would ask ChatGPT to write me a script. I would start with a prompt like this ...
"I need an AHK script. The script is intended to be run when windows starts. It should start MAME. After MAME is running, the script should remain active in the background and poll to see if MAME is still running every 60 seconds. If MAME is no longer running, open a message box that says "Shutting down PC in 60 seconds" then in 60 seconds, shut down the PC"
You could get fancy and ask it to build an abort process too. "Shutting down PC in 60 seconds, press any key to abort" (and tell it to cancel the shutdown if a key press is detected). Maybe if a keypress is detected, start MAME back up. Or drop to desktop. Whatever you want it to do.
Literally tell ChatGPT what you want the script to do, and it'll come up with the code. (.AHK file).
Then just place this .AHK file in your /startup/ folder (start - run --> shell:startup to open the startup folder)
If it doesn't work, just tell ChatGPT what didn't work. If it throws an error, give it the error message (you can even take a screenshot and give it the screenshot). It'll get it working.
On a side note, if you just want MAME - have you looked at ArcadeEIP ? https://github.com/gildahl/arcadeEIP
Good luck. (if you don't have AHK installed, go ahead and install it first. https://www.autohotkey.com/ )
-
OK now I have a problem. :cry:
Hmmm.... had PC in a loop of not starting Mame, and then shutting down. I sorted that out though. But the script is throwing up some sort of error which I can't read in time before the box disappears and shutdown starts.
I've checked the Mame.exe path is correct in the script and the rom name is correct. :dunno
Did I say I had no idea about making these scripts? :lol
-
I think you can hold SHIFT during startup to skip the startup items.
(You could also ask ChatGPT how to fix this)
-
In my opinion, AutoHotKey feels like overkill for this, especially if you haven't already installed it for anything else. I'm also not sure it's worth asking AI to build it for you. 8-? You can probably just put a two-line batch file in your mame directory:
c:\NAME\mame.exe <options>
shutdown /f /s /t:60Shutdown ships with Windows, so you won't need to install anything (except MAME). The options in this case mean "/force applications to quit while /shutting down the PC, after a 60-second /timeout". The timeout defaults to thirty seconds, and you can use "/t 0" to shutdown immediately.
If you just want the menu to pop up when MAME starts, leave "<options>" off. There are a gazillion options to mame, most of which you probably don't need until you get the basics working. See https://docs.mamedev.org/commandline/. If you want to automatically run a game instead of seeing the menu first, you can use the driver name instead of (or in addition to) <options>. For example:
c:\MAME\mame.exe tempest -skip_gameinfoAlthough, if you start it this way, I think exiting the game with <ESC> also exits mame, so it'll just fall through to the shutdown -- you'll never be able to start any other game. If you want to auto-start a particular game and return to the menu when it exits, I think you'll need to close the game through the <TAB> menu.
Anyway, once you've saved this in a file, called (for instance) letsplay.bat, you can set up a scheduled task to start it whenever you logon. Use Task Scheduler from the control panel (taskschd.msc) or schtasks.exe from the command line.
schtasks /create /tn "Start MAME" /tr c:\MAME\letsplay.bat /sc onlogonThe GUI's probably going to be easier to understand, though. You only need to add this scheduled task once, of course, not every time you run mame or anything.
Good luck!