peerluk Posted June 15, 2017 Share Posted June 15, 2017 Hi all, I'm sure somebody has done that already but I didn't find anything in the forums... I'm using AHK for a couple of games for keymapping. The problem is I need to make sure that the keymapping gets killed after the game is closed. I know I technically can do that directly in the AHK script but many key mapping scripts can be used on several games. So I'd like to use the same script for many games with as less as possible customization. So if you have a good, fast to implement on many games, way of doing so. Thanks for the advises. Quote Link to comment Share on other sites More sharing options...
nadonate Posted June 15, 2017 Share Posted June 15, 2017 Have you tried Rocket launcher? It's ver compatible with Launchbox, & I think it will do what you want with AHK. You should be able to create a different AHK profile per platform... http://www.rlauncher.com/wiki/index.php?title=KeymapperSent from my SM-N900T using Tapatalk Quote Link to comment Share on other sites More sharing options...
peerluk Posted June 15, 2017 Author Share Posted June 15, 2017 I never used RocketLauncher before. Apparently there are very cool features with that. Speaking of which, do you know about a good Rocket launcher tutorial or is it easy enough to use? But I believe there must be a very simple way to do what I want. I'll try to add a kill task or something, I just need to figure out a way to trigger the even after the game has closed. Quote Link to comment Share on other sites More sharing options...
DJQuad Posted June 15, 2017 Share Posted June 15, 2017 You'd need to monitor to see if the process is running. I use this to monitor services and if it isn't running, restart it. ; Script Function: ; Restarts the iTeleportConnect service if it hasn't started - this usually happens if your ; wireless network interface hasn't started when iTC tries to connect. ; ; This script loops every (45) seconds to determine if iTC is running or not, and restarts it if it's not. ; #SingleInstance, force SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. iTC_EXE = C:\Program Files\iTeleport\iTeleport Connect\iTeleportConnect.exe iTC_Path = C:\Program Files\iTeleport\iTeleport Connect iTC_imgName = iTeleportConnect.exe loop { sleep 45000 Process, Exist, %iTC_imgName% ; check to see if iTeleportConnect is running If (ErrorLevel = 0) ; If it is not running { Run, %iTC_EXE%, %iTC_Path%, hide } Else ; If it is running, ErrorLevel equals the process id for the target program (Printkey). Then do nothing. { sleep 5 } } In your case instead of "Run, %iTC_EXE%, %iTC_Path%, hide", use ExitApp to kill the script. This would need to be done for each emulator. Quote Link to comment Share on other sites More sharing options...
peerluk Posted June 15, 2017 Author Share Posted June 15, 2017 Hmm, I think I understand what you mean. So basically add the emulator or windows exe game in the loop. If the process for that game doesn't exit kill ahk.exe? The problem with that is that I would need to loop every seconds or something like that because if it didn't notice that I exited the game right away, Launchbox wouldn't work correctly for a couple of seconds at least. I don't know Quote Link to comment Share on other sites More sharing options...
DJQuad Posted June 15, 2017 Share Posted June 15, 2017 Yep you can shorten the loop to 5 seconds or even shorter and it would only kill the current AHK script, not any others that happen to be running. AHK takes very little system resources. Quote Link to comment Share on other sites More sharing options...
peerluk Posted June 15, 2017 Author Share Posted June 15, 2017 hmm, then I might try that. I have nothing to loose. I wish we could use an ahk script per rom. Quote Link to comment Share on other sites More sharing options...
DJQuad Posted June 15, 2017 Share Posted June 15, 2017 Most emulators change the windows title depending on the game so you can use IfWinExist, like - IfWinExist, MAME: 1942 (Revision B) [1942] You can use AHK's Window Spy to get the exact widows title. Quote Link to comment Share on other sites More sharing options...
peerluk Posted June 15, 2017 Author Share Posted June 15, 2017 Wow ok, I really need to ramp up on AHK. it's seems full of possibilities. Thanks for the suggestions. I will start ready on this. Quote Link to comment Share on other sites More sharing options...
DJQuad Posted June 15, 2017 Share Posted June 15, 2017 It's super powerful and very well-documented. You can learn a lot by looking at tutorials and existing scripts in their forums too. I use it for a lot more day-to-day stuff than just emulation. The backup program at was made with AHK as well. Quote Link to comment Share on other sites More sharing options...
SentaiBrad Posted June 15, 2017 Share Posted June 15, 2017 Yea, you don't need RL to exit a script when you're done with it... AHK is very very powerful. Quote Link to comment Share on other sites More sharing options...
peerluk Posted June 19, 2017 Author Share Posted June 19, 2017 @DJQuad Yes that IfWinActive seems to do the trick in the platform AHK. I can just specify the game so it doesn't affect anything else but the game it concerns. AHK is very cool and super useful for mapping my Arcade cab on many games so far. Street Fighter at the moment! 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.