Jump to content
LaunchBox Community Forums

Auto Hotkey Scripts


Lordmonkus

Recommended Posts

3 hours ago, JoeViking245 said:

@rom116  From just my brief reading up on x360ce, once you've set up the individual game you don't even need x360ce.exe anymore.

From what I can tell, you copy the x360ce files into the same folder as the game_name.exe.  Run x360ce, tell it to create the missing (dll) files, set/select either 32 or 64-bit depending on the game, select/setup your controller(s) and Save.  Exit.  Then at this point x360ce.exe can be deleted.  Then (I assume) whenever you run that game, it reads dll(s) and acts accordingly.  I would think when the game exits, it flushes the dll's.

That may or may not make sense and chances are I've totally missed something (wouldn't be the 1st, and won't be the last. lol).  But based on the info you've provided, somewhere/somehow x360ce.exe does load when you start the game and it stays active until you force it closed.  Sounds kinda like a design issue.

I tested my LEGO® The Incredibles Steam game (without x360ce) and found that even when launching from the exe file (vs Steam link), it 1st loads the Steam Client Boot Strapper, Then Steam, and then finally "LEGO The Incredibles.exe".  So to get that batch file to run 'after game exit' doesn't seem feasible given the circumstances.

I'd say check the x360ce forums for setting up the games with a Front End (or even 'running a game that doesn't use x360ce right after a game that did') and see what others have done.  I'm inclined to say it's a common thing they've come across many times and already have the perfect solution.  But if your research comes back with "just run the batch file!", then I guess it's on to plan B. (though I don't know what that is yet ;))

Yeah it appears the newest version doesn't require you to place the .exe in the game folder.  You just run it from a single location.  I didn't even have to create a .dll file the first time I ran mine...Maybe I should try an older version because what you are describing sure would be better...lol

  • Like 1
Link to comment
Share on other sites

Hoping i can get some expertise in refining my AHK Script please not quite working properly. This is for House of the dead 3 on the PC as you may know it uses a launcher screen (and yes I've tried to apply the registry fix in the ahk and it still doesn't work) So happy to use the launcher but setting up JoyToKey via the additional app to open and close it closes during the second launching process. So my only way round it is via a ahk. Please see my script below and this opens, launches and works but on pressing escape or even exiting via the menu it doesn't close down JoyToKey or the ahk any help appreciated and happy to force close the game and not use the menu as I'm not really saving any progress etc. Happy with a few variations if possible and if I've missed a post with some details i apologise. Thanks again for the help and slowly learning, still haven't found a way to launch JoyToKey and a particular profile via a ahk so if anyone knows this as well then please share

 

Thanks again

 

#SingleInstance, force

Run, "E:\LaunchBox\PC Games\The House of the Dead 3\hod3launch.exe"
Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe"  DemulShooter.exe -target=windows -rom=hod3pc -noguns
Run, "E:\LaunchBox\JoyToKey_en\JoyToKey.exe"


    
Escape::
    Process,Close,hod3launch.exe
    Run, taskkill / "hod3launch.exe" 
    Run, taskkill / "E:\LaunchBox\JoyToKey_en\JoyToKey Force Exit.exe"
    ExitApp
return

 

Link to comment
Share on other sites

@Johno1980  You're trying to kill a program that isn't actually running.  "JoyToKey Force Exit.exe"

#SingleInstance, force

Run, "E:\LaunchBox\PC Games\The House of the Dead 3\hod3launch.exe"
Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe"  DemulShooter.exe -target=windows -rom=hod3pc -noguns
Run, "E:\LaunchBox\JoyToKey_en\JoyToKey.exe"
    
Escape::
    WinClose, ahk_exe "hod3launch.exe"
    WinClose, ahk_exe "JoyToKey.exe"
    ExitApp

Return

 

Link to comment
Share on other sites

4 hours ago, JoeViking245 said:

@Johno1980  You're trying to kill a program that isn't actually running.  "JoyToKey Force Exit.exe"


#SingleInstance, force

Run, "E:\LaunchBox\PC Games\The House of the Dead 3\hod3launch.exe"
Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe"  DemulShooter.exe -target=windows -rom=hod3pc -noguns
Run, "E:\LaunchBox\JoyToKey_en\JoyToKey.exe"
    
Escape::
    WinClose, ahk_exe "hod3launch.exe"
    WinClose, ahk_exe "JoyToKey.exe"
    ExitApp

Return

 

Thanks for this and will try it later ?? 
still learning and getting there ?? Slowly lol. 

 Just gutted I couldn’t map my buttons on my Aimtrak to input keyboard keys so had to use Joytokey. Done it with Time crisis 5 as you know but can’t seem to do it with these games atm!!! 

Thanks again 

  • Like 1
Link to comment
Share on other sites

7 hours ago, JoeViking245 said:

@Johno1980  You're trying to kill a program that isn't actually running.  "JoyToKey Force Exit.exe"


#SingleInstance, force

Run, "E:\LaunchBox\PC Games\The House of the Dead 3\hod3launch.exe"
Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe"  DemulShooter.exe -target=windows -rom=hod3pc -noguns
Run, "E:\LaunchBox\JoyToKey_en\JoyToKey.exe"
    
Escape::
    WinClose, ahk_exe "hod3launch.exe"
    WinClose, ahk_exe "JoyToKey.exe"
    ExitApp

Return

 

Hi, tried the ahk and it all worked apart from closing Joytokey!!! also pressing escape on my keyboard doesn't seem to do anything either.

Although holding down start and select on my Xbox one controller works and brings up the launcher to exit which is fine.

Adjusted the ahk to this and it seems to shut down Joytokey now (just don't know why it's such a pain to close lol) any idea as to why escape on my keyboard doesn't work?? not a biggie but would like to get it working because then i could map pressing both side buttons together in joy for escape and it'll bring up the exit launcher. Thanks again as always and see my script below

 

 

#SingleInstance, force

Run, "E:\LaunchBox\PC Games\The House of the Dead 3\hod3launch.exe"
Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe"  DemulShooter.exe -target=windows -rom=hod3pc -noguns -noautoreload
Run, "E:\LaunchBox\JoyToKey\JoyToKey.exe"


    
Escape::
    WinClose, ahk_exe "hod3launch.exe"
    Run, "E:\LaunchBox\JoyToKey\JoyToKey Force Exit.exe"
    ExitApp

Return
 

Link to comment
Share on other sites

15 hours ago, JoeViking245 said:

Maybe you're not paying it enough for what you're asking it to do. ;)   Put a "$" in front of it. 


$Esc::
   WinClose, ahk_exe "hod3launch.exe"
   Run, "E:\LaunchBox\JoyToKey\JoyToKey Force Exit.exe"
   ;WinClose, ahk_exe "JoyToKey.exe"
   ExitApp

(Esc works the same as Escape)

Back again lol,

Escape still doesn't seem to work and have to remove the ahk_exe for this to close the ahk down and joytokey but it works with a xbox controller pressing star and select. Just baffled as to why Esc doesn't bring up the exit launcher. Please see the script im using atm but again not a biggie.

#SingleInstance, force

Run, "E:\LaunchBox\PC Games\The House of the Dead 3\hod3launch.exe"
Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe"  DemulShooter.exe -target=windows -rom=hod3pc -noguns -noautoreload
Run, "E:\LaunchBox\JoyToKey\JoyToKey.exe"


    
$Esc::
    WinClose, "hod3launch.exe"
    Run, "E:\LaunchBox\JoyToKey\JoyToKey Force Exit.exe"
    ExitApp
Return

Thanks again as always and appreciate your time

 

Link to comment
Share on other sites

No problem. Glad to [attempt] help.   

Some games refuse to 'play nicely' and no matter what you, you won't be able to map the Escape key for them.  This seems to be one of them.

I'm curious, what exactly is the "Launcher" that's brought up when you press Start+Select?   (BTW, you're missing "ahk_exe" on your WinClose line)

  • Like 1
Link to comment
Share on other sites

@Johno1980

Depending how desperate you are to get this sorted and if you can wait a week (I'm on holiday and not near computer) I have HOTD3 pc running at mine without going through the launcher and also using Escape to exit. Should also allow you to map the keys via AHK rather than joy2key as I only use ahk. But as I said away from computer and not 100% sure how I did it from memory. Below is my best recollection.

Looking at it though I don't think you actually want to be closing the launcher with escape but the actual game which is not called hod3launcher.exe.  Might be called hod3pc.exe?? Or hotd3pc.exe????

I also think that hotd3 runs as an admin and if you aren't running your ahk as admin it doesn't interact with the game correctly.

Cannot remember the rest though. 

  • Like 2
Link to comment
Share on other sites

1 hour ago, Kiinkyfoxx said:

@Johno1980

Depending how desperate you are to get this sorted and if you can wait a week (I'm on holiday and not near computer) I have HOTD3 pc running at mine without going through the launcher and also using Escape to exit. Should also allow you to map the keys via AHK rather than joy2key as I only use ahk. But as I said away from computer and not 100% sure how I did it from memory. Below is my best recollection.

Looking at it though I don't think you actually want to be closing the launcher with escape but the actual game which is not called hod3launcher.exe.  Might be called hod3pc.exe?? Or hotd3pc.exe????

I also think that hotd3 runs as an admin and if you aren't running your ahk as admin it doesn't interact with the game correctly.

Cannot remember the rest though. 

@JoeViking245 appreciate all the help and thank you 

@Kiinkyfoxx Happily wait and tbh would rather do it via a Ahk without using Joytokey as well. Tried mapping it as I did with Time Crisis 5 but didn’t seem to work. 
 

Catch up when your back and feel free to private message me as well. 
 

Thanks again ?

  • Like 1
Link to comment
Share on other sites

A little off topic and hope people don’t mind. When launching PC games via Ahk sometimes they load behind launchbox so you have to click the window at the bottom of the screen. Is there something I can add to Ahk to get it to launch properly into the game screen or do I have to put the run cod’s into a particular order in the Ahk. 
Might just be the nature of pc games which I would understand. 
 

Thanks for any input 

Link to comment
Share on other sites

hi guys, sorry if someone already explained about this,

does anyone know the ahk for sending ppsspp (ppsspp exe, not libretro core) to secondary monitor ? 

it works if i pressing win+shit+left manually, but this below ahk seems not working on my launchbox;

#NoEnv
 Sleep, 3000    ;wait 3 seconds
 Send #+{Left}  ;Send Win+Shift+Left
 Return

Link to comment
Share on other sites

Another question with AHK scripts I’ve mapped my Aimtrack left and right buttons to input keyboard strokes. In note pad these work and input what I want. However in game they seem to have no affect!! 
Is there something I’m missing and doing wrong please. 
 

Thanks a lot 

Link to comment
Share on other sites

11 hours ago, monsterm90 said:

does anyone know the ahk for sending ppsspp (ppsspp exe, not libretro core) to secondary monitor ? 

This will move whichever program you indicate (ppsspp.exe in this case) to the monitor left of it's current location once the program's window becomes active.  It then closes itself (the script).

Loop
{
   IfWinActive, ahk_exe ppsspp.exe
   {
      Send #+{Left}  ;Send Win+Shift+Left
      ExitApp
   }
}

 

Link to comment
Share on other sites

2 hours ago, Johno1980 said:

Could someone help me with a Ahk script to launch and open a game in PCSX2 please and close on exit

Can you be a little more specific?  Are you trying to get it to work in LaunchBox or are you just wanting to like have a shortcut on your desktop to launch a specific game?

When setting up the emulator in LaunchBox, it will automatically (I think it did) put in an exit hook that will exit the game and close PCSX2.  Then of course to launch a game, just associate the emulator to the game or Platform.

If you want to launch one from your desktop, it might be easier to create a batch file.  But we can get pretty creative with AHK scripts. ;) 

Link to comment
Share on other sites

Hi, 

Sorry I wasn’t very specific and yeah running it through launchbox which is fine.
I’m using mouse patcher which has cheats so I want to be able to run two versions. 1 with cheats on and another with cheats off. 
so want to create a Ahk that will launch the game (mouse patcher I can take care of and get to load) and then I’ll add this to the additional app. Then on clicking on the game normally it’ll load without cheats. Then right clicking and selecting the Ahk it’ll load with cheats. Hoping that makes sense lol. So just need to know how to type that command and get the game to load please 

 

Thanks a lot 

Link to comment
Share on other sites

Hmmm.... Interesting. :D  The basic command line is:  (game_name extension may vary)

"full/path/to_your/PCSX2/pcsx2.exe" --fullscreen "full/path/to/the_rom_file/game_name.cso"

So to reiterate, you double-click the PS2 game to simply play it.  OR... right click the game, then click the Additional App (that you added in) to play it with the cheats enabled (loaded).  The Additional App, which is the AHK script you're wanting to create, will basically execute....  Run, Mouse_Patcher.exe [and] Run, the_command_line_above.  Which is all very doable.  But there are some caveats.

The main one being you can't pass variables to an Additional App.  The key variable in this case being  "full/path/to/the_rom_file/game_name.cso".  Using this method you'd need to create one for each game , manually putting the ../path/game_name in there.  But again, very doable.  (just giving a heads up, is all. ;) )

Link to comment
Share on other sites

On 10/2/2020 at 9:07 PM, JoeViking245 said:

This will move whichever program you indicate (ppsspp.exe in this case) to the monitor left of it's current location once the program's window becomes active.  It then closes itself (the script).


Loop
{
   IfWinActive, ahk_exe ppsspp.exe
   {
      Send #+{Left}  ;Send Win+Shift+Left
      ExitApp
   }
}

 

Thanks JoeViking245, but unfortunately it doesn't work :(

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...