Jump to content
LaunchBox Community Forums

How to put commands before exe? Passing variables?


skizzosjt

Recommended Posts

So I have noticed that Dolphin has the emulator window pop up for a split second before launching the game and this is not desirable behavior. I want it to start minimized! I have found a couple other threads on such a topic, and/or similar topics but they are all extraordinarily convoluted to achieve something so simple. I know how to do this, but am having trouble figuring out a nice and neat way of integrating it all with LaunchBox.....if it is even possible that is

 

Using the Dolphin emulator edit window as reference below. Take note of the Sample command field, all "Default command-line parameters" come up after the exe, How in the world can I add anything at the start of the line, ie, BEFORE the actual executable

image.thumb.png.d6c4e0a06c96368e5b677cb753480750.png

 

I want to use this exact bit as my command line for launching Dolphin

start /min D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "FULL\PATH\TO\ROM\FILE"

an AHK file equivalent would look like this

Run, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "FULL\PATH\TO\ROM\FILE", , Min

Creating a bat file or AHK file of the above examples with appropriate folder path for the file name/ROM works perfectly fine. It launches the emulator completely minimized and out of sight and runs the game. However, no one would want to have to create a bat or AHK file for every game in their library. Is there not an easy way to amend the command line being used? All we need to do is add "start /min" at the beginning of the line. Super simple....but I'm lost for getting to an easy and manageable solution that doesn't potentially involve creating hundreds or thousands of extra files

 

here is what I have put into an AHK file. I've been trying to figure out what the variables do with limited sucess. So I suppose I need help on all fronts. What to select in LunchBox for the emulator, as well as what to use in an AHK or bat file. the one line of code that is acrtually running obviously doesn't work. just trying to share what I have been trying to do so hopefully my mistakes can be pointed out

Run, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "%romfile%", , Min




;Run, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "D:\Arcade\ROMS\Nintendo Wii Ware\%1% %2%".wad, , Min
;****THIS ABOVE LINE WORKS!!! for any game with two words for game title for ex Contra ReBirth***


; %0% = ??? not sure what this is, but it always returns a number
; %1% = 1st section of file name before a space. for ex Conta ReBirth would return "Contra"
; %2% = 2nd section of file name, after 1st space, before 2nd space. for ex Conta ReBirth would return "ReBirth"
; %3% = 3nd section of file name, (see above for explaination) for ex Donkey Kong Country Returns would return "Country"
; %4% = 4th section of file name, (see above for explaination) for ex Donkey Kong Country Returns would return "Returns"
; %5% = Just keeps going
; %6% = And going

 

Seen threads on being able to pass variables to AHK but this is a bit out of my league. If that is the only way to do it, then someone just needs to break it down a little more for me than existing threads do

Found info here, but I am failing miserably and executing what is being described here

 

 

Any help is always appreciated. Thanks!

Edited by skizzosjt
adding code
Link to comment
Share on other sites

25 minutes ago, skizzosjt said:

Any help is always appreciated.

In the Dolphin > Graphics settings, have you ticked "Render to Main Window"?

118658561_Schermopname(88).thumb.jpg.898c3f650f264fdc7fa389f581009c59.jpg

In LaunchBox > Tools > Manage > Emulators > Dolphin, have you enabled "Startup Screens" to hide the pop-up?

1473781546_Schermopname(89).thumb.jpg.3c528250d96cf2dd4194e31f77162c5d.jpg

Tick: "Enable Game Startup Screen", "Enable Game Shutdown Screen" and "Hide All Windows that are not in Exclusive Fullscreen Mode."

 

start /min D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "FULL\PATH\TO\ROM\FILE"

Run, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "FULL\PATH\TO\ROM\FILE", , Min

These are not command-lines but Windows batch and AutoHotKey scripts.

  • Like 1
Link to comment
Share on other sites

christ.....of course I post this due to reaching the end of my rope after spending half a day investigating this stuff....then I make some discovery/breakthrough just a few minutes after posting this. I just got it working! Sharing screen shots below to show how I got it setup. Just let it be known, I only got this working due to literally just tossing stuff at the wall and seeing what sticks! I really do not understand why at other times I was using the %1% variable or %X% with X being a number and it would give me just a single word from the file name. Those test files from the other thread never spit back anything for me, just empty msg boxes, I couldn't figure it out. I just kept cycling through different combos of stuff and after getting more error messages I started to see a little bit more how it worked. However,  I now clearly have this working with just a %1% being used for what I assume is the entire folder path to file/ROM. so my OCD is triggered not totally understanding all of this, but I can at least rest easy I accomplished what I wanted to.....now I wish I could understand better! If anyone is willing to take a moment and explain, I'd be super grateful for such a favor!

image.thumb.png.269aa9a0cca9f092df42c003b2721b8c.png

and the code in the associated AHK file is as follows

Run, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "%1%", , Min

 

Link to comment
Share on other sites

3 minutes ago, skizzosjt said:

and the code in the associated AHK file is as follows

Run, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "%1%", , Min

If you start messing with starting games from scripts, you will break a lot of LaunchBox features. Like Startup / Shutdown screens, Pause screens, Exiting games / emulators with escape / game controllers.

Link to comment
Share on other sites

4 minutes ago, Your Friendly A.I Overlord said:
Run, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "%1%", , Min

If you start messing with starting games from scripts, you will break a lot of LaunchBox features. Like Startup / Shutdown screens, Pause screens, Exiting games / emulators with escape / game controllers.

thank you for both of your replies. I do not have access to that screen in your previous post, I'm in the free version of LaunchBox for the time being. I have been using HyperSpin and RocketLauncher for a couple years and figured I should take the plunge into LaunchBox. So I am making sure I can get everything working in regular plain old LaunchBox the way I want it to before I make the choice to purchase a full copy and start using BigBox.

 

Adding AHK code to the running script is easy for adjusting exiting games with hotkeys. I'm fine with added work there. But NOT fine with breaking things like Startup/Shutdown screens, which from what I can tell are the equivalent to RocketLaunchers "Fade In" and "Fade Out" screens? If so, YES those I def want to use. But I am not using them as of right now, again, due to being on free version of LaunchBox. Is this guaranteed to not work if I launch any game/emulator this way, or is it just a possibility? This is the only emulator I've had to fart around doing this for so far and I have like two dozen different systems using about 10 different emulators so far. So I'd hate to do it, but I would likely concede defeat and end up seeing an emulator screen pop up for a moment rather than break functionality. With that said, is that "Hide All Windows that are not in Exclusive Full Screen Mode" checkbox take care of this exact issue I am going on about for the Dolphin emulator? I cannot test it unfortunately, it appears to be locked out, behind a paywall. This is exactly the kind of info I need to make a choice on buying a premium license, if a checkbox can fix my issue that I spent literally hours trying to come up with some code for, then that's two thumbs up from me and another reason goes under the "pro" column for pushing me to make a purchase. I'd hate to buy it and find out some silly little stuff like this has yet to be implemented in LaunchBox.

 

I never used the "render to main window" check box in Dolphin before so I tried that but it did not solve the issue I was trying to fix. The emulator screen with your list of games still momentarily pops up before launching the game so that didn't change. In fact, made it worse in my opinion since now it puts up a full screen white screen before the game launches instead of a full screen black screen. I like the black screen better, my eyeballs will thank me for not getting blinded by a giant white screen

 

so I'm no technical code expert, obviously🤣 but was sorta confused with the terminology on the first line not being command lines .....I assumed if the code works in the CMD prompt then it is command line. Google is helping me understand some now (bat is old, cmd is newer, etc) but I thought they were one in the same. In all practicality of how I have used both the CMD prompt and bat/batch files they are one in the same to me....but I get the "technical" differences thanks to a couple articles. I never knew it, so thanks for pointing it out! But I agree on the other bit of your comment, that the other line is AHK script, I knew that, not debating that part, hence why I called it the "AHK equivalent".

13 minutes ago, Your Friendly A.I Overlord said:
start /min D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "FULL\PATH\TO\ROM\FILE"

Run, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "FULL\PATH\TO\ROM\FILE", , Min

These are not command-lines but Windows batch and AutoHotKey scripts.

 

  • Like 1
Link to comment
Share on other sites

ok here's my latest update on my keen ability to take the literal hardest path to my goal....as I was googling that CMD/BAT differences I got thinking can't you make shortcuts start minimized? sure enough, all I need to do is make a shortcut to the Dolphin emulator, and in LaunchBox have it point to the shortcut link instead of the actual executable. In the shortcut's properties window there is a drop down field called "Run" and all you need to do is select "Minimized"

 

take note if you test by trying to open the shortcut link you made, you still see some other window (I think it's the message saying it is scanning your folder paths and populating your game list rather than the game list) pop up for just a super small fraction of a second, which might give the impression it is doing something like waiting for a window to be active and in focus and then minimizes it. however, when used to actually launch a game through the shortcut, it does exactly what I wanted it to do which is nothing pops up except the game window. mission accomplished! this version is so easy, even a caveman can do it lol! I'll keep my fingers crossed that someone smarter than me doesn't poke holes in this method too! 😝

 

nothing like wasting half an afternoon, making mountains out of mole hills when there is a solution that requires zero code knowledge and only takes 30 secs to implement. lol oh boy the "problems" we chase and the rabbit holes we go down for this hobby we all love!

Link to comment
Share on other sites

Since you are already set up with RockeLauncher, you have the option of using RocketLauncher with LaunchBox as well. (You can do only some platforms or even just individual games)

I only use RL with a couple platforms, but there are some things it does better. One specific issue that relates to your type issue: some Teknoparrot games take longer to start (Mario Kart) than LaunchBox's timed startup screen, and you get those startup windows showing sometimes. Since RL actively waits for the game window before hiding the startup screen, you don't have that problem.

 

  • Like 1
Link to comment
Share on other sites

46 minutes ago, skizzosjt said:

thank you for both of your replies. I do not have access to that screen in your previous post, I'm in the free version of LaunchBox for the time being. I have been using HyperSpin and RocketLauncher for a couple years and figured I should take the plunge into LaunchBox. So I am making sure I can get everything working in regular plain old LaunchBox the way I want it to before I make the choice to purchase a full copy and start using BigBox.

Hi @skizzosjt I quite like your reply although it is probably a bit too much to reply to right now. Sorry I did not directly address your initial question. Seeing as I'm using the paid version of LaunchBox for over 5 years now I don't exactly know anymore which features are in the free version and which are not. I do understand your desire to make everything as seamless as possible as this is a goal for myself too.

I was trying to convey that in my opinion the first step in fixing those transition between the frontend and the emulator is to set up everything in the emulator and the frontend as optimal as possible before resorting to scripts. Not only because using scripts can break some LaunchBox features, but more so because some people bite of more than that they can chew and duct tape LaunchBox together with half working scripts.

You can make scripting work with LaunchBox. But the explanation for why it can cause trouble is this:

You add an emulator to LaunchBox, right! When you launch a game LaunchBox starts the emulator so it keeps track of when the emulator starts and when it exits. This is especially important for say Startup screens or exit scripts. But when you start a game from a bat file or AutoHotKey script it's often just 1 line that take about 20 milliseconds to execute. Then the script or bat file terminates. LaunchBox sees the script as the emulator so it thinks you have exited the emulator while in reality the emulator is just launching. Startup screen are aborted, pause screen and exit scripts no longer work. You can get around this by keep the script running as long as the emulator is running. In AutoHotKey you can use Process, Wait or WinWait and then wait for the process or window to exit before exiting the script. Examples:

Run, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "%1%", , Min
WinWait, ahk_exe Dolphin.exe
WinWaitClose
ExitApp

$Esc::
{
WinClose, ahk_exe Dolphin.exe
}

You can see that the script terminates (ExitApp) when the Dolphin window closes.

This keeps the Dolphin exit script (which close Dolphin with escape)

$Esc::
{
WinClose, ahk_exe Dolphin.exe
}

available for as long as the Dolphin window is running.

Example with RunWait which starts a process and then waits for it to exit.

RunWait, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "%1%", , Min
ExitApp

$Esc::
{
WinClose, ahk_exe Dolphin.exe
}

 

  • Like 1
Link to comment
Share on other sites

19 minutes ago, Headrush69 said:

Since you are already set up with RockeLauncher, you have the option of using RocketLauncher with LaunchBox as well. (You can do only some platforms or even just individual games)

I only use RL with a couple platforms, but there are some things it does better. One specific issue that relates to your type issue: some Teknoparrot games take longer to start (Mario Kart) than LaunchBox's timed startup screen, and you get those startup windows showing sometimes. Since RL actively waits for the game window before hiding the startup screen, you don't have that problem.

 

yes I figured that out right away actually. switching to LaunchBox was like a 5min process and super easy (it's just as easy to tick two boxes back and forth in RLUI to use either of them right now) but this is not the long term goal I am after. I want to eventually never use HyperSpin and RockerLauncher again. As of right now I technically have already achieved that goal, but am getting everything organized as possible to make sure I find the fee associated with Premium to be worth it (so far.....so good in the impressing me department, I think it will be inevitable to make the purchase)

I don't use teknoparrot and doesn't look like something I will ever need in my emulator arsenal so I'm in the clear there, but thanks for the heads up!

 

22 minutes ago, Your Friendly A.I Overlord said:

Hi @skizzosjt I quite like your reply although it is probably a bit too much to reply to right now. Sorry I did not directly address your initial question. Seeing as I'm using the paid version of LaunchBox for over 5 years now I don't exactly know anymore which features are in the free version and which are not. I do understand your desire to make everything as seamless as possible as this is a goal for myself too.

I was trying to convey that in my opinion the first step in fixing those transition between the frontend and the emulator is to set up everything in the emulator and the frontend as optimal as possible before resorting to scripts. Not only because using scripts can break some LaunchBox features, but more so because some people bite of more than that they can chew and duct tape LaunchBox together with half working scripts.

You can make scripting work with LaunchBox. But the explanation for why it can cause trouble is this:

You add an emulator to LaunchBox, right! When you launch a game LaunchBox starts the emulator so it keeps track of when the emulator starts and when it exits. This is especially important for say Startup screens or exit scripts. But when you start a game from a bat file or AutoHotKey script it's often just 1 line that take about 20 milliseconds to execute. Then the script or bat file terminates. LaunchBox sees the script as the emulator so it thinks you have exited the emulator while in reality the emulator is just launching. Startup screen are aborted, pause screen and exit scripts no longer work. You can get around this by keep the script running as long as the emulator is running. In AutoHotKey you can use Process, Wait or WinWait and then wait for the process or window to exit before exiting the script. Examples:

Run, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "%1%", , Min
WinWait, ahk_exe Dolphin.exe
WinWaitClose
ExitApp

$Esc::
{
WinClose, ahk_exe Dolphin.exe
}

You can see that the script terminates (ExitApp) when the Dolphin window closes.

This keeps the Dolphin exit script (which close Dolphin with escape)

$Esc::
{
WinClose, ahk_exe Dolphin.exe
}

available for as long as the Dolphin window is running.

Example with RunWait which starts a process and then waits for it to exit.

RunWait, D:\Arcade\Emulators\Dolphin\v5.0\Dolphin.exe -b -e "%1%", , Min
ExitApp

$Esc::
{
WinClose, ahk_exe Dolphin.exe
}

 

I get your point, and it's the same goal I am after. I eventually got attracted to LaunchBox due to it was supposed to be superior in every way and is still in very much active development with continuous improvements in function and quality of life.  So yes I totally agree it is best to use any and all options available in the frontend prior to resorting to thirdparty apps to get the job done! And btw, you did a fine job answering my questions!

 

Thanks for sharing the more detailed breakdown of the inner workings of LaunchBox launching stuff. It was what I imagined, but I'd rather not assume. Also thanks for sharing the examples, it wasn't anything new for me to learn but it does provide me with confidence that I am getting the hang of the basics of AHK after a couple years. It's reassuring to see others go to the same commands/functions/methods to achieve the same goal, meaning I'm not making things harder on myself by going about it in some convoluted way....much like how this thread topic got started LOL!

 

Either way, thanks to you both for helping a n00ber along!

 

Link to comment
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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...