Jump to content
LaunchBox Community Forums

Failing closing emulator with AHK


DefeatedBloodPython92

Recommended Posts

Hello there!

I'm trying to make a simple AHK script to close any emulator, but for some reason it doesn't work. I tested it with notepad and worked perfectly.

Esc::
Send, ^!{F4}
return

I'm using this along SuperF4, that's why I added the ^, and outside Launchbox works perfectly.

The other one I tried, but I don't really know if it works (I found it around here) is this one:

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

The only thing it happens in some emulators (like Cemu) is exiting fullscreen mode, but nothing else. And it's really driving me crazy.

 

Thanks.

Edited by Eussora
Link to comment
Share on other sites

6 hours ago, Eussora said:

The other one I tried, but I don't really know if it works (I found it around here) is this one:

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

If using this one, you should change it to

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

The $ in front of the hotkey does 'something' (I never really looked into exactly what that is). Usually, it's not needed but does help in certain situations.  But the main point is changing the "Process" method to "WinClose".  The "Process" method is like unplugging your PC to shutdown Windows. Whereas WinClose is a little more 'gentile'.  "Return" is not necessary in either case.

 

6 hours ago, Eussora said:

The only thing it happens in some emulators (like Cemu) is exiting fullscreen mode, but nothing else.

Cemu shouldn't need anything in the Running AutoHotkey Scripts section.  Are you running it as Admin?  Here's a thread discussing it. 

 

6 hours ago, Eussora said:

I'm using this along SuperF4

I've never [had to] use SuperF4.  Which makes me believe it shouldn't be needed for any emulator.  But of course, there's always that odd one. ;) 

 

When setting up most emulators in LaunchBox, it will automatically put in any required scripts in the Running [AutoHotkey] Script section for exiting the emulator. If required.

  • Thanks 1
Link to comment
Share on other sites

2 hours ago, faeran said:

First thing you want to check is whether you added the AHK script to the "Running Scripts" section of your Emulator window, and not the Exit Script section.

This is because you need AHK to know about the Escape key while the emulator is running.

 

2 hours ago, JoeViking245 said:

If using this one, you should change it to

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

The $ in front of the hotkey does 'something' (I never really looked into exactly what that is). Usually, it's not needed but does help in certain situations.  But the main point is changing the "Process" method to "WinClose".  The "Process" method is like unplugging your PC to shutdown Windows. Whereas WinClose is a little more 'gentile'.  "Return" is not necessary in either case.

 

Cemu shouldn't need anything in the Running AutoHotkey Scripts section.  Are you running it as Admin?  Here's a thread discussing it. 

 

I've never [had to] use SuperF4.  Which makes me believe it shouldn't be needed for any emulator.  But of course, there's always that odd one. ;) 

 

When setting up most emulators in LaunchBox, it will automatically put in any required scripts in the Running [AutoHotkey] Script section for exiting the emulator. If required.

Holy cow, that was the problem.

I was saving the script in the Exit section, not the Running section. Which, now that I think about it, it makes totally sense. I assume that the Exit section is for when it closes the emulator.

And WinClose, ahk_exe {{{StartupEXE}}} totally worked.

 

So, now that I have that fixed, I have another question about it.

How can I add two scripts? Cxbx needs one to go fullscreen, but I don't know how to add both scripts.

Btw, if anyone knows a extremely simple script to just go fullscreen as soon as the emulator opens, that would be lovely (just send Alt+Enter when the emu loads the rom).

 

Thanks!

Link to comment
Share on other sites

11 minutes ago, Eussora said:

How can I add two scripts?

Put the "other" script above your hotkey script (same Running Script section).

 

12 minutes ago, Eussora said:

simple script to just go fullscreen as soon as the emulator opens

Just change the emulator.exe name and replace  "send {F11}"  with  "Send, !{Enter}"  (no quotes)

(then blow that, put in your escape hotkey sequence)

  • Thanks 1
Link to comment
Share on other sites

11 minutes ago, JoeViking245 said:

Put the "other" script above your hotkey script (same Running Script section).

 

Just change the emulator.exe name and replace  "send {F11}"  with  "Send, !{Enter}"  (no quotes)

(then blow that, put in your escape hotkey sequence)

I just love you.

Thank you so very much for this. I spent hours yesterday trying to figure this out all of this.

 

Thank youuuuuu ♥♥♥

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