Jump to content
LaunchBox Community Forums
YoYo

Use Platform and Game in AutoHotKey script

Recommended Posts

Hello, first post here. I really like Launchbox, it's working well for me.

Is there a way to access the Platform or System name and Game or ROM name in the AutoHotKey script tab of the Edit Emulator window? Kinda like you can use {{{StartupEXE}}}. I would like to do things with that info when launching games.

 

Thanks

Share this post


Link to post
Share on other sites

Well since the AHK scripts are specific to emulators, you already know your platform and system names so you don't need the script to pass that. I would try this:

Create an autohotkey script for your emulator that does something like:

msgbox %0%

msgbox %1%

msgbox %2%

msgbox %3%

and run a game. See if any of those populate with anything useful.

 

Share this post


Link to post
Share on other sites

Third this...@markmon..none of those work. Ive asked this in a duplicate thread by accident. PLEASE someone help me here.  Also @ markmon, the emulator name and platform name would actually be beneficial for my purposes.

Share this post


Link to post
Share on other sites

i've also asked this in a different thread with no answer. So what was in the msg box popups? were they empty?

Share this post


Link to post
Share on other sites
3 hours ago, ckp said:

i've also asked this in a different thread with no answer. So what was in the msg box popups? were they empty?

All empty. I have a big thing in the works for LaunchBox if I can easily access some information from the application.

Share this post


Link to post
Share on other sites

There are always alternative ways to do things. The ahk script here may not be needed at all. On my set up,  for example,  I point launchbox  the emulator exe which is actually an ahk script that runs the emulator and does some other stuff. You'd handle that outside of launch box and you get passed the full path and filename of the Rom. You would know the name of the emulator at that point as well. Not sure what you're trying to do but the launch box ahk only runs when a game is launched anyway 

 

Share this post


Link to post
Share on other sites
3 hours ago, markmon said:

There are always alternative ways to do things. The ahk script here may not be needed at all. On my set up,  for example,  I point launchbox  the emulator exe which is actually an ahk script that runs the emulator and does some other stuff. You'd handle that outside of launch box and you get passed the full path and filename of the Rom. You would know the name of the emulator at that point as well. Not sure what you're trying to do but the launch box ahk only runs when a game is launched anyway 

 

Please elaborate....

My goal is to have the user run anything in LB or BB and have it pass system name, rom path, emulator path, etc. to another application so it can interact back and forth.

Share this post


Link to post
Share on other sites

maybe you can try creating a test emulator in LB that is just a batch file and try launching it with some game or fake game to see what gets passed. i'm pretty sure system and rom gets passed. the batch file could be like:

  echo %1 >> c:\temp\test.txt

  echo %2 >> c:\temp\test.txt

  echo %3 >> c:\temp\test.txt

and then look at c:\temp\test.txt to see what was passed.

 

Share this post


Link to post
Share on other sites
38 minutes ago, ckp said:

maybe you can try creating a test emulator in LB that is just a batch file and try launching it with some game or fake game to see what gets passed. i'm pretty sure system and rom gets passed. the batch file could be like:

  echo %1 >> c:\temp\test.txt

  echo %2 >> c:\temp\test.txt

  echo %3 >> c:\temp\test.txt

and then look at c:\temp\test.txt to see what was passed.

 

I dont want to modify the existing configuration. I want the user to use LB to configure their emulators as they do today but allow my app the ability to know what system and other information so it can hook in to LB and give them additional options during gameplay across all emulators. Think universal pause capability and access to image directories.

Share this post


Link to post
Share on other sites

that was just an example for you to see what args are passed when emulators launch. anyway sounds like you have something very interesting brewing. maybe you need to talk to LB devs.

Share this post


Link to post
Share on other sites
31 minutes ago, ckp said:

that was just an example for you to see what args are passed when emulators launch. anyway sounds like you have something very interesting brewing. maybe you need to talk to LB devs.

Indeed. I'm waiting on one to respond to this thread.

Share this post


Link to post
Share on other sites

Hey guys, currently no variables are passed to the AHK scripts, so it's not possible currently. Please put in a ticket using Issues/Requests in the header to request it. :)

Share this post


Link to post
Share on other sites

For emulators like Hoxs64 which display a dialog box when you save/load the game state, the ability to pass the romname to an AHk script could automate the save/load of multiple game states.

 

 

Share this post


Link to post
Share on other sites

This is super easy to handle via an ahk script that launched the game emulator executable (and I'd argue that anyone that knows how to write an ahk script to do anything with the Rom name would also know how to write an ahk script that also replaces the emulator executable) . Happy to provide an example here. Basically,  create an ahk like starthosx64.ahk and have it parse the incoming command line,  runwait the actual emulator and then it can handle events as well in the script. Edit the emulator set up inside launch box to run starthosx64.exe instead and you're done. 

Share this post


Link to post
Share on other sites
41 minutes ago, markmon said:

This is super easy to handle via an ahk script that launched the game emulator executable (and I'd argue that anyone that knows how to write an ahk script to do anything with the Rom name would also know how to write an ahk script that also replaces the emulator executable) . Happy to provide an example here. Basically,  create an ahk like starthosx64.ahk and have it parse the incoming command line,  runwait the actual emulator and then it can handle events as well in the script. Edit the emulator set up inside launch box to run starthosx64.exe instead and you're done. 

What items are available to pass in this way? %gameid% is a new one..what are the others?

Share this post


Link to post
Share on other sites

You will get the exact command line that the emulator receives in this case. You can tell by launching a game,  load task manager while it's running,  poke around to select columns and enable command line and you can see the exact command line sent to the emulator. It'll most likely be the executable for the emulator as arg 1 and the path to the Rom and rom file as arg 2. 

Share this post


Link to post
Share on other sites
3 minutes ago, markmon said:

You will get the exact command line that the emulator receives in this case. You can tell by launching a game,  load task manager while it's running,  poke around to select columns and enable command line and you can see the exact command line sent to the emulator. It'll most likely be the executable for the emulator as arg 1 and the path to the Rom and rom file as arg 2. 

I have launcher scripts already i place for other purposes but I cant find any documentation regarding how to structure the command line arguments to pass variables. is it as simple as %1% and %2%? Do you have a screenshot or perhaps documentation I haven't seen?

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