Jump to content
LaunchBox Community Forums

Is there any way to wait before emulator launches?

Recommended Posts

Hi! I don´t know if somebody can help me. I need to launch a .bat before my emulator starts (I know that I can do this with additional apps, but I need to do this for around 3000 roms, so, it´s crazy to enable an additional app for one to one of them)

So, I decided to do with the autohotkey feature. I use the:    run, "path\myexecutable.bat" but this .bat copies some archives, and I need 2-3 seconds in order to finish the copy before the emulator is launched. The problem here is that the emulator launches immediately, so, the .bat have not finished before the emulator is launched.


I tried with sleep command, but it doesn´t work, I don´t know if maybe there´s some loop that I can do or something.


Any ideas?

Link to post
Share on other sites

Download and install autohotkey.

Open the directory that has the emulator your using. 

Right click anywhere within that directory, select new, autohotkey script.

Rename the script to whatever you want, right click on it and edit with notepad.

Underneath the lines that are already there, copy and paste the following:

EmuVar = %1% %2% %3% %4% %5%

sleep, 3000

Run Emulator.exe "%EmuVar%"


sleep 3000 is for 3 seconds, 2000 would be 2 seconds and so on.

In this script change Emulator.exe to whatever emulator you are using.

Save it.

Right click on the script and compile.


In launchbox...

Go to tools, manage emulators.

Select the emulator your using.

Leave all settings the same but point the "emulator application path" to the compiled script.


Run a game and hope for the best. 

Edited by jayjay
Link to post
Share on other sites

Thanks a lot for your reply, it works Ok, but I have 2 problems.

First of all, I need to use /fullscreen parameter in the emulator, but if I edit the script to add:    Run "Emulator.exe /fullscreen" it doesn´t work. If I put the parameter in his own section of the emulator "Default Command-Line Parameters box" showns me an error because the /fullscreen parameter can´t do nothing with the script.ahk


The second problem is that the autohotkey must be installed all the time, If I install, make the script, and uninstall, it doesn´t work anymore, I like launchbox because of his portability, and I don´t want this script depends of installing some other software.

Link to post
Share on other sites
run Emulator.exe "%EmuVar%" /fullscreen

replace with this line in the script.

ahk is portable. but for what you want here, passing arguments etc, get crazy errors. i can only get something like this to work with compiled scripts.


you can achieve the same thing with a .bat but your get the command window. i dont know if using a bat to exe converter with invisibility will hide the window.

@echo off
timeout 3
cd %~dp0
start emulator.exe %1 /fullscreen


or your have to wait for jason to expand on the additional apps, it might take a while though. its low on the poll. other than that im out of ideas.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...