makaveeti Posted April 10, 2017 Share Posted April 10, 2017 Hi guys, I'm new here. Firstly, great work with the Launchbox application - I love it and look forward to buying a license. I've having a slight issue with autohotkey scripts. I imported 'Streets of Rage Remake' which is a windows game. There is no exit option from the main menu of the game. To exit the game Esc must be pressed. I wrote a script in AHK to map one of my controller buttons to the Esc key. This doesn't work using a AHK script in Launchbox or when building a standalone ahk EXE. I approached the issue from a different angle and wrote the following script and tested it using a standalone AHK exe file. It's programmed to look for an active window for Streets of rage remake game and exit when button 7 is pressed whilst holding button 8 on the controller. Joy7:: If GetKeyState("Joy8") { WinClose, Streets of Rage Remake - v5.0a } Return As a standalone AHK script, this works well. The issue is that when I paste the same code into Launchbox on the AHK script tab, it has no effect whilst I'm in the game. Is this a defect? Can you guys offer any advice please? Quote Link to comment Share on other sites More sharing options...
SentaiBrad Posted April 10, 2017 Share Posted April 10, 2017 Once you buy LaunchBox Premium then you have access to the Controller Automation stuff, which has the ability to exit stuff from your controller. As for why the AHK script isn't working, im not sure, AHK isn't my area. Quote Link to comment Share on other sites More sharing options...
makaveeti Posted April 11, 2017 Author Share Posted April 11, 2017 Thanks dude. I'm trying to understand why my script works as a standalone autohotkey exe file and not when the code is pasted into the AutoHotKey script tab for my emu/game? Can anyone shed light on this please? Quote Link to comment Share on other sites More sharing options...
Charco Posted April 11, 2017 Share Posted April 11, 2017 (edited) I use an Xpadder profile to exit Streets of Rage Remake by mapping the F12 key to my Select button. I use SORR v5.1 though, I'd recommend that version, it has over 100 bugfixes and improvements over v5.0a. Edited April 11, 2017 by Charco Quote Link to comment Share on other sites More sharing options...
DOS76 Posted April 11, 2017 Share Posted April 11, 2017 Well if I read what Brad wrote correctly he is saying your AHK script doesn't work through LB because you don't have access to the feature because you don't have a premium license. Quote Link to comment Share on other sites More sharing options...
makaveeti Posted April 11, 2017 Author Share Posted April 11, 2017 Hey Dos76, Correct me if I'm wrong but I think Brad is referring to the Control Automation section in the LB Options section. It's greyed out in the free version and available with a premium licence. My original post is referring to the autohotkey script tab under the manage emulators section. Quote Link to comment Share on other sites More sharing options...
DOS76 Posted April 11, 2017 Share Posted April 11, 2017 I know you are discussing ahk I'm unsure if they work from your LB if you don't have a license. I could be wrong but it could explain why the script works stand alone but not from within LB Quote Link to comment Share on other sites More sharing options...
makaveeti Posted April 11, 2017 Author Share Posted April 11, 2017 31 minutes ago, DOS76 said: I know you are discussing ahk I'm unsure if they work from your LB if you don't have a license. I could be wrong but it could explain why the script works stand alone but not from within LB It could.. would be good if a LB developer could clarify this. Quote Link to comment Share on other sites More sharing options...
DOS76 Posted April 11, 2017 Share Posted April 11, 2017 Well there is only one dev who works constantly on his progject so you will have to wait for someone else to assist you @SentaiBrad probably knows if scripts will work from there if you don't have premium. Quote Link to comment Share on other sites More sharing options...
SentaiBrad Posted April 11, 2017 Share Posted April 11, 2017 AHK works without Premium. What I was getting at was Controller Automation only, which is built in with LB Premium. I honestly don't know why the script wont work in LaunchBox. I don't recall this ever happening often. It could be the way LB launches AHK, or the script doesn't like being ran from LB. @Jason Carr or another AHK person might know. Quote Link to comment Share on other sites More sharing options...
makaveeti Posted April 11, 2017 Author Share Posted April 11, 2017 @SentaiBrad - Thanks for your help so far dude. I look forward to the advice @Jason Carr can offer on the issue. Quote Link to comment Share on other sites More sharing options...
ckp Posted April 11, 2017 Share Posted April 11, 2017 @makaveeti , why don't you try converting your ahk script to an executable (.exe). then add your ahk exe to your LB game in the additional apps tab (right click game and choose edit to get there). set your ahk exe file to run before the game. then see if it works that way as a stand alone. in this way, the ahk will not be run using LB builtin ahk. you probably don't need to convert your .ahk file to try this, but if you don't, you'll have to make sure your full autohotkey installation can be found by your .ahk script. Quote Link to comment Share on other sites More sharing options...
makaveeti Posted April 11, 2017 Author Share Posted April 11, 2017 @ckp I already tried converting the script to an exe and setting to launch before the game. This works successfully. I might have to settle for this as a last resort. I was just trying to obtain an explanation as to why the code doesn't do anything when pasted in the LB built-in akh. Quote Link to comment Share on other sites More sharing options...
ckp Posted April 11, 2017 Share Posted April 11, 2017 (edited) You can add this simple script to the ahk tab and see if it triggers. try it as the first line without a hotkey so it runs right away and try it in an escape hotkey also to see if it runs on escape. MsgBox I am a message without hotkey. And put this line inside your escape key section: MsgBox I am a message with hotkey. At least this will give us more info. Edited April 11, 2017 by ckp Quote Link to comment Share on other sites More sharing options...
Crush Posted April 11, 2017 Share Posted April 11, 2017 Try this: ; Exit 4Joy17:: SetKeyDelay, -1, 110 Process, Close, {{{StartupEXE}}} Return (4Joy17 = joystick no 4, button 17. You must change it to reflect your own joystick number and button, for example 1Joy2 = Joystick 1, button 2) 1 Quote Link to comment Share on other sites More sharing options...
makaveeti Posted April 11, 2017 Author Share Posted April 11, 2017 @ckp Thanks for that recommendation dude. Good idea to try alternative code to check if it works. I'm not a coder by nature and put together my original code via alot of trial and error. Can you confirm exactly what code you want me to paste into the ahk tab please? Quote Link to comment Share on other sites More sharing options...
ckp Posted April 11, 2017 Share Posted April 11, 2017 (edited) sure, just put in there what you already tried but make the very first line this, before your code: MsgBox I am a message without hotkey. and replace your WinClose line with this: MsgBox I am a message with hotkey. run the game from LB. You should get a message popup right away. This first popup would prove autohotkey script is running and working. close the first popup. then exit the game that you have set for your controller to exit in your ahk script. Now you should get a popup again (but the game won't exit because its just a test). This second popup would prove if your controller hotkey is triggering. Edit: don't forget to remove your ahk exe additional app setting before you try this. If you get both popups, then I would think @makaveeti suggestion to use Process, Close should work instead of using WinClose Edited April 11, 2017 by ckp Quote Link to comment Share on other sites More sharing options...
makaveeti Posted April 11, 2017 Author Share Posted April 11, 2017 18 minutes ago, Crush said: Try this: ; Exit 4Joy17:: SetKeyDelay, -1, 110 Process, Close, {{{StartupEXE}}} Return (4Joy17 = joystick no 4, button 17. You must change it to reflect your own joystick number and button, for example 1Joy2 = Joystick 1, button 2) This works in a standalone AHK exe. The code is different to my script which also works in a standalone AHK exe. Thanks for showing me. Quote Link to comment Share on other sites More sharing options...
makaveeti Posted April 11, 2017 Author Share Posted April 11, 2017 (edited) 15 minutes ago, ckp said: sure, just put in there what you already tried but make the very first line this, before you code: MsgBox I am a message without hotkey. and replace your WinClose line with this: MsgBox I am a message with hotkey. run the game from LB. You should get a message popup right away. This first popup would prove autohotkey script is running and working. close the first popup. then exit the game that you have set for your controller to exit in your ahk script. Now you should get a popup again (but the game won't exit because its just a test). This second popup would prove if your controller hotkey is triggering. I amended the code. Tried it as a standalone EXE just to verify the code. It works as a standalone AHK exe. A message box pops up saying 'I am a message without hotkey' then when I trigger my gamepad buttons I see the message 'I am a message with hotkey'. I pasted the code into the AHK script tab in LB and launched my game but it doesn't work ;( Edited April 11, 2017 by makaveeti Quote Link to comment Share on other sites More sharing options...
ckp Posted April 11, 2017 Share Posted April 11, 2017 15 minutes ago, makaveeti said: I pasted the code into the AHK script tab in LB and launched my game but it doesn't work ;( So you didn't get ANY popup when using it in the ahk tab? @Jason Carr, is the ahk tab functionality supposed to be included in the free version of Launchbox? 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.