Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. Thank you for your support. Tom Speirs

Patreon

.bat .lnk .url launcher


joyrider3774

Recommended Posts

Based on @PcTeknic request  in #general to launch multiple exe's but put them inside a single system i made a new launch script that can launch .lnk or .url or .bat files  (or even .exe or .com files but it's better to create a .lnk (shortcut) file to it then). This makes it easy to put single application or games inside a single system, you can even make multiple such systems and folders if you like to group them or so.

The way it works is you need to create a directory with shortcut or url or .bat files named like so : [game.exe].[idenitifier].lnk the [game].exe needs to be the exe filename of the program you are launching using your lnk (url or bat) file, it's the process we will monitor. The [idenitifier] can be anything you like it's been mainly added just in case you have multiple games using same [game.exe] filenames so you can still create multiple shortcut files just never use a point inside the identifier name.  For example Malzbies pinball collection exe is named PinballCollection.exe, create a shortcut (or url in this case of steam, you can use steam to create the shortcut on the desktop, in case of shortcuts to exe files, goto the folder of the exe file and right click and drag it to an empty spot and choose create shortcurt) afterwards name that shortcut "PinballCollection.exe.Malzbies.url" and copy it to your launch files folders this is also the game name you need to use inside gamemanager.

the script will then extract [game.exe] from the filename and launch the shortcut or url or batch file, wait for [game.exe] process to start and then wait for it to stop and quit the script. You can and WILL NEED TO setup a key in the script here, being the same one as the key you use for quiting games inside pinballx. The script will then close the game and stop running. also DO NOT set process to monitor to the script.exe filename if you do that the launch after script will never work because pinballx will kill the script before it can run the launch after batch file.

Launch before and after bat files are also supported. the script will check if [game.exe].[identifier].launchbefore.bat exits and launch it (while waiting for it to finish) before starting the shortcut. The same is applied for the launch after bat file, it checks for [game.exe].[identifier].launchafter.bat and launch that either when the game exits naturally or when you press the key i spoke of earlier (the script closes the game / exe file when you press that key and it will no longer wait on the process to end and then run the launch after script).

this is the script:

LaunchLnkFile.ahk

this line you need to change the key to your quit key (same one as you use in pinballx)

image.thumb.png.79b87bbe797b34fd6b6d24f053ea4b13.png

This is how my launch files folder look like:

image.thumb.png.2f9fb7c2f1807daf4d11e6718e930c06.png

This how to set it up in pinballx (note do not put process to monitor.exe the script handles this if you do set it to the script filename, the launchafter bat file stuff will not work as pinballx will kill the script then)

image.thumb.png.f753ae82980a399ad48a2c88de1e61bc.png

these are the games are setup for the system inside game manager


image.thumb.png.3bd0d08d3cd97bee728fbb96aa814f78.png

 

If you want to add commandline parameter for some games add them to your LNK files for example:

image.png.6fafa97b4463bfdf47fa2ba88ebad146.png

 

if you need more control over a specific file use a [game.exe].[identiefier].bat file to launch the game and put all required commando's inside the batch file i did not test this but this should work also

 

  • Like 2
Link to comment
Share on other sites

  • joyrider3774 changed the title to .bat .lnk .url launcher

ok it seems there is still as in issue that pinballx closes the script, making pinballx return immediatly even though the launchafter batch file may still be running. but i have no idea how i can fix this. If games and exe's close rapidly and the launch after batch file does not take much time it will be fine, but if it the game takes a while to quit and the launch after script also takes a while it's in theory possible that pinballx has already killed the script before it can launch the launch after script or that it will return to pinballx before launch after script has finished. I have no idea how to fix this because pinballx seems to kill an application. If this is an issue for anyone and you have a spare button on your cabinet, set a different quit key in the script for quiting the games than the quit emulator key that pinballx uses and always use that key to quit the application, everything will run normally then as i don't think i can fix this issue (i tried on a few ways but if pinballx kills the process there is no way around it). Unless there is somehow a way in autohotkey to prevent the key being pressing being seen in pinballx (and the script just closes) but i can not find such option

Edit: solution found by remapping the emulator quit key to F24 (which most keyboards won't have) and then making F24 quit the game / application. This way pinballx will never seen the emulator quit key being pressed, but the script will see it (as F24) and quit the Exe then pinballx will see the script is no longer running and return to the game selection (after the launch after script had run no matter how long it takes to run)
I updated the script in 1st post with the changes and made new screenshots. It's absolutely vital that you set this key inside the script to your emulator quit key or the script won't work

Link to comment
Share on other sites

  • 3 weeks later...

Surely I do something wrong.
It only opens .exe files for me if I call it game.exe.
If I put any other name on it, it won't open it for me.
But there are several games and only one can be called game.exe
It also does weird things to me when closing.
On the other hand, some games require the use of a launcher (PinCabView) to be able to be played in cabinet mode, sending DMD and Backglass to the rest of the monitors and establishing the view of the playfield, in those cases we tended to PinballX executing this Launcher which in turn run another Launcher that runs the game.
I would like to thank Joyrider for creating this .ahk and for all their testing time, but using RocketLauncher is becoming easier for me, probably because I am used to using it in another frontend for arcade games and because of the number of possibilities it offers.
 

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