Jump to content
LaunchBox Community Forums
igotdvds

Can LB pass variables to AutoHotkey?

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Posted (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 by Krakerman

Share this post


Link to post
Share on other sites
Posted (edited)

If you set your script to be the executable for an emulator, it will pass the rom name as %1%.image.png.f421740912fbf8244ee6d4bd233330bc.pngThis 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...,image.thumb.png.46f5df54f69527fb7bd44c5583aba85b.png...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 by JoeViking245
  • Like 1

Share this post


Link to post
Share on other sites
Posted (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 by Krakerman

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites
Posted (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 by jayjay

Share this post


Link to post
Share on other sites
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

 

Share this post


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.

Guest
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...