Jump to content
LaunchBox Community Forums

Launching .bat files when running and exiting any emulator related to pinball (used to disable pinscape device or any unused controller)


AceEsCloud

Recommended Posts

Posted (edited)

Hello, I have a 4 player arcade cabinet that also has some pinball controls implemented.  I had an issue with my pinball plunger because it utilizes controller port 1 in windows (it is always the first device on because it loads with windows).  This causes conflicts with other emulators that utilizes controllers and although there are workarounds for most emulators, I would like to completely eliminate the issue by simply disabling this device when not in use.  I have found a way to completely disable the device using a bat file and I can also reenable the device with another bat file.  These bat files have been tested and work flawlessly but I need to configure them with each respective emulator.  My plan is to set this up so that when an emulator related to pinball launches it launches a bat file called "pinscape_enable.bat" enabling my pinball plunger.  When I close the emulator it will run "pinscape_disable.bat" which will disable my pinball plunger.  I have considered using the "additional apps" feature in launchbox but this is per rom and I have decided that I should implement it globally per emulator instead.

 

I feel overwhelmed here because I now need to implement this to visual pinball x, future pinball and pinball fx3.  Visual pinball x and pinball fx3 appear to launch just through lunchbox wearas future pinball launches using an auto hotkey script that I either copied or created about a year ago...  Any help with this is appreciated!

 

 

My real frustration is that I want to learn and understand how all this works in launchbox.  I want to learn to write and implement auto hotkey scrips myself so that I don't have to continue asking every time I do some weird stuff with an emulator (which I do all the time it seems).  Although auto hotkey appears simple at its face, a lot of the stuff I have to copy and past from the forums to get an emulator working is overwhelming to me...  Any suggestions on where I can learn all of this is appreciated.  Not just learning auto hot key stuff but also how all of the launchbox dialog boxes work (eg running script, exit script, etc. how do these fields actually work)...

 

**OTHER INFO**

I am completely hijacking my own forum post just to help somebody out there who might be struggling with my same issue- if anyone is interested in the command I used to quickly disable my pinscape device I linked it below.  This can be used for any device in windows (eg controllers not in use).  Just find the device in device manager right click it and go to properties > device details and select "hardware ids" from the dropdown (copy the information shown here, normally only the first line is needed).  Replace the hardware ids below with your hardware ides (the hardware id is in between the quotations of the command written below).  Write this to a txt document, change the file type to .bat instead of .txt.  You will need this bat file to run with administrator privileges and the easiest way to do this is to create a shortcut of the .bat file and then right click the shortcut, select properties > advanced button > check the box for "run as administrator" (use the shortcut to launch the main file).   

PNPUTIL /disable-device /deviceid "HID\VID_1209&PID_EAEA&REV_000:&MI_00"

*multiple devices can be added at one time to disable or enable simultaneously 

And to re enable create a separate bat file;

PNPUTIL /enable-device /deviceid "HID\VID_1209&PID_EAEA&REV_000:&MI_00"

 

NOTE

PNPUTIL /enable-device /deviceid "YOUR HARDWARE ID GOES HERE"

 

 

Edited by AceEsCloud
Link to comment
Share on other sites

  • AceEsCloud changed the title to Launching .bat files when running and exiting any emulator related to pinball (used to disable pinscape device or any unused controller)
9 hours ago, AceEsCloud said:

I have considered using the "additional apps" feature in launchbox but this is per rom and I have decided that I should implement it globally per emulator instead.

IF the device can be disabled while VPX or FP is running (while it's still loading, actually), you can put the [full] command to disable-device in the emulators Running Script.  The Running Script will execute whatever is in there as the emulator/game is being loaded.  Since the disable-device command would happen real fast, it might be able to do-its-thing before the emulator gets loaded.  You then add an escape sequence that will enable-device.

If disable-device has to be executed before the emulator is even a 'thought' (i.e. the above doesn't work), I can think of 2 options.  

  1. Add it to each table as an Additional App
  2. Create a new "emulator" that is a batch file (or AutoHotkey or PowerShell script or whatever flavor you prefer).  This "emulator" will:
    1. send the command for disable-device
    2. start the actual emulator with the 'ROM' that LaunchBox will pass to it
    3. wait for the emulator to exit
    4. send the command for enable-device

For option #1, you can add the Additional App(s) to all the games (tables) at once using this plugin.

Option #2, you wouldn't have to worry about the additional app(s) when adding new tables.

 

That all said, since you say disable/enable need to be ran as administrator,

  • the 1st paragraph option would need to have the (AHK) Running Script call the batch file shortcut(s).  Rather than just executing the command(s) in AHK lingo. Which shouldn't be an issue.
  • Option #1 won't work.
  • Option #2, the "emulator" will need to call the batch file shortcuts in step 1 and 4 to have them ran as administrator. (Similar to bullet #1)
    • Can't have "the emulator" ran as admin because it would then run the actual emulator as admin. Which you DON'T want.

 

9 hours ago, AceEsCloud said:

I want to learn to write and implement auto hotkey scrips myself so that I don't have to continue asking every time I do some weird stuff with an emulator (which I do all the time it seems). 

There's a small thread here on the Forum dedicated to AutoHotkey scripts that's geared specifically to LaunchBox and emulators.  When you have a little time, look through that and get a feel for how the AHK scripts are written.  Then to learn more about a specific command (i.e. "SetKeyDelay"), simply Google "AHK SetKeyDelay" (without quotes).  Note, this specific search, the 1st 2 results show in the links "AutoHotkey v1" and "AutoHotkey v2".  You want the result for version 1 which is the version LaunchBox has integrated.

 

Here's an example for Option #2 "creating an emulator" that's an AutoHotkey script.

 

  • Like 1
Link to comment
Share on other sites

9 hours ago, JoeViking245 said:

IF the device can be disabled while VPX or FP is running (while it's still loading, actually), you can put the [full] command to disable-device in the emulators Running Script.  The Running Script will execute whatever is in there as the emulator/game is being loaded.  Since the disable-device command would happen real fast, it might be able to do-its-thing before the emulator gets loaded.  You then add an escape sequence that will enable-device.

If disable-device has to be executed before the emulator is even a 'thought' (i.e. the above doesn't work), I can think of 2 options.  

  1. Add it to each table as an Additional App
  2. Create a new "emulator" that is a batch file (or AutoHotkey or PowerShell script or whatever flavor you prefer).  This "emulator" will:
    1. send the command for disable-device
    2. start the actual emulator with the 'ROM' that LaunchBox will pass to it
    3. wait for the emulator to exit
    4. send the command for enable-device

For option #1, you can add the Additional App(s) to all the games (tables) at once using this plugin.

Option #2, you wouldn't have to worry about the additional app(s) when adding new tables.

 

That all said, since you say disable/enable need to be ran as administrator,

  • the 1st paragraph option would need to have the (AHK) Running Script call the batch file shortcut(s).  Rather than just executing the command(s) in AHK lingo. Which shouldn't be an issue.
  • Option #1 won't work.
  • Option #2, the "emulator" will need to call the batch file shortcuts in step 1 and 4 to have them ran as administrator. (Similar to bullet #1)
    • Can't have "the emulator" ran as admin because it would then run the actual emulator as admin. Which you DON'T want.

 

There's a small thread here on the Forum dedicated to AutoHotkey scripts that's geared specifically to LaunchBox and emulators.  When you have a little time, look through that and get a feel for how the AHK scripts are written.  Then to learn more about a specific command (i.e. "SetKeyDelay"), simply Google "AHK SetKeyDelay" (without quotes).  Note, this specific search, the 1st 2 results show in the links "AutoHotkey v1" and "AutoHotkey v2".  You want the result for version 1 which is the version LaunchBox has integrated.

 

Here's an example for Option #2 "creating an emulator" that's an AutoHotkey script.

 

Thanks for the help, I will work on your suggestions and see what I come up with.  thanks

  • Like 1
Link to comment
Share on other sites

Posted (edited)

So I worked on a script for a little bit and learned that I cannot link to a shortcut using the AHK script.  It will just not find the file so I am left with having to link directly to the target file.  This now brings in the issue of opening "enable_pinscape.bat" as administrator.  I did some research on how to do this and I found that using the RunAs command I might be able to achieve what I am trying to do.  Below is a portion of the script I have been working on for Future Pinball and in one section of it I typed;

 

"Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_enable.bat"

 

This does launch the .bat file and the other parts of the script do launch my program, tables and DMD device.  It does not run the .bat as admin though so my device never gets enabled.  So I changed this a bit using the RunAs command which is shown in the 2nd paragraph but does not work;

 

Run, "dmdext.exe" mirror --source=futurepinball -q --virtual-stay-on-top --fps 60 -g "[GAMENAME]" --use-ini="C:\Visual Pinball\VPinMAME\FP_DmdDevice.ini", C:\Visual Pinball\VPinMAME, Min

RunAs, Administrator, MyPassword
Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_enable.bat"
RunAs
Sleep, 10000

Run, "C:\Games\Future Pinball\BAM\FPLoader.exe" /play /exit /open "%1%"
Sleep, 10000

While WinExist("ahk_exe Future Pinball.exe")
  sleep 700

Process, Close, dmdext.exe
ExitApp

 

I have attached an image to this that shows the error it returns with.  I have tried using my windows password in place of "MyPassword" but I don't believe this is how the RunAs command works but I really don't know.  I need to find a way to run the .bat file as admin but only the .bat file and not other programs contained within the script.  Also, I still need to add in the command to run the "pinscape_disable.bat" when the program closes but haven't started on that yet (figured I would solve this issue first).  Appreciate any help with this.

image.png.7ead9deb5ac11e00c84167db0ab67bde.png

 

Edited by AceEsCloud
Link to comment
Share on other sites

THIS WORKED!  Now just have to create something to launch the exit script.

 

Run, "dmdext.exe" mirror --source=futurepinball -q --virtual-stay-on-top --fps 60 -g "[GAMENAME]" --use-ini="C:\Visual Pinball\VPinMAME\FP_DmdDevice.ini", C:\Visual Pinball\VPinMAME, Min

Run *RunAs "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\no admin right\Pinscape_enable.bat"
Sleep, 10000

Run, "C:\Games\Future Pinball\BAM\FPLoader.exe" /play /exit /open "%1%"
Sleep, 10000

While WinExist("ahk_exe Future Pinball.exe")
  sleep 700

Process, Close, dmdext.exe
ExitApp

  • Like 1
Link to comment
Share on other sites

28 minutes ago, AceEsCloud said:

THIS WORKED!  Now just have to create something to launch the exit script.

Glad that worked.  

Since you're already 'hanging around' for FP to close in this script, use the same command you used for enable, and run disable, right after closing dmdext and before ExitApp.

  • Like 1
Link to comment
Share on other sites

Posted (edited)

Thanks for all the help so far!  The script works perfectly outside of launchbox by simply clicking it.  It does not load a table of course because that is handed off from launchbox but it does everything else (launches Future Pinball, DMD, enables my pinscape device and when closed disables etc).  However when it launches from launchbox it launches everything but my pinscape device never gets enabled. 

I am almost certain that it is not launching the .bat file as Administrator.  To test that it is properly launching I changed the target after the first (Run *RunAs) command to be a website instead of "pinscape_enable.bat".  When launched from launchbox everything opens as it should and my website is launched..  So I am assuming it just doesn't launch the .bat as administrator (but it does when I double click the script file outside of launchbox).  I don't know how to keep cmd prompt up to show me what the .bat file processed so I am not 100% certain but I can't think of anything else other than the administrative rights that would cause this.

Why would this script run perfectly outside launchbox but not in launchbox.  Once launchbox launches wouldn't it be the same as me just double clicking it?  I am a little confused about how I am launching this script in the emulator settings as well.  My settings were copied from other members on this forum because I don't fully understand what is going on.  I am confused as to why my emulator points to "ThirdParty\AutoHotkey\AutoHotkey.exe".  Why would I need to point to autohotkey.exe if my script uses autohotkey when it is launched because it is an .ahk script?  Maybe I have my emulator settings wrong?  

I don't understand why it does this but the only thing I can assume through completely guessing is that I am running a different version of autohotkey when launching from launchbox and maybe the *RunAs command is not enabled in this version..  This is a complete guess though as I have no idea.  My emulator settings are attached.  Any thoughts are appreciated as always.  Thanks

 

Side note, here is the current ahk scrip;

Run *RunAs "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\no admin right\Pinscape_enable.bat"
Sleep, 10000

Run, "dmdext.exe" mirror --source=futurepinball -q --virtual-stay-on-top --fps 60 -g "[GAMENAME]" --use-ini="C:\Visual Pinball\VPinMAME\FP_DmdDevice.ini", C:\Visual Pinball\VPinMAME, Min

Run, "C:\Games\Future Pinball\BAM\FPLoader.exe" /play /exit /open "%1%"
Sleep, 10000

While WinExist("ahk_exe Future Pinball.exe")
  sleep 700    

Process, Close, dmdext.exe
Run *RunAs "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\no admin right\Pinscape_disable.bat"
ExitApp

Screenshot 2024-06-01 113215.png

Edited by AceEsCloud
Link to comment
Share on other sites

31 minutes ago, AceEsCloud said:

I am almost certain that it is not launching the .bat file as Administrator.

Earlier you said you couldn't Run a file that is a shortcut.  At the time I ignored that.  I think now, times are a changin'. ;) 

If you have a batch file located:  D:\MyFiles\myBatchFile.bat

..and you create a shortcut in the same folder to that file, the file will show as D:\MyFiles\myBatchFile.bat - Shortcut

To execute the shortcut in an ahk script, use:

Run, "D:\MyFiles\myBatchFile.bat - Shortcut.lnk"

..adding the file extension .lnk (that's an L (ell). Not an i (eye).  Short for LINK).

Since your shortcut is already set to run as admin, this should work. And you shouldn't need to use "Run *RunAs".

 

47 minutes ago, AceEsCloud said:

I don't know how to keep cmd prompt up to show me what the .bat file processed

At the end of the batch file, add "pause" (without quotes).  This will hold the command prompt window open until you press the 'any' key.

If and when everything gets to working properly (fingers crossed), you'll want to remove that.  Then, as a bonus, edit the shortcut file(s) (properties) and in the Shortcut tab, change Run to Minimized.  That will then hide the command prompt window. Giving it that finishing touch.

 

55 minutes ago, AceEsCloud said:

I am confused as to why my emulator points to "ThirdParty\AutoHotkey\AutoHotkey.exe".  Why would I need to point to autohotkey.exe if my script uses autohotkey when it is launched because it is an .ahk script?  Maybe I have my emulator settings wrong?

Your emulator settings look fine. 

The scripts have the file extension .ahk .  If you have AutoHotkey installed, that file extension will be registered to it.   When double clicking the file, it will open with your installed version of AutoHotkey.  Not everyone has it actually "installed".  So double clicking a file with a .ahk extension would do nothing (except ask you what application you want to open the file with). 

In my examples of creating an AHK script 'as an emulator', it was just easier to have them launch the script using AutoHotkey that comes with LaunchBox than to assume they have it installed.

To use your installed version of AutoHotkey, replace the Application Path with the path to your installed copy of AutoHotkey.exe.  Alternately, since the file extension .ahk is registered to AutoHotkey (that you installed on your system), you could replace the Application Path with the path to your script (.ahk file) and then remove the Default Command-line Parameters.

  • Like 1
Link to comment
Share on other sites

As always late to the party, but rather than calling a separate bat file and running as admin, I do the following to enable/disable my wiibar when needing it

Run *Runas "pnputil" /enable-device "USB\VID_057E&PID_0306\5&15C311E1&0&10",C:\WINDOWS\system32,hide
Run *Runas "pnputil" /disable-device "USB\VID_057E&PID_0306\5&15C311E1&0&10",C:\WINDOWS\system32,hide

Now you will need to change it to your device rather than mine, but that could make it all nice and tidy in one ahk

Using *Runas to make admin, the hide at the end means it hides the command window that pnputil would open.

Might be worth trying if the bat file or shortcut doesn't work for some reason

  • Like 2
Link to comment
Share on other sites

Posted (edited)
4 hours ago, JoeViking245 said:

Earlier you said you couldn't Run a file that is a shortcut.  At the time I ignored that.  I think now, times are a changin'. ;) 

If you have a batch file located:  D:\MyFiles\myBatchFile.bat

..and you create a shortcut in the same folder to that file, the file will show as D:\MyFiles\myBatchFile.bat - Shortcut

To execute the shortcut in an ahk script, use:

Run, "D:\MyFiles\myBatchFile.bat - Shortcut.lnk"

..adding the file extension .lnk (that's an L (ell). Not an i (eye).  Short for LINK).

Since your shortcut is already set to run as admin, this should work. And you shouldn't need to use "Run *RunAs".

 

At the end of the batch file, add "pause" (without quotes).  This will hold the command prompt window open until you press the 'any' key.

If and when everything gets to working properly (fingers crossed), you'll want to remove that.  Then, as a bonus, edit the shortcut file(s) (properties) and in the Shortcut tab, change Run to Minimized.  That will then hide the command prompt window. Giving it that finishing touch.

 

Your emulator settings look fine. 

The scripts have the file extension .ahk .  If you have AutoHotkey installed, that file extension will be registered to it.   When double clicking the file, it will open with your installed version of AutoHotkey.  Not everyone has it actually "installed".  So double clicking a file with a .ahk extension would do nothing (except ask you what application you want to open the file with). 

In my examples of creating an AHK script 'as an emulator', it was just easier to have them launch the script using AutoHotkey that comes with LaunchBox than to assume they have it installed.

To use your installed version of AutoHotkey, replace the Application Path with the path to your installed copy of AutoHotkey.exe.  Alternately, since the file extension .ahk is registered to AutoHotkey (that you installed on your system), you could replace the Application Path with the path to your script (.ahk file) and then remove the Default Command-line Parameters.

YAY!!!  the first part of your post did not work (using short cut).  However changing my emulator to point directly at my script vs. using launchbox's preinstalled autohotkey.exe did.  The only thing I can assume is that the AutoHotKey.exe version that comes with launchbox blocks any app from running as administrator.  This works perfect now with Future Pinball!  I have to setup FX3 and Visual pinball now.  These do not use AHK scrips to load though so I have to now figure this out.  I do believe that this will be easier than the latter was and if you know off hand how to do this please let me know (emulator screenshots below).  REALLY BLOWN AWAY BY THE HELP I RECEIVED, THANK YOU VERY MUCH!!!

 

Also, I did end up linking to the shortcut and set that to run as administrator.  I did this so that I was easily able to set more launch options without having to figure out the script to do so (eg- changing the shortcut properties from run to minimize).  I want to note that this also worked with *RunAs directly to the .bat file though so it is loading as administrator in either setup!  Final script below;

 

Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_enable.bat - Shortcut.lnk"
Sleep, 10000

Run, "dmdext.exe" mirror --source=futurepinball -q --virtual-stay-on-top --fps 60 -g "[GAMENAME]" --use-ini="C:\Visual Pinball\VPinMAME\FP_DmdDevice.ini", C:\Visual Pinball\VPinMAME, Min

Run, "C:\Games\Future Pinball\BAM\FPLoader.exe" /play /exit /open "%1%"
Sleep, 10000

While WinExist("ahk_exe Future Pinball.exe")
  sleep 700    

Process, Close, dmdext.exe
Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\no admin right\Pinscape_disable.bat - Shortcut.lnk"
ExitApp

vpin.png

pinball fx.png

Edited by AceEsCloud
Link to comment
Share on other sites

11 minutes ago, AceEsCloud said:

I have to setup FX3 and Visual pinball now.

For VPX, just do the same as you did for FP (create a new "emulator") but change the references from FP to VPX.

Run, "C:\Games\Visual Pinball\VPinballX.exe" -minimized -exit -play "%1%"
Sleep, 10000

While WinExist("ahk_exe VPinballX.exe")
  sleep 700

Oh, and shouldn't need   "Run, "dmdext.exe"....".

 

FX3 might be a little trickier as I believe it uses a 'launcher' of sorts to open the table.  So you'd need to figure out what to put in the line for "While WinExists...".  This may be different (the exe or window Title to look for) for each Table.

  • Like 1
Link to comment
Share on other sites

I'm getting an error with Visual Pinball when trying to launch from a script;

Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_enable.bat - Shortcut.lnk"
Sleep, 10000

Run, "C:\Visual Pinball\VPinballX.exe" -minimized -exit -play
Sleep, 10000

While WinExist("ahk_exe VPinballX.exe")
  sleep 700

Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_disable.bat - Shortcut.lnk"
ExitApp

image.png

Link to comment
Share on other sites

That was in there, I somhow managed to delete it when I retyped for the forum, same issue exists;

Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_enable.bat - Shortcut.lnk"
Sleep, 10000

Run, "C:\Visual Pinball\VPinballX.exe" -minimized -exit -play "%1%"
Sleep, 10000

While WinExist("ahk_exe VPinballX.exe")
  sleep 700

Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_disable.bat - Shortcut.lnk"
ExitApp

 

On another note, I was able to very easily get Pinball FX3 working.  Instant dopamine hit but then was quickly lost when I realized I never setup my pinball plunger to work with FX3 anyway LMAO...  Guess that's a project for another day but I'll probably have to use xarcade input or some other KEY to XInput app to get this working (Plunger is seen as a controller but my buttons are L and R shift)...  I'll drop the script in the forum later in case anyone else ever needs it.

 

Link to comment
Share on other sites

Below was the AHK for pinball FX3.  For some reason or another I had to convert the AHK to an EXE THEN point my emulator at the EXE.  I may try this for Visual Pinball but can't see why it would make a difference.  

#SingleInstance, Force
Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_enable.bat - Shortcut.lnk"
Sleep, 10000
Run, "C:\Program Files (x86)\Steam\Steam.exe" -applaunch 442120 -class -table_"%1%"
#IfWinActive ahk_exe Pinball FX3.exe
SendMode, Input
$Esc::
Process, Close, Pinball FX3.exe
ExitApp
return
$vk07::
Process, Close, Pinball FX3.exe
Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_disable.bat - Shortcut.lnk"
ExitApp

Link to comment
Share on other sites

53 minutes ago, AceEsCloud said:

That was in there, I somhow managed to delete it when I retyped for the forum, same issue exists;

Can you share a screenshot of the main details section for your AHK-VPX emulator (whatever you called it)?   

 

Side note:  Looking through some notes, instead of the 2 lines (While WinExist...  and Sleep...),  you could use 1 line:

Process, WaitClose, VPinballX.exe

(if you want, both ways do the same thing)

  • Like 1
Link to comment
Share on other sites

I don't believe launchbox liked me pointing to a .ahk file and I remembered having an issue with this in the past with another emulator as well.  So I simply converted the .ahk to a .exe and pointed to it.  I am now having a new issue.  When I run the autohotkey exe I created it opens up everything as it should.  When launchbox runs it it comes up with an error "error loading c:\visual". 

This almost appears like it tried to load c:\visual because there is a space between visual and visual pinball but "c:\visual pinball\" is covered by quotations so this shouldn't have been an issue?  I don't know...  I feel like I'm soo close.  Anyways, current script below as well as emulator settings screenshot and error screenshot.  

This was what I converted to exe;

Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_enable.bat - Shortcut.lnk"
Sleep, 10000

Run, "C:\Visual Pinball\VPinballX.exe" -minimized -exit -play %1%
Sleep, 10000

While WinExist("ahk_exe VPinballX.exe")
  sleep 700

Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_disable.bat - Shortcut.lnk"
ExitApp

Screenshot 2024-06-02 151413.png

Screenshot 2024-06-02 152233.png

Link to comment
Share on other sites

1 hour ago, AceEsCloud said:

Below was the AHK for pinball FX3.  For some reason or another I had to convert the AHK to an EXE THEN point my emulator at the EXE.  I may try this for Visual Pinball but can't see why it would make a difference.  

Not sure why it wouldn't work as a .ahk but does as a .exe.

 

Here's some code streamlining... 

  • Reduced the sleep timer from 10 seconds to 2 seconds (guessing that it doesn't actually take that long)
  • Removed #IfWinActive and SendMode.  (At least with my keyboard and Xbox controller, it's not needed.)
  • Combined the 2 hot keys since they are to do the same thing. Still gives the option to press one or the other.
  • Changed Process, Close to send Alt+F4.  No particular reason. They do the same thing (in this case)
#SingleInstance, Force
Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_enable.bat - Shortcut.lnk"
Sleep, 2000
Run, "C:\Program Files (x86)\Steam\Steam.exe" -applaunch 442120 -class -table_"%1%"

$Esc::
$vk07::
  Send, !{F4}
  Run, "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_disable.bat - Shortcut.lnk"
  ExitApp

 

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