Jump to content
LaunchBox Community Forums

Autohotkey script to Open/Close BetterJoy


otavioraposojr

Recommended Posts

18 minutes ago, Koroth said:

You can close a program by using a window title/class name or a process name. You don't need a full path for that (if I understand you correctly.) Let me know if it works.

No, neither way is killing the process. It continues running. I assume I am to put it in the emulators Exit AHK Script section, correct?

Link to comment
Share on other sites

4 minutes ago, Koroth said:

No, in the running autohotkey section.

I tried it both ways, still not ending DS4. 

Tried this:

Run, "D:\Program Files (Portable)\DS4Windows\DS4Windows.exe"

$Esc::
{
Process, Close, DS4Windows.exe

 

and this:

Run, "D:\Program Files (Portable)\DS4Windows\DS4Windows.exe"

$Esc::
{
WinClose, ahk_exe DS4Windows.exe

DS4 keeps running

Link to comment
Share on other sites

A few things come to mind. I use DS4Windows myself and there are a few things to consider. First, in the DS4Windows settings there is a checkbox "Hide DS4 Controller". If that is checked it starts DS4Windows with admin rights and needs to be closed via a script with admin rights. Second, there is also a checkbox "Close Minimizes". Make sure that one is unchecked.

*Edit*

I myself have the checkbox "Start Minimized" checked.

Edited by Koroth
Link to comment
Share on other sites

12 minutes ago, Koroth said:

A few things come to mind. I use DS4Windows myself and there are a few things to consider. First, in the DS4Windows settings there is a checkbox "Hide DS4 Controller". If that is checked it starts DS4Windows with admin rights and needs to be closed via a script with admin rights. Second, there is also a checkbox "Close Minimizes". Make sure that one is unchecked.

*Edit*

I myself have the checkbox "Start Minimized" checked.

Currently working with Yuzu

I did not have "Hide DS4 Controller" checked.  I DID have "Close Minimizes" checked, sure never thought of that one, lol, but unchecked it now.  Do have "Start Minimized" checked as well. Does DS4 end for you when you exit a game? I still have to exit it from the taskbar.

Here is SS of DS4 settings and LB to make sure we are on the same page here....

 

Untitled.jpg

Untitled2.jpg

Link to comment
Share on other sites

14 minutes ago, Wanderer189 said:

Does DS4 end for you when you exit a game?

My situation is a little different then yours. I have DS4Windows run at system boot. So all my games and emulators see my DS4 Controller as a Xbox 360 controller. The only emulator that I want to exit DS4Windows for is Rpcs3, witch has native support for the DS4 and it's gyro functions. But in the DS4Windows settings I have "Hide DS4 Controller" checked to prevent double inputs. But that starts DS4Windows with admin rights, so I use an elevated script to exit DS4Windows when I start a game in Rpcs3. Then when I exit a game in Rpcs3 I run DS4Windows again. (All this via the Running Autohotkey tab for Rpcs3.)

Link to comment
Share on other sites

11 minutes ago, Koroth said:

It looks right to me. But some programs are harder to close then others.

As a last resort (because I do not find it a elegant solution), you could try:


$Esc::
{
Run, TASKKILL /F /IM DS4Windows.exe
}  

This should kill DS4Windows

Sadly, doesn't work either. I know nothing about AHK, is there anything Win10 needs that I amy be missing? Everything on system is up-to-date.  I have a bat file to kill it that works. I tried to add it to AHK:

Run, "D:\Program Files (Portable)\DS4Windows\DS4Windows.exe"

$Esc::
{
Run, "D:\Gaming\DS4Windows\DS4W Off.bat"

It doesn't work when I add it to the script (if I called it right)

Link to comment
Share on other sites

2 minutes ago, Koroth said:

My situation is a little different then yours. I have DS4Windows run at system boot. So all my games and emulators see my DS4 Controller as a Xbox 360 controller. The only emulator that I want to exit DS4Windows for is Rpcs3, witch has native support for the DS4 and it's gyro functions. But in the DS4Windows settings I have "Hide DS4 Controller" checked to prevent double inputs. But that starts DS4Windows with admin rights, so I use an elevated script to exit DS4Windows when I start a game in Rpcs3. Then when I exit a game in Rpcs3 I run DS4Windows again. (All this via the Running Autohotkey tab for Rpcs3.)

I was trying to do the same thing a few months back, but never got it working. Recently, I have had a couple PC games having issues when DS4 is running, like Trine 4 and a couple others. So I thought I might just call on DS4 per emulator as needed. Got to have the gyro features in Yuzu and Cemu, ya know?

Link to comment
Share on other sites

4 minutes ago, Wanderer189 said:

So how did you accomplish this:

"so I use an elevated script to exit DS4Windows when I start a game in Rpcs3. Then when I exit a game in Rpcs3 I run DS4Windows again. (All this via the Running Autohotkey tab for Rpcs3.)"

By first making a .bat file that kills DS4Windows and than compile that to an .exe that can be run with admin rights. To prevent UAC pop-ups I created elevated shortcuts to that .exe via Task Scheduler that I run in the running autohotkey tab for Rpcs3. More info here: https://www.tenforums.com/tutorials/57690-create-elevated-shortcut-without-uac-prompt-windows-10-a.html It may all be a bit convoluted, but hey, for me tinkering is half the fun of emulation. I'm sorry that closing DS4Windows doesn't work for you, but at this moment I'm all out of ideas. If something comes to mind I will let you know.

Link to comment
Share on other sites

7 minutes ago, Koroth said:

By first making a .bat file that kills DS4Windows and than compile that to an .exe that can be run with admin rights. To prevent UAC pop-ups I created elevated shortcuts to that .exe via Task Scheduler that I run in the running autohotkey tab for Rpcs3. More info here: https://www.tenforums.com/tutorials/57690-create-elevated-shortcut-without-uac-prompt-windows-10-a.html It may all be a bit convoluted, but hey, for me tinkering is half the fun of emulation. I'm sorry that closing DS4Windows doesn't work for you, but at this moment I'm all out of ideas. If something comes to mind I will let you know.

You been a great help and I appreciate your time. I understood most of that, but not how you compile an exe from a bat file???

Link to comment
Share on other sites

I'll post my autohotkey script that I use in the running autohotkey tab for Rscp3. This script only works for me because it's specific to my situation:

SetTitleMatchMode, 2
SendMode Input
SetWorkingDir %A_ScriptDir%\..\..
Run, %A_WorkingDir%\Opstarten\DS4WinTaskkill.lnk
Loop
{
     if WinExist("Building SPU cache...")
     If (ErrorLevel = 0 )
          {
          WinActivate, Building
          WinMaximize, Building
          WinSet, AlwaysOnTop,
          Break
          }
     Else
     Sleep 1000
     Continue
}
WinWait, FPS ahk_class Qt5QWindowIcon
WinActivate,
Sleep 500
Send, !{Enter down}
Sleep 200
Send, !{Enter up} 
Sleep 500
MouseMove, 3840, -2160, 0

$Esc::
{
Send, {Esc down}
Sleep 100
Send, {Esc up}
Sleep 500
Send ^{p down}
Sleep 100
Send ^{p up}
Sleep 500
Send, {Esc down}
Sleep 100
Send, {Esc up}
Sleep 500
Send ^{s down}
Sleep 100
Send ^{s up}
Sleep 1000
Process, Close, rpcs3.exe
Run, "\LaunchBox\Opstarten\DS4Windows.lnk"
}

 

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