Jump to content
LaunchBox Community Forums

Run a Batch File per System


The Papaw

Recommended Posts

I mainly use DS4 controllers most of the time and use DS4Windows with most of them. But there are times when I want to use the DS4 controllers on the PC without using DS4Windows. A few PC games that don't like DS4W and when playing PS3 games using RPCS3 emulator. I do a lot of home automation, and I can get a bit crazy with some of it.  For example, I have a 55" 4K TV hanging on my bedroom wall over my gaming PC, If I am on working on the PC and decide I want to play games, I just say, "Alexa, let the games begin" (I actually have it done all local without Alexa or GH, but everyone knows how Alexa works).

Through my routines and my HA toys, my lights will adjust, TV will switch to appropriate HDMI source, a couple programs will excecute on the PC to switch the primary display to the 4k, dim the monitor, etc. Start DS4W, and launch Bigbox (which will now be on the 4K) and it's ready to go. All I have to do is grab the controller from the charger on my way back from the coffee pot and it is ready for me to kick back and play. (yes, I know, LAZY)

Ok, now to my question. Is there a way I can execute my batch file that closes/kills the DS4Windows process when I play any game in a particular system, say PS3. I know it can be done on a per game basis, but how about a entire system? I mainly need this for Play Station 1,2,3 emulation.

Thanks in advance

Link to comment
Share on other sites

Sounds like a lot of IFTTT type applets.  And I believe the preferred term is efficient rather than lazy. :) 

For now, probably the easiest way to to what you'e wanting is to redirect you emulator executable for the given Platform to an AHK script (or batch file).  Basically, edit your emulator and in "Emulator Application Path:", point that to the script file.

Then your script file would be something like

Run, D:\batch\kill_DS4W.bat
RunWait, "path_to_emulator.exe" %1%
Run, D:\batch\start_DS4W.bat
ExitApp

LaunchBox will pass the rom_name as %1%.  Obviously calling a script to call a batch file is pretty convoluted.  But you can how that'd work and (hopefully) refine it.

Link to comment
Share on other sites

On 1/3/2020 at 8:26 AM, JoeViking245 said:

Sounds like a lot of IFTTT type applets.  And I believe the preferred term is efficient rather than lazy. :) 

For now, probably the easiest way to to what you'e wanting is to redirect you emulator executable for the given Platform to an AHK script (or batch file).  Basically, edit your emulator and in "Emulator Application Path:", point that to the script file.

Then your script file would be something like


Run, D:\batch\kill_DS4W.bat
RunWait, "path_to_emulator.exe" %1%
Run, D:\batch\start_DS4W.bat
ExitApp

LaunchBox will pass the rom_name as %1%.  Obviously calling a script to call a batch file is pretty convoluted.  But you can how that'd work and (hopefully) refine it.

Thanks for replying. Not using any IFTTT, most is all done local with Hubitat Hub.

I am re-thinking all this before I start it. With all the recent rounds of buggyness with LB/RA and controllers, ya know? Currently I am starting DS4W before launching BB, so it is configured to use DS4W as well are the emulators I use. Maybe I should start over.  LB is the root of the tree, so to speak, so I am thinking if I do it the current way, when I kill the DS4W process say to play PS3 games, when I exit a game, LB is going to be messed up. I am beginning to think it isn't going to work doing it system wide? Even if I re-do everything to not use DS4W, then call it say for Wii U, everytime I exit a game, LB will probably mess up. I might be stuck trying to do something on a game-by-game basis.

Not sure how I would do that either..lol

Link to comment
Share on other sites

On 1/4/2020 at 9:27 AM, JoeViking245 said:

LB/BB shouldn't be messed up when exiting a game if the 3rd line (re-starting DS4W) get's executed.

This is essentially a 'bulk' means of the game-by-game process.  It's doing the 'Run Before [line 1]/After [line 3] Main Application [line 2]' you'd need to enter in for each game.

Just getting time to try this, but isn't working. Maybe you can shed some light on it or catch something I am doing wrong. Here is the batch file I am trying to run:

Run, D:\Gaming\Apps\Launchbox\Script Files\DS4W_Off.bat
RunWait, "D:\Gaming\Emulators\RPCS3\rpcs3.exe" %1%
Run, D:\Gaming\Apps\Launchbox\Script Files\DS4W_On.bat
ExitApp

LB is going to the theme start screen, then throwning error:

"An error occured while trying to launch the game: The specified executable is not a valid application for this OS platform."

 

Link to comment
Share on other sites

Oh crikey!  Forgot some [important] stuff.?  Sorry about that.

Run, %comspec% /c "D:\Gaming\Apps\Launchbox\Script Files\DS4W_Off.bat",,hide
Sleep, 1000     ; Just in case it needs a sec to 'turn off' DS4W.  1000 = 1 second 
RunWait, "D:\Gaming\Emulators\RPCS3\rpcs3.exe" %1%
Run, %comspec% /c "D:\Gaming\Apps\Launchbox\Script Files\DS4W_On.bat",,hide
ExitApp

Threw the Sleep line in just in case.  Increase, decrease or remove as necessary.

Link to comment
Share on other sites

22 hours ago, JoeViking245 said:

Oh crikey!  Forgot some [important] stuff.?  Sorry about that.


Run, %comspec% /c "D:\Gaming\Apps\Launchbox\Script Files\DS4W_Off.bat",,hide
Sleep, 1000     ; Just in case it needs a sec to 'turn off' DS4W.  1000 = 1 second 
RunWait, "D:\Gaming\Emulators\RPCS3\rpcs3.exe" %1%
Run, %comspec% /c "D:\Gaming\Apps\Launchbox\Script Files\DS4W_On.bat",,hide
ExitApp

Threw the Sleep line in just in case.  Increase, decrease or remove as necessary.

Still not working, not getting OS error though, just start screen and back to LB. I tried REMing (remark) out all lines but the 1st one, to see if will just kill DS4W and it doesn't.  (what is the /c switch and the ",," for?)

Things have changed a bit and my DOS skills are pretty old...haha

Link to comment
Share on other sites

Because of the batch file, we need to use %comspec% which opens a 'DOS' window as well as whatever the batch file opens.  /c closes the DOS window when the batch is done.  In between ,, would go the parameter for "working directory" but with nothing there is acting like a place holder so we can push 'hide'.

If you open your command window (get to the DOS prompt) and are at "D:\" [root directory] and type in "D:\Gaming\Apps\Launchbox\Script Files\DS4W_Off.bat"  (need to include the quotes [because of the space between "Script" and "Files"], will it run as expected?

Link to comment
Share on other sites

No, still doesn't execute to the bat file.  I removed the space in "Script Files", changed to Script_Files and tried that as well.

Giving me "D:\Gaming\Apps\Launchbox\Script_Files\DS4W_Off.bat"' is not recognized as an internal or external command,
operable program or batch file."  in both cases.

 

Edited by Wanderer189
Link to comment
Share on other sites

Let's backtrack a little.... A few posts back, for troubleshooting purposes your rem'd some lines attempting a process-of-elimination.  And earlier before that you mentioned "Here is the batch file..." .  Sorry I didn't catch that before, but the script (posted above) was to be an AutoHotKey's (AHK) script. I know both types were mentioned and I wasn't very clear on that.  I apologize.  So "the script" above should have a file extension of  .ahk     [to rem out a line, AHK uses a ; (semicolon) instead of 'rem'. ] 

However, I think you also indicated you ran "DS4W_Off.bat" by itself at the DOS prompt and it didn't work.?.?.  I wouldn't think you'd need to create a shortcut (.lnk) to your batch files since the AHK script is pointing to the full path of the batch file itself.

What do the DS4W_Off[/On] batch files look like themselves?  Their 'commands' could be simply put into the AHK script file (using AHK 'lingo' of course) instead of pointing to an outside batch file.  But either way is fine.

Again, I apologize for creating confusion.  But I do know this method does (and will) work.

 

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