Jump to content
LaunchBox Community Forums

Delay launch of apps


LuismaSP89

Recommended Posts

Hi! I´m new with this awesome backend, and i´m suffering to do something.

I have created a .bat file to edit a registry key in windows, "It contains controller configuration" and it´s needed for a game.

I set the option Auto execute before the main application. The problem is, that, launchbox starts the game very soon, and the registry settings doesn´t take effect.

I tested the .bat, and works perfect, changes the registry, the problem is that the .bat takes 1 second to take effect, but launchbox opens the game before.

Any ideas to do this? :S i searched for an option to delay the launch of the main app before "x" seconds to help the registry to take effect, but launchbox not seem to have that.

Thanks in advance, and congratulations to the devs with this marvelous backend :P

Link to comment
Share on other sites

Using the Timeout command would likely work for you. Simply enter "timeout /t 10" before the next line in the batch to be ran. Remove the quotes and replace 10 with the amount of seconds you want to delay. Also, a keystroke can skip the wait if you so desire.

Edit: Maybe we are reading this incorrectly. Is your issue that Launchbox is opening the emulator/app too quickly or that the batch file is being run too quickly? Please forgive me, it's 230am EST for me and I've been staring at lines of Python all night. If you need to delay the batch, timeout should sort things. If it's the former, I'd probably need more info and some sleep to assist.

Edited by Zeromod
Link to comment
Share on other sites

7 hours ago, Zeromod said:

Using the Timeout command would likely work for you. Simply enter "timeout /t 10" before the next line in the batch to be ran. Remove the quotes and replace 10 with the amount of seconds you want to delay. Also, a keystroke can skip the wait if you so desire.

Edit: Maybe we are reading this incorrectly. Is your issue that Launchbox is opening the emulator/app too quickly or that the batch file is being run too quickly? Please forgive me, it's 230am EST for me and I've been staring at lines of Python all night. If you need to delay the batch, timeout should sort things. If it's the former, I'd probably need more info and some sleep to assist.

 

8 hours ago, SentaiBrad said:

There is a batch command that can delay commands by x amount of time, would that work?

First of all, thanks for your replies.

I apologize, maybe i didn´t explait it well. English is not my mother language.

The problem is not with the .batch The problem is that launchbox opens the game too fast, and there´s no time for the .bath to take effect. I want to delay the launch of the game with launchbox, not delay the .batch executable.

Link to comment
Share on other sites

7 hours ago, Zeromod said:

Using the Timeout command would likely work for you. Simply enter "timeout /t 10" before the next line in the batch to be ran. Remove the quotes and replace 10 with the amount of seconds you want to delay. Also, a keystroke can skip the wait if you so desire.

Edit: Maybe we are reading this incorrectly. Is your issue that Launchbox is opening the emulator/app too quickly or that the batch file is being run too quickly? Please forgive me, it's 230am EST for me and I've been staring at lines of Python all night. If you need to delay the batch, timeout should sort things. If it's the former, I'd probably need more info and some sleep to assist.

And yes Zeromod, you´re right. My issue is that Launchbox is opening the emulator/app too quickly, not that the batch file is being run too quickly.

Link to comment
Share on other sites

No your English is just fine friend, I was up far too late working on a project and in an effort to keep my brain sharp I was trolling around the forums. Clearly that didn't work out for me haha. Can you share in detail the application that you are launching and any parameters you have setup in Launchbox? I don't need the batch file, just an idea of the app you are launching and any specific changes you have entered into the front end. No promises, but I'll commit to taking a look and trying to duplicate and or correct the problem for you. 

Edit: My mind is telling me the easiest fix is to create an AHK script that will run the programs in order. Again, just brainstorming. 

 

Edited by Zeromod
Link to comment
Share on other sites

3 minutes ago, Zeromod said:

No your English is just fine friend, I was up far too late working on a project and in an effort to keep my brain sharp I was trolling around the forums. Clearly that didn't work out for me haha. Can you share in detail the application that you are launching and any parameters you have setup in Launchbox? I don't need the batch file, just an idea of the app you are launching and any specific changes you have entered into the front end. No promises, but I'll commit to taking a look and trying to duplicate and or correct the problem for you. 

Edit: My mind is telling me the easiest fix is to create an AHK script that will run the programs in order. Again, just brainstorming. 

 

I trying to launch a game in epsxe emulator with default settings that comes with launchbox "-nogui -slowboot -loadbin". I have a specific controller config for that game, and i created a .batch file to modify the registry settings for this.

The batch works very well "Only have 1 line of code to execute the registry file" but launchbox opens the game too quickly and it seems that the changes can´t made with that fast.

Thanks again.

Link to comment
Share on other sites

Ok, so epsxe and a batch, got it. How are you calling that batch file in launchbox? Might even just be able to edit the batch file to have it actually call the emulator first then move to the registry change. Give me that last tidbit and I'll take a peek. I have time :D

 

Edit: I'm assuming the custom command line parameters? Never messed with it much but if it handles the same range that a full interpreter would take, I can do this real easy. Either way, just grabbed epsxe and I'm poking at it. Hang tight.

Edited by Zeromod
Link to comment
Share on other sites

Ok, AHK will do the trick. This is my AHK section 

 

WinWaitActive, ePSXe - Enhanced PSX emulator
Sleep, 10000 
Run E:\Emulators\EPSXE\hello.bat

 

Let me properly set up EPSXE so that it doesn't crash on open (right now I dont have the bios set up etc and it hates that lol) I'll get a proof of concept and show you how to set this up. Will not take long. Also, may not need that sleep or at least for 10 seconds, you will need to test that for me as I'm not actualy doing anything with my test batch file. Hang tight..

Link to comment
Share on other sites

@LuismaSP89 Ok, so Epsxe is clearly not set up properly on my machine and I'm not interested in troubleshooting an emulator that I don't personally use. However, I think if it's working normally for you, then this will be fine. So... lets test this. Go to Launchbox and open the manage emulators option under tools. Click on EPSXE and choose edit. In the Autohotkey tab on the right, enter the following. The path at the bottom needs to point to where your actual batch file is. And the Sleep, 10000 is in milliseconds so that is going to wait for 10 seconds. You can tweak this as needed. In fact, it may not even be necessary. 

Whatever you were doing to run that batch file before this, remove it. Fire up a game and let me know if this works for you. We may need to tweak a thing or two but I think this will be the best solution.

WinWaitActive, ePSXe - Enhanced PSX emulator
Sleep, 10000 
Run E:\Emulators\EPSXE\hello.bat

 

Edited by Zeromod
Link to comment
Share on other sites

25 minutes ago, Zeromod said:

Ok, so epsxe and a batch, got it. How are you calling that batch file in launchbox? Might even just be able to edit the batch file to have it actually call the emulator first then move to the registry change. Give me that last tidbit and I'll take a peek. I have time :D

 

Edit: I'm assuming the custom command line parameters? Never messed with it much but if it handles the same range that a full interpreter would take, I can do this real easy. Either way, just grabbed epsxe and I'm poking at it. Hang tight.

I´m using the internal option to launch the .batch Automatically run before the main application. "Image attached"

And this is the code of my .batch:

REGEDIT /S "D:\Emuladores\Emuladores PS1\Epsxe\ePSXe\control.reg

That .bath calls a .reg file that changes the registry, and works ok.

launchbox.jpg

Link to comment
Share on other sites

@LuismaSP89 So that path is what will need to go at the last line of the AHK script I shared in the post above. Go ahead and remove this as we are going to call the batch from the AHK moving forward. Once you have read that and set it up, test it and let me know how it worked. We can tweak it afterwards if need be.

Edt: Just figured out that I needed to set CPU to 1x for this to run so I'm going to test an actual game on my side now with the AHK solution in place. My batch file just shows a hello world but it should suffice as a proof of concept.

Edited by Zeromod
Link to comment
Share on other sites

5 minutes ago, Zeromod said:

@LuismaSP89 So that path is what will need to go at the last line of the AHK script I shared in the post above. Go ahead and remove this as we are going to call the batch from the AHK moving forward. Once you have read that and set it up, test it and let me know how it worked. We can tweak it afterwards if need be.

Edt: Just figured out that I needed to set CPU to 1x for this to run so I'm going to test an actual game on my side now with the AHK solution in place. My batch file just shows a hello world but it should suffice as a proof of concept.

I´m sorry, but i´m a little bit lost... where i must put the code you provide?

Link to comment
Share on other sites

The batch file shouldn't have anything to do with window size. Open EPSXE by itself and set it to fullscreen and it should remain that way moving forward. You don't want to paste exactly what I've put here, you will need to update the last line to point to your own batch file. Did you do that? Paste a reply with what is in your Autohotkey window please? I'm uploading a vid now for visual reference.

 

@LuismaSP89 see video below. I'll note that the recording software made the emulator look like that, it's actually running fullscreen without issue for me.

 

Edited by Zeromod
Link to comment
Share on other sites

19 minutes ago, Zeromod said:

The batch file shouldn't have anything to do with window size. Open EPSXE by itself and set it to fullscreen and it should remain that way moving forward. You don't want to paste exactly what I've put here, you will need to update the last line to point to your own batch file. Did you do that? Paste a reply with what is in your Autohotkey window please? I'm uploading a vid now for visual reference.

 

@LuismaSP89 see video below. I'll note that the recording software made the emulator look like that, it's actually running fullscreen without issue for me.

 

Yes, i did that, this is my hotkey settings:

 

WinWaitActive, ePSXe - Enhanced PSX emulator
Sleep, 10000
Run "D:\Luisma\Emuladores\Emuladores PS1\Epsxe\ePSXe\shaders\2D.bat"

Ok, i´ll try that later, now i must go. Thanks in advance.

 

I´ll try later

Link to comment
Share on other sites

Just now, LuismaSP89 said:

Yes, i did that, this is my hotkey settings:

 

WinWaitActive, ePSXe - Enhanced PSX emulator
Sleep, 10000
Run "D:\Luisma\Emuladores\Emuladores PS1\Epsxe\ePSXe\shaders\2D.bat"

Ok, i´ll try that later, now i must go. Thanks in advance.

 

I´ll try later

Get rid of the quote marks at the bottom

 

WinWaitActive, ePSXe - Enhanced PSX emulator
Sleep, 10000
Run D:\Luisma\Emuladores\Emuladores PS1\Epsxe\ePSXe\shaders\2D.bat 

Edited by Zeromod
Link to comment
Share on other sites

Sooo I'm an idiot. I just sat here and did exactly what you don't need, I delayed the batch lol. I was thinking about it while showering and had a duh moment. Give me a sec and I'll see if the AHK functionality in LB lets me just reverse the order here and delay the start of the emulator. Sorry for the run around Luis I'm running on little sleep today. Worst case scenario and we can literally just set AHK as the emulator and let the script handle importing the reg file and launching EPSXE for you. YAY CAFFEINE! 

Edited by Zeromod
Link to comment
Share on other sites

2 hours ago, LuismaSP89 said:

I´m using the internal option to launch the .batch Automatically run before the main application. "Image attached"

And this is the code of my .batch:

REGEDIT /S "D:\Emuladores\Emuladores PS1\Epsxe\ePSXe\control.reg

That .bath calls a .reg file that changes the registry, and works ok.

launchbox.jpg

@Zombeaver Sorry to ping you but I wanted some feedback. First off, I realize that his situation is a one off and it's not ideal that he's editing a registry to enable controller support. I don't like to deviate too often by offering different emulators etc. as a solution though. So I misread this twice like a fool and created an AHK script that delays the launch of the batch file. What it looks like, is that he actually needs to delay the launch of the emulator. I actually found a thread and a bitbucket that is related to it, that you were giving some feedback on. I've posted the bitbucket below which also links to the thread. 

I believe that if Luis here just points to the batch file as the actual emulator under manage emulators and then creates an additional app line and adds the ePSXe details in, it would solve his issue. It seems very similar to the Daemon tools issue and SSF that the other gentleman was working with you on. Thoughts? If so, I'll make a quick vid for him and he can follow that and be on his way to victory. The alternative is probably me writing more code than the couple of lines I threw out there earlier lol.


https://bitbucket.org/jasondavidcarr/launchbox/issues/946/implement-delayed-emulator-launch

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...