Jump to content
LaunchBox Community Forums

Exit Script with Gamepad Button


danielsan27

Recommended Posts

Hi there,

on LB i use the following script for exiting any emulator, with success:

 

$Esc::
{
    Process, Close, {{{StartupEXE}}}
}

where after "$", i can put every key, it works!

Now, i want to use a Pad Button, instead of key...

On AHK script i know for joypad1 button 4, for example i use 1Joy4 ...

Tried this

1Joy4::
{
    Process, Close, {{{StartupEXE}}}
}

no works. tried with some emulators.

I've tried: Joy4, joy4, 1joy4 ...no works!

Obviously, Gamepad is enabled on LB.

Some help? ty on advance

Link to comment
Share on other sites

5 hours ago, danielsan27 said:

Now, i want to use a Pad Button, instead of key...

On AHK script i know for joypad1 button 4, for example i use 1Joy4 ...

Tried this

1Joy4::
{
    Process, Close, {{{StartupEXE}}}
}

no works. tried with some emulators.

I've tried: Joy4, joy4, 1joy4 ...no works!

1Joy4:: (like you started with) is the one that should work.

There's a chance the emulator is "taking over" the controller so AHK isn't able to catch the button press.  I assume the controller works normally in-game, otherwise. 

What emulator are you trying to make this work with?  What other emulators did you try it with that also didn't work?

There's a slight chance what you call button "4", AHK sees as a physical different button.  Try "smashing" the other buttons?

If you have Steam running, it might be "taking over".

 

Since the basic Process, Close, {{{StartupEXE}}} works with $Esc::, if you have LaunchBox premium, should be able to, instead of using a script, map the button 4 press to "Exit Game" (or "Close the Active Window" in BigBox).  Note, LaunchBox and BigBox controller mappings need to be done separately.

Also, (for reference) using WinClose, ahk_exe {{{StartupEXE}}} is a preferred method over Process, Close.  Though won't magically make 1joy4 work, it is a "nicer" way to close the emulator.

Link to comment
Share on other sites

what kind of controller are you using? Xbox 360 controllers will be able to use hotkeys like that. All other xinput controllers lose this functionality unless one of the script's windows is the active window which def is not the case here. Additionally, you might not be using the right "XJoy" value. For ex, even if only a single controller is connected to your PC it could come up as a different number than you expect such as "3Joy". Have you checked and confirmed it is #1 with AHK's official controller script?

I've never had any other dinput controllers to test/confirm this with, but, I think if the controller uses dinput it should have same behavior as a Xbox 360 controller. As in the hotkeys work even if a script window is not the active window.

another way to test it to make some obvious action with the hotkey, like a msgbox. for ex

1Joy4::
MsgBox, check check is this mic on?
Return

You should see a message box prompt pop up. If you don't then the hotkey doesn't work for one of the above reasons.

 

Assuming you have access to the controller mapping feature, I second that suggestion from Joe. It is the fastest and easiest way to implement your goal of closing an emulator, game or otherwise any window, using a controller.

Link to comment
Share on other sites

Ty for replies.

FIrst to try on LB, i compiled script externally, via AHK, for try it and for referencing exactly the buttons, externally it works!

I use IPAC-2 in emulation pad Xbox mode, it works perfectly and windows recognizes 2 XBOX PAd.

My main problem is with TSUGARU.

Howewer, i resolved inside Bigbox, assigning a pad button on Close Avtive Window. It works.

I wanted to resolve via script, but maybe, emulator "take Pad contol" so internal AHK is unable to catch the button press.

It's ok.

Ty to all

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