I'm very new to using Batch files, and have ran into a problem that Googling hasn't been able to solve. I hope someone can assist me with this, because it's quite a doozy. My intentions is to have a Front-End program for emulation and a Windows Media Player playlist open simultaneously, to allow for menu music to be played, and then have the WMP close when I start a game, and open up again when I close the game, returning to the Front-End. The litany of issues I've encountered are:
- The Front-End opens fullscreen, and has priority. I can open WMP simultaneously, but once the Front-End is running, it seems to negate any other files/programs from starting/closing.
- The Front-End lists games for me. When I select one, it minimizes the Front-End into the background, and launches the emulator, that then runs the game. When I exit the game, it relaunches the Front-End. The Emulator itself also negates most files/programs from launching. When I did get a hotkey setup to launch a .bat file that opens WMP after exiting a game, it would launch WMP successfully, but also pause the Emulator, and prevent it from exiting properly.
- To launch WMP as a playlist that's already playing music on shuffle, I start as "AP1.wpl", which is the file of the playlist, but the only way to exit is to taskkill "wmplayer.exe", so they're not tagged as the same program.
- The Front-End's .exe doesn't launch via a .bat file. So my workaround was to create a .vbs that shortcuts it's launch as a hotkey, and include the .vbs in my .bat, so this limits me on tagging WMP with the Front-End, but since it doesn't ever actually close, and blocks all commands while it's open, I don't think it matters much.
I guess that's really all the issues worth mentioning to explain the situation.
The one idea I do have, is that when I select a game in the Front-End, it minimizes and opens a command prompt for a brief 2-3 seconds, then launches the Emulator/Game. This brief opening does allow me to launch and close programs before the Emulator shuts me back out. If I could just tie the closing and opening of WMP to the command prompt, so that when I launch the Front-End, WMP launches, and when I launch a game, it closes WMP as soon as the CMD opens. When the game is exited (as well as the cmd), it would launch the .wpl playlist. It would have to be this sort of loop, dependent on when the CMD is opened/closed. So far, this is what I have going (it's not much):
@echo off start hotkey1.vbs C:\AP\AP1.wpl
The .vbs is launching the Front-End, and AP1.wpl is the playlist. And somehow wmplayer.exe has to be taskkill'd via the appearance and disappearance of cmd.exe, of it's own accord.