Jump to content
LaunchBox Community Forums

AutoHotkey - Close game with Controller button combination


Turnspit

Recommended Posts

Cheers!

I am currently using the following AutoHotkey command to be able to close my emulators with the simple press of ESC, since all the settings in the GUI don't seem to work, whether setting them in Desktop or Bigbox Mode:

 

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

 

Now I would like to be able to close games as well by pressing Select+Start on my Xbox Controller, but have no idea how the script would have to look like...

Could anyone help me out here?

 

Thanks in advance! :)

Link to comment
Share on other sites

What emulator or emulators are you having issues with? Most should close fine just using the controller/keyboard automation in LB/BB and not needing AHK or even JoyToKey? I think I only have 1 or 2 I use an AHK script for.

I would caution to not use the Process, Close command. It can cause save state issues with emulators that might save a game state on close.

Use this instead.

$Esc::
{
    WinClose, ahk_exe {{{StartupEXE}}}
}

To answer your question though you can use something like below. The -1 in SetKeyDelay means no delay. I am no expert just passing along info. Also this thread is good to look over. Joy7 is the select button and Joy8 is start on one of my controllers. So you would just change those numbers to what it is on an Xbox controller.

Joy7::
If GetKeyState("Joy8")
{
   SetKeyDelay, -1, 110
   WinClose, ahk_exe {{{StartupEXE}}}
}

Return

 

Link to comment
Share on other sites

I personally use joytokey just find it easier, you can map any keyboard key to any button on your joypad or combination of buttons. I even have a steering wheel where I have a button that i can exit games when I'm done with a racing game for example, and of course regular controllers too. 

Edited by Jayinem
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...