mrsunshine Posted July 27, 2020 Share Posted July 27, 2020 Hi, everyone. I am trying to run a batch file after a Windows Store app ends in Launchbox or Big Box. Specifically, I want to kill an exe that I start before running the Windows App after I'm done. I have verified that the batch file works on its own, and the exe starts properly before the app launches, but Launchbox doesn't seem to detect that I have quit out of the app, so it isn't firing the .bat. I have checked "Automatically Run After Main Application," so I *think* I have set everything up correctly. Any suggestions would be greatly appreciated! Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted July 28, 2020 Share Posted July 28, 2020 (edited) I don't know much about batch files, but I do things like that with autohotkey. In fact, I launch all my Windows games via autohotkey scripts for automation (for example auto close steam after closing a steam game). If you launch games via a script you don't have to use additional apps. I make a copy of autohotkey.exe and rename that to the name of the script. In launchbox I import the renamed autohotkey.exe instead of a launcher url or game executable. Ofcourse you also can add a script that detects when a game closes as an additional app. I don't know if this is any help, but for you the problem is indeed the detection of closing a game and I don't know how to do that in a batch file. Edited July 28, 2020 by Koroth Quote Link to comment Share on other sites More sharing options...
mrsunshine Posted July 28, 2020 Author Share Posted July 28, 2020 1 hour ago, Koroth said: I don't know much about batch files, but I do things like that with autohotkey. In fact, I launch all my Windows games via autohotkey scripts for automation (for example auto close steam after closing a steam game). If you launch games via a script you don't have to use additional apps. I make a copy of autohotkey.exe and rename that to the name of the script. In launchbox I import the renamed autohotkey.exe instead of a launcher url or game executable. Ofcourse you also can add a script that detects when a game closes as an additional app. I don't know if this is any help, but for you the problem is indeed the detection of closing a game and I don't know how to do that in a batch file. Thanks for this response! I don't really know anything about autohotkey, but I'll look into it. It feels like everything would work if Launchbox itself just recognized that the game had closed, but I'm not sure how to make it realize that. Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted July 28, 2020 Share Posted July 28, 2020 I have to say that Microstoft made it extra difficult with windows store games. With protected folders and all. In the past I could only get windows store games to work with Launchbox by importing a shortcut. I don't know a great deal about the inner workings of Launchbox, but I suppose that if you launch a game via a shortcut Lauchbox doesn't even know where that shortcut points to. So it also doesn't know when the game is closed. But I could be wrong about that. Maybe I can help you with a script, but that would be tomorrow. Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted July 28, 2020 Share Posted July 28, 2020 (edited) O.k. As it turns out I have some time now. This script is meant to be added as an additional app. 1. Download the autohotkey script. It's a very simple, basic script. I adjusted my script that I have for Forza Horizon 3 to what you want to do. It's nothing more than a text file so you can open it with a any texteditor like notepad. I use Notepad++ just make sure you save it with an ahk extension. 2. In the first line where it says D:\LaunchBox\Programs\Antimicro\antimicro.exe replace with the path to the app you want to run before the game. If the path contains spaces it needs to be in quotes. 3. In the second and third line replace forza_x64_release_final.exe with the process name of your game. If you don't know, the easiest way to find out is to start the game in windowed mode or alt tab out of your game and look for it in the windows task manager. 4. In the forth line replace antimicro.exe with the app .exe you entered in the first line. The function "WinClose" usually works with open windows or if they are on the taskbar. If your app is in the systemtray, I find you have to use: Process, Close, antimicro.exe (again replace antimicro.exe with your app.) 5. Go to \LaunchBox\ThirdParty\AutoHotkey and copy AutoHotkey.exe and the script to a folder of your liking. As long as they are together. Rename AutoHotkey.exe and the script to what you want but they have to have the same name. So you get a name.exe and name.ahk 6 Go to your game in Launchbox and add the .exe as an additional app. Check "Automatically Run before main application" If it doesn't work or you need some advice, let me know! ForzaHorizon3.ahk Edited July 28, 2020 by Koroth 1 Quote Link to comment Share on other sites More sharing options...
Shermer321 Posted August 1, 2020 Share Posted August 1, 2020 Would that ahk work for steam games and launchbox thinking the game closed even though it didn't? 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.