PiperCalls Posted March 10, 2020 Share Posted March 10, 2020 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 Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted March 10, 2020 Share Posted March 10, 2020 "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. Quote Link to comment Share on other sites More sharing options...
PiperCalls Posted March 10, 2020 Author Share Posted March 10, 2020 @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 Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted March 11, 2020 Share Posted March 11, 2020 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). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.