Jump to content
LaunchBox Community Forums

PROPER WAY TO CLOSE A WIN10 APP IN LB?


PiperCalls

Recommended Posts

Hi,

Wondering what is the proper way to close a Win10 App that I have setup in LB? To be clear It's an app, not an emulator. The App doesn't have any keyboard shortcut to exit, it requires a mouse click on the "X" to close. I read somewhere that converting an AHK script to an EXE and referencing that EXE in the additional apps section of the "Game" would do it. Is that the "best/correct" way or is there a better/cleaner way? I have never used AHK so any help with the script would be appreciated.

So if my app is called ABC.exe..what would be the AHK script that I would convert to EXE? Alt+F4 does close the app but I think that's a force close and not sure if that is a good way to do it.

Thanks for any help!...Piper

Link to comment
Share on other sites

"best/correct/better/cleaner/", depends on who you ask. ?

Alt+F4 is really no different than clicking "X".  (i.e.  clicking "X" does not do a quicky background save, then close.  It closes just like Alt+F4)   That said...  Go to "Tools", "Manage Emulators...", select your 'emulator' for "ABC.exe" and Click "Edit".  In the "Running AutoHotkey Script" tab, enter in 

$Esc::
{
WinClose, ahk_exe ABC.exe
}

"Save", "Close"....

So in hopes that your Win10 App doesn't use the {Escape} inside it, when you are in the App, pressing {Escape} will close the App.   

Alternately you could set it up so {Escape} sends Alt+F4 (for your scenario).  But the above code is the "BEST" acceptable answer.image.thumb.png.d60140e0cc4cc944f123e4c0a8f9ea46.png 

Link to comment
Share on other sites

@JoeViking245

Thanks for the help on this. I'm a little lost on this though. It's a Win10 App so there is no emulator. If I assign an emulator to put your suggested AHK script in, then the App won't launch as it's trying to launch via the emulator. If I assign no emulator to the App then it will launch but I don't see how to put in the Running AHK Script.

What am I missing?

Thx...Piper

Link to comment
Share on other sites

Oh Snap!  My bad.  I am so sorry.

So yes, compiling that script I gave (the one with "WinClose" in it) to an exe and have it "Run Automatically Before Main Application" will work.

Actually, maybe use 

$Esc::
{
  WinClose, ahk_exe ABC.exe
  ExitApp
}

This way, you run the script before your Main App, the script then hangs around in the background until you press the {Escape} key.  Then the script closes ABC.exe and then closes itself (with "ExitApp" so it's not 'hanging around' anymore).

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