Jump to content
LaunchBox Community Forums

Use Platform and Game in AutoHotKey script


YoYo

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

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

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.

 

Link to comment
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 

 

Link to comment
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.

Link to comment
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.

 

Link to comment
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.

Link to comment
Share on other sites

  • 3 weeks later...

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. 

Link to comment
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?

Link to comment
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. 

Link to comment
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?

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