Jump to content
LaunchBox Community Forums

Recommended Posts

Auto Play N' Quit - AHK Script by IzzIsHOr

View File

I've been fiddling around with trying to make BigBox run a game and then switch it with another if no play is detected...


I tried looking at Arcade EIP, however... it seemed too complicated to configure for me at 4 a.m. last night, so I got ChatGPT out, and tried to come up with a AHK script that does the following:

 

  • Launches a game from a BigBox playlist
  • Waits 3 minutes in-game, to show it's attract mode
  • Brings RetroArch to the foreground
  • Closes RetroArch
  • Beeps Once
  • Brings BigBox to foreground
  • Holds "Down Arrow Key" to scroll trough games
  • LOOPS the script again (game changes every 3 minutes)

Script can be closed at any time by pressing the "START" button for me that's Joy8

-------------------------------------------------------------------------------------------------------------------------------

How I activate the script personally is,

  • Created a New Playlist with games I'd like to scroll trough (named it Attract mode)
  • Edited the metadata of a game (I chose 1941 because it's top of list)
  • Under Additional Apps I've added the AHK script
  • Set it to Automatically Run Before Main Application
  • Everytime I run 1941 it starts the script and scrolls trough random games until you press "START"

smFay8e.png

 

I have been testing it for a full day, it never once failed if you have it set up like me.

IMPORTANT!
It will not work "out of the box" without modifications if you're running anything else than RetroArch as an emulator, and a BigBox Theme that has vertical scrolling, also BigBox must have its default keyboard binds.


 

  • Thanks 1
Link to comment
Share on other sites

Thank you! Another feature that Gameex had like 10 years ago, finally makes it's way to Launchbox. People with cabs don't even realize what they've been missing. See a cool game running, walk up to cab and start playing. Don't have to wait since it's already running. Super cool feature!

Link to comment
Share on other sites

  • 3 weeks later...

This is so cool, I'm planning to build a bar top and this is exactly the sort of feature I'd like it to have.  Trouble is so far I've not got it to work?  I think I've followed the method correctly,  I created a playlist and launched the game I've edited as you've shown, and that's all it does, launch that game!??   Any ideas? 

Link to comment
Share on other sites

Had another try today,  still no joy, all it seems to do is open the .ahk file as a text window and then the game but nothing after that?   I've tried to edit the file to just do something simpler but still does the same thing, never used any launchbox add ons before so I'm sure it's me doing something wrong,  can you explain how to use this in more detail?  Any help appreciated thanks. 

Link to comment
Share on other sites

I hadn't at first but I did download it, still the same then noticed that It was already amongst the launchbox files anyway?   

  Is there a specific location the file has to go?  I've pointed to where I've put it.  The only other thing I can thing of is that although I haven't changed any default settings in big box I have in retroarch, such as exit key binds, could it be that or would this override those via big box to close it?

Link to comment
Share on other sites

I could be totally off base here but I'm not sure that the autohotkey in Launchbox will work with the way this is being launched. You need to have autohotkey downloaded and installed on your system (or point ahk files to open with the Launchbox version - see below). When it is installed, windows will see you are launching an AHK file and use the autohotkey program to open it. If windows doesn't know to use the autohotkey program, it will just open the script as a text file.

Maybe, the Launchbox included version could work but you'll probably have to change the default behavior of opening ahk files within windows. Right click the file and click the 'opens with - change' button. Navigate to where autohotkey lives on your PC and select that.

Link to comment
Share on other sites

OK, got it working, sort of.  My file association was set as notepad, so I changed that to autohotkey but then it started showing errors in the script when it tried to run it.  

 I don't have much of an understanding of these scripts so I just installed an older version of ahk and now it works for some reason?... but with one issue.  The first time I launch my game to activate the script it doesn't bring retroarch to the front, I have to alt tab and do it manually, then it doesn't close that instance of retroarch but goes back to Big box, selects another game and opens another instance of retroarch (though it does come to the foreground) and so on. 

  So eventually I end up with multiple retroarch windows open! 

Link to comment
Share on other sites

 It stopped on the first line when running version 2 of ahk, I deleted that line then it stopped on the next and so on, basically doesn't run on version 2!?   It also did various weird things when trying 32 or 64 bit variation of the older version,  not sure which one I'm using now but it's funny you said you edited the ahk file to use mame as that's exactly what I tried, (thinking it was a  retroarch issue) and it seems to work perfectly now!?  

  If be interested to see if anyone else has had issues with it and retroarch? 

  You should probably edit your file and instructions as they specifically say it only works with retroarch.

 

 

Link to comment
Share on other sites

8 minutes ago, Djronz said:

 It stopped on the first line when running version 2 of ahk, I deleted that line then it stopped on the next and so on, basically doesn't run on version 2!?   It also did various weird things when trying 32 or 64 bit variation of the older version,  not sure which one I'm using now but it's funny you said you edited the ahk file to use mame as that's exactly what I tried, (thinking it was a  retroarch issue) and it seems to work perfectly now!?  

  If be interested to see if anyone else has had issues with it and retroarch? 

  You should probably edit your file and instructions as they specifically say it only works with retroarch.

 

 

well you said "older" version of AHK but V2 is the brand spanking new version that only released officially in the last few months

you need to be using a V1.1.X version which is what is included with LB. this is because the syntax used in this script is V1. if you wanted to get a version from AHK official site you gotta get the 1.1 download from the main page (which would be the latest 1.1.X version) or click the "other versions" link and then get one of the 1.1.X versions that way. but in reality the version included with LB should work fine

you will be almost guaranteed to get errors by using V1 syntax and run it with a V2 exe. some syntax changed quite a bit. V2 was in development for years, only finally was recently released officially. that is why the 1.1 downloads are listed as deprecated now.

When I have a moment I am going to dig deeper into this script. It looks suspect.....granted I get no errors when I execute it (but also am not on a PC that has LB/BB/Retroarch on it to give it a real test drive). The way it is structured makes me think there would be issues with it operating as intended. So in your defense there looks to be funny business going on in this script and has room for improvement. I will try it out myself sometime since the concept is a cool one that I may like to deploy one day. I'll come back with whatever my results are.

 

 

 

 

 


 

  • Thanks 1
Link to comment
Share on other sites

37 minutes ago, Djronz said:

 You should probably edit your file and instructions as they specifically say it only works with retroarch.

I don't know. He pretty much specifically says...

"IMPORTANT!
It will not work "out of the box" without modifications if you're running anything else than RetroArch as an emulator, and a BigBox Theme that has vertical scrolling, also BigBox must have its default keyboard binds."

Sorry I can't help more. I can decipher the scripts but I'm not a good knowing whether they are optimized to operate without issues.

12 minutes ago, skizzosjt said:

well you said "older" version of AHK but V2 is the brand spanking new version that only released officially in the last few months

I had no idea there was a newer version of AHK. Good to know.

Link to comment
Share on other sites

9 minutes ago, JaysArcade said:

I had no idea there was a newer version of AHK. Good to know.

I actually gave up on learning V2 because when it came time to read up on how GUIs work now, my brain couldn't handle it anymore 🧠💥🤣. I really liked all the V2 changes UNTIL I started translating scripts that had a GUI.....then I wanted to bang my head on a brick wall. Just a bit of caution, newer doesn't always mean better. I'm sure V2 is better, but an amateur like myself needs to "un-learn" stuff I've been studying for about a year now to learn new stuff that in the end creates the same exact script lmao....I settled on I'd put my time and effort towards other things instead

  • Like 1
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...