igotdvds Posted January 2, 2017 Share Posted January 2, 2017 I'm in need of the ability to pass platform/rom path/exe etc. to a AHK script upon launching in Launchbox. I have been able to inconsistently get %1% to pass a filename but cannot determine how or why this happens. Anyone have insight? Quote Link to comment Share on other sites More sharing options...
Krakerman Posted October 5, 2019 Share Posted October 5, 2019 (edited) Same here this is a much needed feature for LB built in AHK scripting. I requested to Jason hopefully at some point in the future he will add that feature. Edited October 5, 2019 by Krakerman Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted October 5, 2019 Share Posted October 5, 2019 (edited) If you set your script to be the executable for an emulator, it will pass the rom name as %1%.This is one I made that will show a splash screen of the game specific controls (.png file), then launch the game. Say I have this setup as my Arcade platforms' emulator and I go to start Donkey Kong. LaunchBox will pass to the AHK script dkong as %1%. Note that, if both check boxes were unchecked, %1% would be "D:\LaunchBox\Games\Arcade\dkong.zip" Also, I'm not sure, but possibly depending how it's used in the script, it may be %1 vs %1%. Don't know off hand. Confirmed. It's %1% Now, if you were to put your script (text) under the "Running AutoHotKey Script" tab...,...LaunchBox will NOT pass anything to %1%. Well, in fact, it's only to the Emulator Application the %1% will be passed. So it won't be passed to a script you use in the Additional Apps for a game either. I think there was something passed as %2% also but have no recollection what it was. Then again, could be thinking of something completely different. ? Confirmed. I was thinking about something completely different. So I still contend, LaunchBox can be utilized to start ANY program. You just may have to concoct a pseudo program (i.e. AHK script) to act as a middle man in obscure cases. Edited October 5, 2019 by JoeViking245 2 Quote Link to comment Share on other sites More sharing options...
Krakerman Posted October 6, 2019 Share Posted October 6, 2019 (edited) Next time Jason asks more should request this feature so we can do it inside LB ahk then you won't need to do it via how you mentioned and would just make it much easier. Edited October 6, 2019 by Krakerman Quote Link to comment Share on other sites More sharing options...
Krakerman Posted October 9, 2019 Share Posted October 9, 2019 One thing I noticed Joe is if I use AHK scripts they way you mention then exit screens don't work but loading screen do. Quote Link to comment Share on other sites More sharing options...
jayjay Posted October 9, 2019 Share Posted October 9, 2019 (edited) Isn't the way the exit screen works is when bb regains focus it triggers the exit screen or something like that. So if loading a script there isn't a window to take the focus? Maybe try build a gui into ur script and keep it open behind the emulator and close it when emulator exits. Not sure how well it will work. Might get some nasty flicker. Maybe try and build a loading and exit screen into the script instead of using bb screens. Or Maybe the exit screen works on process so have the script continuously run in the background until emulator exits. Edited October 9, 2019 by jayjay Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted October 9, 2019 Share Posted October 9, 2019 4 hours ago, jayjay said: when bb regains focus it triggers the exit screen That makes total sense. LB launches the script then it's the script that launches the emulator/game. After that, this script is done. LB sees that and thinks, they're done playing, show the exit screen and return. Which you don't see because your playing a game. So, along those lines and just totally guessing here.... in the 'Emulator' script, launch the emulator with RunWait. RunWait, %MAME% "%RomDir%\%1%", , Hide Exitapp Quote Link to comment Share on other sites More sharing options...
Krakerman Posted June 24, 2020 Share Posted June 24, 2020 Here how to pass variables to AHK via setup the AHK as an emulator. Test Variable Passing.ahk Quote Link to comment Share on other sites More sharing options...
Krakerman Posted June 24, 2020 Share Posted June 24, 2020 Here is another example with even more variables you can get. Test Variable Passing v2.ahk Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted June 24, 2020 Share Posted June 24, 2020 (edited) Funny, I was just messing with this the other day. Some things I learned about doing this... The variable passed can be retrieved in the script in 2 different ways. "param in A_Args[1]" or %1%. (The latter being a little more direct approach.) Changing "1" to whichever argument you wish to retrieve. %0% will give you the total number of arguments that are available. This is important especially when using %platform% because if a platform has more than 1 word in it, it will be broken out into separate arguments. Example: Nintendo Entertainment System Using the custom command line %romfile% %platform% will give the following arguments results %0% = 4 %1% = the_name_of_the_game.zip %2% = Nintendo %3% = Entertainment %4% = System To get the full platform name in your script, use Loop %0% ;total # of available arguments { if (A_Index < 2) ;2 is the # of parameters you passed. Adjust accordingly Continue if (A_Index <= %0%) n .= %A_Index% " " } ; %n% = the [full] Platform Name For this to work, you MUST include the %romfile% parameter AND have the %platform% parameter as the last one. If you don't include %romfile% in your custom command line, it will automatically be 'inserted' as the last argument. Though as I think about it, you could adjust the loop to account for that. Also note, what %romfile%returns depends on what you have checked or not (No quotes, File Name only...). Edited June 24, 2020 by JoeViking245 1 Quote Link to comment Share on other sites More sharing options...
Krakerman Posted June 24, 2020 Share Posted June 24, 2020 Yeah I been messing with this the past few days trying to wrap my head around it and today I finally figured it out after some testing and searching. My second attempt gets every possible variable you could need even just the drive letter where the rom was launched. I have many ideas now and one of them will be possibility of per game configs for any emulator. now that I got the variable hurdle out of the way time to get coding.? 1 Quote Link to comment Share on other sites More sharing options...
Krakerman Posted June 24, 2020 Share Posted June 24, 2020 (edited) There are several more variables that can be passed that I forgot to mention as well. Started on my first RocketLauncher module conversion over to LaunchBox with Success!! Working on Altirra and will be able to have per game settings! Already have things up and running. This is so awesome and it works with my Cinematic startup, shutdown and LB pause screens. Basically now can have RL functionality without even using or needing RL all within LB. Edited June 24, 2020 by Krakerman 2 Quote Link to comment Share on other sites More sharing options...
Krakerman Posted June 24, 2020 Share Posted June 24, 2020 Advantage over RocketLauncher modules that this has is you can code your module as ahk or compile it as an exe and it will still work. Quote Link to comment Share on other sites More sharing options...
Krakerman Posted June 27, 2020 Share Posted June 27, 2020 (edited) Good News! Since learning how to pass variables to ahk scripts I been working on a custom launcher for the Altirra (Atari 400/800/5200) emulator. With great success I have the following setup and working within the Launcher script: Custom system settings. Per game settings. Cinematic fades for startup and shutdown and the ability to turn them on/off per game. No longer need to setup via Additional Applications in LB. Default Cinematic Fades for Platforms. So if a game cinematic fade is not found will look for a _Default video for both startup and shutdown. Works with LaunchBox Pause feature. Ability to select the following: hide desktop, taskbar and/or mouse pointer so launching from within LB/BB is seamless. Cartridge, Disks and Tape images all supported. All games and platform can be setup and configured via configuration ini file. Gives you more control over how to setup your games for Altirra. Custom location ability for your Cinematic fades. Easy setup in LB. Just setup as an emulator with a command line and that's all! No Plugins ... No RocketLauncher ? To setup each game you will need to edit the ini file using Notepad++ or any text editor. Altirra profiles feature support! Working on adding more features but currently all the above is working perfectly! Edited June 27, 2020 by Krakerman 4 1 1 Quote Link to comment Share on other sites More sharing options...
dragon57 Posted June 28, 2020 Share Posted June 28, 2020 On 6/27/2020 at 12:11 AM, Krakerman said: Good News! Since learning how to pass variables to ahk scripts I been working on a custom launcher for the Altirra (Atari 400/800/5200) emulator. With great success I have the following setup and working within the Launcher script: Custom system settings. Per game settings. Cinematic fades for startup and shutdown and the ability to turn them on/off per game. No longer need to setup via Additional Applications in LB. Default Cinematic Fades for Platforms. So if a game cinematic fade is not found will look for a _Default video for both startup and shutdown. Works with LaunchBox Pause feature. Ability to select the following: hide desktop, taskbar and/or mouse pointer so launching from within LB/BB is seamless. Cartridge, Disks and Tape images all supported. All games and platform can be setup and configured via configuration ini file. Gives you more control over how to setup your games for Altirra. Custom location ability for your Cinematic fades. Easy setup in LB. Just setup as an emulator with a command line and that's all! No Plugins ... No RocketLauncher ? To setup each game you will need to edit the ini file using Notepad++ or any text editor. Altirra profiles feature support! Working on adding more features but currently all the above is working perfectly! Holy moly! I've been waiting on something like this. I did a private proof on concept very similar to this long ago, but never went as far as you have (because LIFE!). Can't wait to see this, and how it can be extended to other platforms/emus. Thanks so much for the excitement. 1 Quote Link to comment Share on other sites More sharing options...
Krakerman Posted June 28, 2020 Share Posted June 28, 2020 (edited) Yeah this is Huge! I can't stress enough about the importance of having this ability. This weekend I discovered and found a bunch of new things with AHK I can do. Added some more new features as well: Separate config files for setting up Disk, Cart and Tape images. Keeps thing much more organized as well as having multiple games with the same name. Cleaned up the code. Things to do: Add Atari 5200 and XEGS support. Add ability to launch and run basic programs. This can be even more advanced with adding other programming language carts as well. More advanced Altirra options. Edited June 28, 2020 by Krakerman 1 Quote Link to comment Share on other sites More sharing options...
Krakerman Posted June 28, 2020 Share Posted June 28, 2020 (edited) Now have: Basic programs automatically load and run implemented! (Supports files with .bas format) Created a new config for setting up your basic programs. Implemented the following formats: .atx, .atr, .bas, .bin, .car, .cas, .dcm, .pro, .rom, .xex, .xfd, .wav Edited June 30, 2020 by Krakerman 3 Quote Link to comment Share on other sites More sharing options...
Krakerman Posted June 29, 2020 Share Posted June 29, 2020 (edited) Now have: Atari 5200 support has been added. Atari XEGS supports has been added. Edited June 29, 2020 by Krakerman 1 Quote Link to comment Share on other sites More sharing options...
Krakerman Posted June 30, 2020 Share Posted June 30, 2020 (edited) I keep finding new things I can do with AHK and now I have Instruction Cards working within my code! Haven't added animations to it yet but that will be something I will be looking at soon. Added custom HotKey for turning on/off showing Instuction Card. Edited June 30, 2020 by Krakerman 2 Quote Link to comment Share on other sites More sharing options...
Krakerman Posted July 3, 2020 Share Posted July 3, 2020 (edited) Ok, I now added: Added ability to have 4 different sets of instruction cards. Added an option to allow the game to be paused or not when displaying instruction cards. Looking at adding built-in marquee support via Display Fusion which will allow for animated marquees with gifs or mp4's. I have it up and running but there is a slight delay after launching and exiting game before the marquee changes but it does work. Reason I was looking at an alternative is because I have a multi monitor setup with 5 monitors and LaunchBox built in marquee support does not work correctly with my setup and this does. Edited July 4, 2020 by Krakerman 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.