Jump to content
LaunchBox Community Forums

Additional Apps "After" seems to run immediately


Massivebasset

Recommended Posts

one last thing. jut to prove if castle.exe is running twice, can you change the batch file to this below to run before and after to see if the process id matches what see see in task manager a few seconds after starting the game?

so, launch the games, wait a few seconds, look at the castle.exe process id and note it down, exit the game, look at log.txt for the first process id that ran and see if they differ.

echo %time% >> c:\temp\log.txt
tasklist /FI "IMAGENAME eq castle.exe" >> c:\temp\log.txt

 

Link to comment
Share on other sites

15 minutes ago, Massivebasset said:

Well if you write it, Id be happy to have it =D

yeah i'll write in ahk script so you'll need to install free autohotkey. i think it's better that i post it on LB in ahk file form rather than converting to exe because people would need to modify the name of the exe in it, or other settings, to suit what they may need it for. then each user can convert it to exe with their ahk install if they'd rather use it in exe form.

Link to comment
Share on other sites

For what Im trying to do with castle crashers its:

 

Application path:

C:\Program Files (x86)\VJoy\VJoy.exe

Command line Parameters:

-enable 1 -file "c:\program files (x86)\vjoy\castlecrashers.ini"

 

On exit:

-enable 0  

or

-exit

 

Exit kills the program, and is what led me to see that it was executing early as opposed to just not working.  Enable 0 leaves Vjoy running but just turns it off, either one works I guess.

 

Link to comment
Share on other sites

Can you try this real quick? Paste the code into notepad and save it as a vbscript file, so like aftercastle.vbs

You shouldn't need to install anything for this script.

Add this script as your AFTER app. Still keep your existing BEFORE app.

I haven't been able to test it, but I think it should work. Let me know.




Const strProcessName = "castle.exe"



' line below is set to wait 5 seconds before start checking for process



WScript.Sleep 5000











Set oWMISvc = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")



boolRunning = True







' Loop while the process is running



Do While boolRunning



  Set colProc = oWMISvc.ExecQuery("SELECT * FROM Win32_Process WHERE Name='" & strProcessName & "'")



  boolRunning = False



  For Each oProc In colProc



    boolRunning = True



  Next



  Set colProc = Nothing



  WScript.Sleep 500



Loop











Set objShell = WScript.CreateObject("WScript.Shell")



objShell.Run """C:\Program Files (x86)\VJoy\VJoy.exe""" & "-exit", 1, True



Set objShell = Nothing

 

Edit: I meant to say add this vbscript as another BEFORE app (although it would also probably work for your game as an after script too. You might need to add a couple seconds if it doesn't work.

Edited by ckp
Link to comment
Share on other sites

Here is an autohotkey script to do it. Save the file with .ahk extension and you need to have autohotkey installed.

I'll probably use this if I hit your issue. The vbscript is pretty ugly. Note, you could also run your BEFORE app command as the first line of this script if you just want to add one BEFORE app in the game's additional apps tab.


Sleep 5000  ; dont start checking for 5 seconds



Loop



{



   Process,Exist, castle.exe ; find if the process exists







   If ( ErrorLevel = 0 ) ; If ErrorLevel is equal to 0 here, this means the process did not exist



   {



      Run, C:\Program Files (x86)\VJoy\VJoy.exe -exit



      Break







   }



   Else ; if the process existed when we first checked, restart the loop and check again



      Sleep 1000 ; you need this so autohotkey does not use up cpu



      Continue







}

 

Edit: You "might" need to wrap the launch of vjoy in quotes like this:  "C:\Program Files (x86)\VJoy\VJoy.exe"

Edited by ckp
  • Thanks 1
Link to comment
Share on other sites

  • 5 months later...

Just wanted to say big thanks for clearing this up.
Solved all my problems with setting up Street Fighter 5 which starts with 1 exe and then kills it and starts another 3 exe's.

The VB script works like a charm :D

Link to comment
Share on other sites

  • 2 months later...
  • 6 months later...

wanted to reply to this thread saying thats exactly my issue right now as well, launching path of exile makes a few different processes before settling into the final one. it makes having a script killer setup for after closing the game impossible, and unfortunately one of the applications will open several instances of itself if I dont kill the scripts afterwards. 

Link to comment
Share on other sites

  • 3 years later...

After trying over and over again to get an ultrastik config file to load AFTER I closed out a Steam game, using the script ckp posted solved my issue.

Using the additional app on program start works fine and runs the necessary .ugc file to set my joysticks to act as a mouse, but using the app section within LB to run a .ugc file upon exit to reset my joysticks back to 8-way never would.

Old threads do help!  Thanks!

 

 

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