Jump to content
LaunchBox Community Forums

Pass game name to a script when launched/exited?


mrl72

Recommended Posts

I want to call a script every time a game is launched and exited, regardless of what the emulator is.

When the game is run, I need the name of the game as an argument passed to the script ie %1
When the game ends I don't need any parameter, just to call a script. So this is not dependent on the actual game.

By "script" it can be anything ie autohotkey, python, bat file etc.

Can someone tell me how to do this? Note I'm using BigBox.

Thanks!

 

Link to comment
Share on other sites

32 minutes ago, Headrush69 said:

LB has LedBlinky support which you can intercept with your AHK script, parse info as needed and do whatever you need to.

LB will pass the platform and the game name and the event occurring.

So in LB's options for LEDBlinky, set the application to your AHK.

Cool, thanks! I tried that. I set the LEDBlinky path to my .bat file but it's not passing anything other than a number (3 for launch game 4 for exit) for param %1 and nothing for %2. Any ideas what I could be doing wrong?

Edited by mrl72
Link to comment
Share on other sites

2 minutes ago, Headrush69 said:

Was this after highlighting a game in LB or starting a game?
 

I tried it yesterday using a compiled AHK and it did pass 3 arguments: command #, platform, and game.

Hah, found it. Looks like LB doesn't like batch files for some reason. I created a small AHK script and pointed the LEDBlinky path to it and now I'm getting the correct params.

Thanks again for your help!

 

 

Link to comment
Share on other sites

Okay I have this working for the most part with the exception that every time I navigate or click on a game it spawns a dos window which just looks terrible. I've tried with both a .bat and .ahk scripts but the same thing happens. I even tried compiling the AHK script to a .EXE and it does the same thing. 

Any suggestions? Feel like one step forward two steps back with this. 

Edited by mrl72
Link to comment
Share on other sites

1 minute ago, Headrush69 said:

Are you properly ending the AHK script?

I'm away from my computer but I'm pretty sure I never got a command window opening when calling the AHK exe.

I'll double check when I get home.

I figured it out. I needed to add the Hide parameter to the Run command in AHK. Doh! All looks good now. Cheers!

Link to comment
Share on other sites

Very nice mrl72. 

Do you have the MAME outputs working too? It's pretty cool being able to control lights based on in-game situations.

I just have a few extra LED Buttons I use for pinball on the side of my cabinet, but having them flash blue and red for police lights in game like Chase HQ sure is a cool touch. 

Link to comment
Share on other sites

26 minutes ago, Headrush69 said:

Very nice mrl72. 

Do you have the MAME outputs working too? It's pretty cool being able to control lights based on in-game situations.

I just have a few extra LED Buttons I use for pinball on the side of my cabinet, but having them flash blue and red for police lights in game like Chase HQ sure is a cool touch. 

Thanks! Right now it's just based on the bezels provided by the Bezel Project. So LB/BB passes the info to my script (thanks again for helping me with that). The script reads in the bezel.png and a function determines the dominant color (Ms Pac Man=pink, DigDug=yellow etc). It then passes that color to the LED strip on the back of the cab. Pretty simple really. Next I'll get it working with Steam games, even though they don't have bezels I'll just grab the color palette from some of the artwork in the LB folders. I'd like to see what other in-game things I can do with it though. I have it flashing red whenever a credit is added but I'm using Joy2Key at the moment. I should really use Mame Outputs which I may look at next. What is the best tool for capturing that? MameHooker is the only one I've looked at so far.

Edited by mrl72
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...