This use case is the definition of unnecessary but I've taken an interest in scripting and I'm trying to learn. I find my motivation holds best when trying to practice it on things that make my life easier but aren't super important!
I've created a batch file that does the following:
- Launches a Steam game
- Switches my display to my TV (I have my TV on the wall next to my PC)
- Switches my audio source to my headphones
Works wonderfully, but I want to improve it as currently, when I finish playing the game, the display is still on my TV. What I'm looking for is a way to make a batch file run ONLY AFTER the (game) is no longer running to move the image back to my monitor.
In essence, it would go:
- Run batch file.
- Game opens
- Display moves to TV (I use a little app called MultimonitorTool to do this with a set configuration called tv.cfg)
- Audio source changes to headphones (I use SoundSwitch and a profile for the game to set source)
- Finish playing game and exit.
- Batch file to move display back to monitor (already configured this as pc.cfg) runs but only because the game.exe is no longer open.
I was playing around with "/wait" but I couldn't get it to work. In the script below, the first 2 commands work to open Notepad.exe (changed for testing) and then the TV.cfg is what moves the image to the TV. It's the section about waiting for Notepad.exe to run PC.cfg to move the image back to my monitor that doesn't work.
I changed the application to Notepad just for testing, this is what I was trying:
@echo off
cd C:\Windows\system32
start Notepad.exe
cd C:\Users\Rob\Downloads\MultiMonitorTool
start MultiMonitorTool.exe /LoadConfig "C:\Users\Rob\Downloads\MultiMonitorTool\TV.cfg"
cd C:\Users\Rob\Downloads\MultiMonitorTool
start MultiMonitorTool.exe /LoadConfig "C:\Users\Rob\Downloads\MultiMonitorTool\PC.cfg" /wait "C:\Windows\system32\Notepad.exe"
exit
Is there an easy way to achieve what I'm trying to do? (I'm a complete noob with no schooling on any of this stuff guys! it's purely a hobby)