Jump to content
LaunchBox Community Forums

autohotkey script from within Launchbox


makaveeti

Recommended Posts

hey @makaveeti, where are you putting the ahk code in LB exactly? Can you post screenshots of all the tabs of the window you have pasted the ahk code into?

Edit: The ahk tab runs at the emulator level (Manage Emulators menu option). I don't think your game is an emulated game right? So, I'm not clear about where you are putting this ahk code, but I'm 99% sure that is why nothing is running for you for this specific game.

For a specific game, you are much better off using the ahk script/exe in the additional apps of the game which indeed works for you. That is the best method for you to do this with that game.

Edited by ckp
Link to comment
Share on other sites

@ckp - You are 100% correct. Well done for identifying the root cause.

I tried using the ahk script tab with an emulated game and the scripts work fine! :)

With regards to Streets of Rage Remake (Windows Game), I created a standalone exe with the following code (see below). After holding button10 and then pressing button 9 on my gamepad, the processes for streets or rage and AHK are closed. I configured LB to launch the ahk exe before the game. Happy days :)

 

Joy9:: 

If GetKeyState("Joy10") 

Process, Close,  sorR.exe

Process, Exist,  Autohotkey.exe
If ErrorLevel <> 0
    Process, Close,  Autohotkey.exe
Exitapp

Return

 

 

Link to comment
Share on other sites

very noice !!

 

you shouldn't have to do this (in fact, i wouldn't do it):

Process, Exist,  Autohotkey.exe
If ErrorLevel <> 0
    Process, Close,  Autohotkey.exe

ExitApp should be good.

Edited by ckp
Link to comment
Share on other sites

3 hours ago, ckp said:

very noice !!

 

you shouldn't have to do this (in fact, i wouldn't do it):

Process, Exist,  Autohotkey.exe
If ErrorLevel <> 0
    Process, Close,  Autohotkey.exe

ExitApp should be good.

Thanks mate. Code looks cleaner.

 

I'm interested in amending the code so that holding Button9 and button10 for 2 seconds will cause sorR.exe and AHK to exit.

Here is my attempt. It works perfectly for button9 only. What needs adding so that holding both button9 and button10 together for 2 seconds executes the script?

 

Joy9::
 KeyWait,Joy9,T2 ;wait 2 seconds for release key
 If (ErrorLevel) ;more than 2 sec have passed
 {
  Process, Close,  sorR.exe
  Exitapp
 }

Return

Edited by makaveeti
Link to comment
Share on other sites

3 hours ago, makaveeti said:

Thanks mate. Code looks cleaner. What if I wanted to use one joypad button instead as a hotkey but the condition was that it had to be held down for 3 seconds?

I'm sure it's possible, but I haven't tried it. Maybe play with autohotkey's KeyWait. Someone else around here probably has the code for this exact thing. Might want to post a new thread for this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...