DerHof2007 Posted February 18, 2017 Share Posted February 18, 2017 (edited) I need an AHK file for my C64 emulation. This wasn't an issue for me in Hyperspin as I guess Rocketlauncher took care of these issues so I need to figure this out. I'm running my Launchbox in a cabinet so I need AHK for multiple things. I have to reassign keys for specific games since C64 uses so many keyboard commands. This is the easy part. I have an AHK file for each game that requires it. I add 'additional app' in the edit game settings point to its specific AHK file. If I want my button that is programmed for x to be a j I simply put x::j in to the AHK file... My issue comes with exiting a game. The exit button on my cabinet is escape. Zombeaver got me pointed in the right direction but I need a little further help. I need my escape button to not only exit the game/emulator but also shut down AutoHotKey as well.... if its still running then my keys will be all messed up after the game. 1st problem is escape does not exit Winvice... I need altX to do that. escape::!x Also I need to have escape exit AHK.... Escape:: Process,close,AutoHotkey.exe return These will both work perfectly fine on their own... I need to combine them into one key press. This is what I've tried. First method $Escape:: { Send {!x} KeyWait, Escape Send { Process,close,AutoHotkey.exe } } return Method 2 escape:: Send {!x} Sleep, 500 Send {Process,close,AutoHotkey.exe} Return So technically both of these methods do work... just not for what I need. If I take both of the commands !x and Process,close,AutoHotkey.exe and swap them out for example the letters m and n then that is exactly what the escape key will do. I'll get those 2 keystrokes from a single escape press. I can't get AltX (!X) or AHK exit (Process,close,AutoHotkey.exe) to work no matter what I try. Like I said if I just put single keystrokes in there it works fine. Any single key stroke combined with the AltX or the exit command then I get the keystroke but not the other. The commands will work on their own though escape::!x Escape:: Process,close,AutoHotkey.exe return Sooooo, how can I make this work? Edited February 18, 2017 by DerHof2007 typo Quote Link to comment Share on other sites More sharing options...
jayjay Posted February 18, 2017 Share Posted February 18, 2017 (edited) escape:: Goto, close close: { Send !x Exitapp } or escape:: Process, Exist, Commodore.exe If ErrorLevel <> 0 Process, Close, Commodore.exe Exitapp or escape::Process, Exist, Commodore.exeIf ErrorLevel <> 0 Process, Close, Commodore.exe Process, Exist, Autohotkey.exeIf ErrorLevel <> 0 Process, Close, Autohotkey.exe Change "Commodore.exe" to whatever your emulator process. Edited February 18, 2017 by jayjay 2 Quote Link to comment Share on other sites More sharing options...
DerHof2007 Posted February 18, 2017 Author Share Posted February 18, 2017 jayjay.... you sir, are my hero! The first one worked fine. Thank you very much!! 1 Quote Link to comment Share on other sites More sharing options...
DerHof2007 Posted February 18, 2017 Author Share Posted February 18, 2017 Follow up question. So worse case scenario I am going to have to make an AHK file for every C64 game I have. I assumed I would have to do this anyway and I only have 66 roms so not the end of the world. But then I saw that in the emulator settings I could assign an AHK script. So using what you just gave me I did that and now every game will close the emulator with the escape key. But if I also assign a game specific AHK for specific game keys... they will work. And escape still exits... but the game specific AHK does not close. I notice using your script only assigned to the emulator that I don't get an AHK icon in the notification area... but for the game specific AHK files I do.... and that is what does not close if I have the universal emulator AHK set up. I tried the game specific with only game keys and also with your script as well (which actually makes it doubled up)... but neither way closes the game specific file... the AHK notification icon remains. So some games I don't really have to reassign anything and using the universal script in the emulator settings would make it so I don't have to create an AHK file for every game.... Any thoughts? But like I said this isn't really a big issue... I assumed I would need an AHK for every game and I could have made 20 of them in the time it took me to type this post but sometimes it fun to just try and figure things out... Quote Link to comment Share on other sites More sharing options...
DOS76 Posted February 18, 2017 Share Posted February 18, 2017 You could possibly write that AHK into a .bat with the emulator.exe and then replace the emulator with the .bat then it would work for every game for the system with a one time setup. Quote Link to comment Share on other sites More sharing options...
jayjay Posted February 18, 2017 Share Posted February 18, 2017 escape:: Goto, close close: { Send !x Process, Exist, Autohotkey.exeIf ErrorLevel <> 0 Process, Close, Autohotkey.exe Exitapp } 2 Quote Link to comment Share on other sites More sharing options...
DerHof2007 Posted February 18, 2017 Author Share Posted February 18, 2017 Once again... THANK YOU. A couple more things to check out on the C64 platform (multiple disc games)... and it should be 100% !! 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.