Jump to content
LaunchBox Community Forums

AHK script for when 'exit game' hotkey doesn't work


mentazm

Recommended Posts

In launchbox options I have controller mapped so when I press select+start the game/emu exits back to launchbox.

I audited my build yesterday and found that several emus/systems simply refuse to acknowledge this...

Teknoparrot (arcade)
WinUAE (amiga)
Hatari (atari st)
Pinball arcade (PFX3 works fine)

My other 50+ systems respond to it fine. Can someone let me know the AHK script I need so when I press start+select on joystick/gamepad these systems exit?

Cheers in advance.

Link to comment
Share on other sites

Best place to ask about AHK is typically here.

Below is a code, though you will need to know what button #'s start and select are on your controller. If you already assigned those buttons in BigBox you should be able to look there and see what # there. So you will need to replace 11 and 12 with your specific numbers.

 

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

Return

 

Link to comment
Share on other sites

  • 2 years later...
15 minutes ago, hyp36rmax said:

Have a similar issue Game Exist combo exits game, BUT an EXIT dialog comes up.

Almost always you can disable this in the emulator itself. In the emulators' settings look for a checkbox or setting named something like "Confirm Exit".

Edited by Your Friendly A.I Overlord
Link to comment
Share on other sites

25 minutes ago, Your Friendly A.I Overlord said:

Almost always you can disable this in the emulator itself. In the emulators' settings look for a checkbox or setting named something like "Confirm Exit".

Thanks for your response. In my case it’s actually a Steam game with an Exit Dialog.

I’ve setup BigBox Exit hotkey that works for all the other games. When executed on this game it triggers an exit dialog to confirm.

Link to comment
Share on other sites

2 minutes ago, hyp36rmax said:

In my case it’s actually a Steam game with an Exit Dialog.

I’ve setup BigBox Exit hotkey that works for all the other games.

I would advice against closing Steam games with an exit script. You don't know what a games does upon closing, like writing to it's config- or save files. Force closing PC games might corrupt those. Most Steam / PC games can be closed via it's menu, even with a controller.

7 minutes ago, hyp36rmax said:

When executed on this game it triggers an exit dialog to confirm.

There might be a setting anyway, somewhere in it's config / .ini files.

Link to comment
Share on other sites

14 minutes ago, Your Friendly A.I Overlord said:

I would advice against closing Steam games with an exit script. You don't know what a games does upon closing, like writing to it's config- or save files. Force closing PC games might corrupt those. Most Steam / PC games can be closed via it's menu, even with a controller.

There might be a setting anyway, somewhere in it's config / .ini files.

I’m not too worried about that issue with this game.

Steam games we typically exit properly.

Link to comment
Share on other sites

4 hours ago, Your Friendly A.I Overlord said:

Well, if you scoured the menu settings and config files for options to disable "Confirm on Exit", beside force closing your game, you could write a script to click O.K. for you.

That's where i'm stuck. I've tried ESC that triggers exit dialog and pressing enter to "OK" BUT... Enter is also the same key that triggers full screen. No way to redefine that function in the menu.

Game is "Infinos Gaiden"

image.thumb.png.c07dffe7e9eb84c9578ae9d3b86a7e8c.png

Link to comment
Share on other sites

I have to say, seeing as I don't own this game and it seems a bit obscure, it is pretty difficult making a script without knowing anything about this game. How did you add it to LaunchBox? Via a Steam url or an executable? You say you tried to close the game with escape, but have you also tried to close it with Alt + F4?

1 hour ago, hyp36rmax said:

I've tried ESC that triggers exit dialog and pressing enter to "OK" BUT... Enter is also the same key that triggers full screen.

Sometimes those dialog boxes also accept Space as confirmation.

Edited by Your Friendly A.I Overlord
Link to comment
Share on other sites

54 minutes ago, Your Friendly A.I Overlord said:

I have to say, seeing as I don't own this game and it seems a bit obscure, it is pretty difficult making a script without knowing anything about this game. How did you add it to LaunchBox? Via a Steam url or an executable? You say you tried to close the game with escape, but have you also tried to close it with Alt + F4?

Sometimes those dialog boxes also accept Space as confirmation.

Understood.

ESC and ALT+F4 triggers Confirmation Exit with window title "information".  In Big Box Mode I can trigger the same Confirmation Exit with a designated Button Press.

Space can confirm "OK" button.

What i'm really looking for is the ability for an AHK script to detect Confirmaiton Exit Window and press "OK".

Link to comment
Share on other sites

15 minutes ago, hyp36rmax said:

In Big Box Mode I can trigger the same Confirmation Exit with a designated Button Press.

That's because when you press the "exit button", LaunchBox / BigBox sends an Escape.

1 hour ago, Your Friendly A.I Overlord said:

How did you add it to LaunchBox? Via a Steam url or an executable?

Can you answer this for me? Do you know the name of the games' executable?

Edited by Your Friendly A.I Overlord
Link to comment
Share on other sites

7 minutes ago, Your Friendly A.I Overlord said:

That's because when you press the "exit button", LaunchBox / BigBox sends an Escape.

That to difficult for me to do without having the game myself.

Can you answer this for me? Do you know the name of the games' executable?

I added the game via Launchbox Steam Importer

4 minutes ago, Your Friendly A.I Overlord said:

Ah, that's a start.

WinWait, information
Sleep 500
SendInput {Space}

 

This worked!!!! ❤️ Thank you!!!!

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