Jayinem Posted August 10, 2020 Share Posted August 10, 2020 (edited) It doesn't matter if I do it through Launchbox or through PCSX2 itself. Escape key doesn't exit. But as far as a fix I am running scripts for the PCSX2 games in Launchbox because of a lightgun I have that requires them for it to work. So the entire game is run through a script in Launchbox like it's a PC game .exe after I compile the autohotkey script. So I cannot add anything into the running scripts section or exit section. I would need a script that I also make outside of Launchbox that I can add to additional apps. thanks p.s. I tried to add this script to the script I'm making outside of Launchbox ; This section closes PCSX2 when pressing Escape $Esc:: { Process, Close, {{{StartupEXE}}} } But it still doesn't work. I'm hardly an expert on these scripts though where it says StartupEXE should it say StartupEXE or do I change it to pcsx2.exe? I just tried this also Escape:: Exit() Return ;Exit Game procedure Exit(){ Process, Close, pcsx2.exe ExitApp } Still won't exit the game. Edited August 10, 2020 by Jayinem Quote Link to comment Share on other sites More sharing options...
Jayinem Posted August 10, 2020 Author Share Posted August 10, 2020 I had to search the PCSX2 forum and found another script that works incase someone else ever has this issue. SetTitleMatchMode,1 $Esc:: Process,Exist,pcsx2.exe If ErrorLevel { IfWinNotActive,GSdx | Send,{Esc} } Else { Send,{Esc} } Return Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted August 11, 2020 Share Posted August 11, 2020 May I ask, does that script work with pause screens? Because it look a bit convoluted. In LaunchBox go to the Tools menu>Manage Emulators>PCSX2>Details. Add a "--nogui" command-line parameter (without quotes). Then open PCSX2 an make sure that under the Misc tab "Show Console" is unticked. That way PCSX2 only open one window, the game window and is very easy to exit. I use: $Esc:: { WinClose, ahk_class wxWindowNR ahk_exe pcsx2.exe } I suppose I could even leave out "ahk_class wxWindowNR" and it would still work. I see a lot of people mindlessly copy ahk scripts without understanding what it does. For instance religiously using "Process, Close". I don't mean to criticize you, but it can be more helpfull and quicker to look at the autohotkey documentation then to search for other peoples scripts. At least for me the challenge is to find out how things work and come up with a solution. Also on another note, I personally rarely compile scripts to an .exe because of the reason you gave. But I admit, the endgoal is to get everyting working to your satisfaction and if it works... It works! Quote Link to comment Share on other sites More sharing options...
Jayinem Posted August 11, 2020 Author Share Posted August 11, 2020 (edited) Thanks for the input. I am by no means a script expert, I'm pretty much the opposite. My problem is a little more difficult to solve though I know I didn't explain it in the first post. The reason is I'm not adding pcsx2 as an emulator in Launchbox because I have a Lightgun for Windows but it takes additional scripts. So I just load everything including pcsx2 and the iso and the script all in one and make it an exe and load it in Launchbox. But the problem was not exclusive to scripts though I tried launching a game directly through PCSX 2 and it was the same esc was not working. I will try your suggestion tomorow most likely. Honestly everytime I read the autohotkey documentation it never helps me. Because there's always some quirk that I don't feel is explained good on their site. Even their examples for whatever reason rarely give me what I need to make the script. It helps me to see someone make an actual script such as you did then I learn from that, I even keep examples in a document I have that I go back to. From other people's scripts I have been able to do things like get my lightgun to work in games, get my gaming steering wheel to work in games, change displays on my laptop/TV, make mouse cursors stop showing up in my games, turn off game controllers through keyboard shortcuts and even more than that. But in this case I tried the scripts I know to exit using escape, and they weren't working but the one I posted from pcsx2 did work. Since these are lightgun games I'm using pcsx2 I'm not too concerned about not closing it correctly or losing saves. I don't really have a reason to pause the screens either. Just as long as it closes or the script does what I want I am happy. Edit: had a minute to try your script and it works. Thank you Edited August 11, 2020 by Jayinem Quote Link to comment Share on other sites More sharing options...
Jayinem Posted August 11, 2020 Author Share Posted August 11, 2020 Since you seem pretty good at this do you know how to kill the AHK script when the process you're running closes? I end up with a bunch of AHK scripts open. Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted August 11, 2020 Share Posted August 11, 2020 No worries mate! As I said, I never ment to criticize you with my reply. I am not an expert myself, far from it. I myself started with messing with other peoples scripts too, but quikly jumped to the autohotkey documentation to understand why or why not. As you go along you learn. I actually hoped to encourage people to go a level further than they normally would. I feel the satisfaction of getting something to work and the way of thinking it would require to get you there would be beneficial to a person. But if you write things like that you know you are getting older. Anyway I see you have lots of things happening at once, so I totally understand that you're just glad it works. Let me know if I can help you! Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted August 11, 2020 Share Posted August 11, 2020 (edited) 38 minutes ago, Jayinem said: Since you seem pretty good at this do you know how to kill the AHK script when the process you're running closes? I end up with a bunch of AHK scripts open. That is a bit difficult for me to say because I can't see what is happening. But if i'm figuring out a script I try to detect when a game or program open or closes like: Process, Wait, game.exe Process, WaitClose, game.exe (Or a game window:) WinWait, abc ahk_class xyz WinWaitClose, abc ahk_class xyz (Where abc and xyz are the windowtitle and classname) If a script gets executed it nears its end. If you conclude with: ExitApp it should terminate itself. Just make sure a script does't get stuck halfway through. Tip: If your script is in de system tray you can right click, then open. You can see wat it is doing. Edited August 11, 2020 by Koroth Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted August 11, 2020 Share Posted August 11, 2020 BTW. That PCSX2 exit script do you run that as a seperate script or via LaunchBox's "Running AutoHotKey Script"? Quote Link to comment Share on other sites More sharing options...
Kiinkyfoxx Posted August 11, 2020 Share Posted August 11, 2020 (edited) 2 hours ago, Jayinem said: Since you seem pretty good at this do you know how to kill the AHK script when the process you're running closes? I end up with a bunch of AHK scripts open. Don't take this the wrong way but I put about how you weren't exiting your scripts in your other ahk problem post and linked you to the pages and commands that you needed. It didn't exactly take me long to do, but having spent the time to do it for you, because of a problem you were having, and then to see you asking how to do it, makes me think that you didn't bother looking at that info. Which of course then makes people less inclined to help again in the future. If any mods thinks this is unfair or unjust then please feel free to remove it. Edited August 11, 2020 by Kiinkyfoxx Quote Link to comment Share on other sites More sharing options...
Jayinem Posted August 11, 2020 Author Share Posted August 11, 2020 (edited) Koroth: thanks I will look at it later today. Edited August 11, 2020 by Jayinem 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.