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

I added quotations around the %1%.  It launches the tables and roms perfectly.  It does not enable the pinscape device.  I messed around with this a bit and learned that if I execute the .ahk file it does enable the plunger but if I execute that same .ahk file as a .exe it does not.  

 

I was stunned by this because I am essentially doing the same thing in pinball FX3 (converted the .ahk to a .exe) and to my shock pinball FX3 also no longer works.  I have changed nothing to my knowledge.  I tried rebooting to see if it was a hardware error but it is not.  Future pinball still works flawlessly....  So close yet so far.  Here is what I scripted for VisualPinball (note I omitted the pinscape disable portion just to make sure that isn't a factor).  Wondering if I am back to running as administrator issues...  idk  I'm going to keep messing around but can't at the moment.

 

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

ExitApp

Link to comment
Share on other sites

I tried Klinkyfox's suggestion yesterday and I cannot remember the issue I had but I had an issue that I could not solve. 

I believe the issue I am having is similar to the issue I was having yesterday.  I have AutoHotkey V 2.0.13 installed on my system.  When I launch a .ahk script it uses the AutoHotkey version I have installed on my system AND WORKS GREAT.  Because AutoHotkey V 2.0.13 is installed on my system I am assuming it has more permissions than a portable .exe

When I convert VP_Load_Script.ahk to a .exe I compile it using base file "v1.1.36.02" and it creates a .exe that runs this version (which I assume does not have the permissions to run my .bat file as an administrator).  

To fix this, I attempted to compile this as a "v2.0.13 U64 AutoHotkey.64" which is the version installed in my system.  This way when it loads the .exe it uses the version installed on my system.  Issue is, I cannot compile this using v2.0.13 though because the Syntax used in AutoHotkey v2 is different from V1 (I think).  So now I'm trying to find a way to force my .exe to use my installed version or elevate the permissions of this .exe file somehow.  

If I can't figure out how to do that I am going to figure out how to rewrite the v1 syntax in v2 form...

image.png.3c4eb1893b2bca50c31e2d780c7a2a99.png

Link to comment
Share on other sites

This was what I converted to .exe using v1.1.36.02.  Works great, I'm cleaning everything up a bit but I think my issue is resolved!!!!  thanks again!

 

Run *RunAs "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_enable.bat"
Sleep, 2000

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

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

Process, WaitClose, VPinballX.exe
Run *RunAs "C:\Users\Arcade\LaunchBox\Tools\Pinscape disabler\Pinscape_disable.bat"
Sleep, 2000
ExitApp

  • Game On 1
Link to comment
Share on other sites

19 minutes ago, AceEsCloud said:

This was what I converted to .exe using v1.1.36.02.  Works great, I'm cleaning everything up a bit but I think my issue is resolved!!!!  thanks again!

Woot! Woot!  Glad to hear!!   Also, I have never ventured into V2.0+.  So you would have been on your own. lol

  • Like 1
Link to comment
Share on other sites

I learned of one more small issue.  When I launch Visual pinball tables through bigbox it launches and closes fine but I have to mouse click on bigbox to regain focus (like bigbox wasn't the selected screen after closing).  Is there an easy fix for this?

Link to comment
Share on other sites

9 minutes ago, AceEsCloud said:

I learned of one more small issue.  When I launch Visual pinball tables through bigbox it launches and closes fine but I have to mouse click on bigbox to regain focus (like bigbox wasn't the selected screen after closing).  Is there an easy fix for this?

Right before ExitApp, add 2 lines

WinActivate, ahk_exe LaunchBox.exe
WinActivate, ahk_exe BigBox.exe
ExitApp

If you never use LaunchBox, you can omit the 1st line.  But it doesn't hurt anything having them both in.

  • Like 1
Link to comment
Share on other sites

40 minutes ago, JoeViking245 said:

Right before ExitApp, add 2 lines

WinActivate, ahk_exe LaunchBox.exe
WinActivate, ahk_exe BigBox.exe
ExitApp

If you never use LaunchBox, you can omit the 1st line.  But it doesn't hurt anything having them both in.

You are awesome my friend!

  • Game On 1
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...