Jump to content
LaunchBox Community Forums

Auto Hotkey Scripts


Lordmonkus

Recommended Posts

I figured out if the directory is already there it will not overwrite it it just won't work. So I have to make sure the Game folder inside GameLaunch gets deleted each time. 

 

Anyway it's probably a waste of time overall due to the time it takes to copy to C : drive. DragonBall Z FighterZ takes awhile to boot normally. But I just tried it with this it took about 90 seconds, tried just booting directly from an external that isn't SSD about 80 seconds. Anyway I appreciate the help in trying. It's still a pretty cool proof of concept.  Small games like SUPERHOT it seems to work fast and well, but obviously those type of games aren't going to take long to boot anyway. 

I'm thinking next gen PC games though it could benefit the overall quality of the game as more games are going to depend on SSD and I'm sure one day it will be a requirement even on PCS as PS5 and Xbox One have them.

Edited by Jayinem
  • Like 1
Link to comment
Share on other sites

FileCopyDir, "%dir%", C:\GameLaunch\Game, 1    ;1 = Overwrite existing files.

But ya, most all systems emulated won't see a drastic improvement (loading or playing) between being on an SSD vs a HDD.  Conversely (as you stated) next gen (and even many current, hue-jass) PC games would.  But to copy them per-launch... ugh. lol

Though I do love a successful proof-of-concept.  May not have been 'acceptable'... ;) 

Link to comment
Share on other sites

After some help please using an Aimtrak and some windows games use keyboard inputs, off screen my gun is set to buttons so in theory I should be able to input keyboard keys and I done this recently with Time Crisis 5 

1Joy5:: Send, 5 (registers as number 5 being pressed) 1Joy1:: Send, 1 etc and it worked in game

want to do the same with arrow up/down and enter 

Been trying with ‘1Joy5:: Send, Up and ‘1joy5:: Send, Enter’ however in game it doesn’t work??

maybe in game it’s  just not possible?? Any help or what I should type appreciated.

Hope that all makes sense ?

Link to comment
Share on other sites

4 minutes ago, JoeViking245 said:

try


1Joy5:: Send, {Up}
1joy5:: Send, {Enter}

Otherwise you're sending the words/letters "Up" and "Enter".   Similar to sending the literal numbers "1" and "5". ;) 

Will try this thank you very much ?? 

Also is there a AHK that I can use to exit PC games with some are simple just with Esc but some games you have to exit via the menu!! For instance House of the dead 3??

 

thanks again ?

Link to comment
Share on other sites

39 minutes ago, JoeViking245 said:

try


1Joy5:: Send, {Up}
1joy5:: Send, {Enter}

Otherwise you're sending the words/letters "Up" and "Enter".   Similar to sending the literal numbers "1" and "5". ;) 

Hi,

Please see my AHK Script which is what i use to launch the game as I've made it into a exe. ATM it doesn't seem to work but then when i press the keys on the keyboard manually they work and register. So hoping I've just made a small error that can be easily fixed

 

#SingleInstance, force

Run, "E:\LaunchBox\PC Games\The House of the Dead 2\HOD2.EXE"
Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe"  DemulShooter.exe -target=windows -rom=hod2pc

1Joy5:: Send, {Up}
1Joy1:: Send, {Enter}


Escape::
    Process,Close,HOD2.EXE
    Run,taskkill / "HOD2.EXE" 
    ExitApp
return

 

Thank You

Link to comment
Share on other sites

52 minutes ago, Johno1980 said:

exit PC games

For PC games, it's strongly advised that you keep "old-school" and actually exit the games properly through their menus ("Exit to Windows").  But if you're bound and determined, you can use "WinClose, ahk_exe "hod2.exe"

28 minutes ago, Johno1980 said:

it doesn't seem to work

To be clear.... it doesn't launch the game or the plugin?  The only thing I can think of from what you have is to maybe add quotes around the command line parameters for the DemulShooter.

Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe" "DemulShooter.exe -target=windows -rom=hod2pc"

Also make sure the paths and stuff are all correct.  In the line above, is "DemulShooter.exe" really supposed to be in there twice?  I would have thought 

Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe" "-target=windows -rom=hod2pc"

 

Link to comment
Share on other sites

59 minutes ago, JoeViking245 said:

For PC games, it's strongly advised that you keep "old-school" and actually exit the games properly through their menus ("Exit to Windows").  But if you're bound and determined, you can use "WinClose, ahk_exe "hod2.exe"

To be clear.... it doesn't launch the game or the plugin?  The only thing I can think of from what you have is to maybe add quotes around the command line parameters for the DemulShooter.


Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe" "DemulShooter.exe -target=windows -rom=hod2pc"

Also make sure the paths and stuff are all correct.  In the line above, is "DemulShooter.exe" really supposed to be in there twice?  I would have thought 


Run, "E:\LaunchBox\Plugins\DemulShooter_v10.1.4\DemulShooter.exe" "-target=windows -rom=hod2pc"

 

Thanks again for the message and happy to keep it old school but also appreciate the script ??  

sorry for the confusion but the script works and loads the game and Demulshooter and the ini profile so that’s all good.

the part that doesn’t work is being able to control the keyboard keys with my Aimtrak off screen. Might have to go down joytokey route but was hoping a Ahk would work ?? 

 

Link to comment
Share on other sites

Glad to help.  And ya, I might have read it wrong too. ?

I've never used a lightgun, Demul nor DemulShooter on my setup.  But seems to me that if you can assign the numbers "1" and "5" to be sent (as you did on TC5), you should be able to send "Up" and "Enter" as well.   And to top things off, I've never [had to] use joytokey either.  So I guess my 'batting average' is pretty bad, as far as being able to help.  lol

A quick search around... did you setup HOD2 itself to see the gun(s) as a 'keyboard'?

https://gameroomsolutions.com/setup-dual-aimtrak-light-guns-pc-house-dead-1-2-3mame/

House of the Dead 2
First we will want to make sure the game is going to see the light guns as keyboards.  Open the config.exe for house of the dead 2 which is located in the same folder as the game itself.  Make sure both players are set to keyboard.

Anyhow, where there's a will, there's a way.  Good luck.?

  • Like 1
Link to comment
Share on other sites

Thanks for the link and hadn’t seen that tbh got it working with Joytokey but will still try with a AHK script as it should work. Just because it’s windows based might just have to type ‘Button5:: Send, Enter’ instead lol 

If you ever venture into lightguns defo look up DemulShooter by Argonlefou really great work 

 

Thanks again for your help 

  • Like 1
Link to comment
Share on other sites

Need some help guys.  I tried creating a new post but this seems like it's pretty active and the right people would read it.  I have an arcade cabinet and I run the steam version of  Killer Instinct through Big Box.  I don't use the steam link to run it, i use the actual .exe file.  I use a program called x360ce to emulate and xbox 360 controller using my arcade joysticks and buttons.

I have set x360ce to run as an additional app prior to launching Killer Instinct.  Works great.  But I am having a hard time closing x360ce after I close Killer Instinct and the x360ce UI is on top of the big box UI.  Also, this leaves my joysticks emulated and retroarch sees them as 2 additional controllers which take priority over my joysticks and player 1 is no longer player 1.

I've tried to create a .bat file to kill x360ce after I exit but it's not working.  If I select run after game it closes x360ce right after the game opens.  If I choose run before game and click wait until exit it does nothing...

Can I create a ahk to close x360ce after I exit killer instinct?  

Link to comment
Share on other sites

3 minutes ago, rom116 said:

Need some help guys.  I tried creating a new post but this seems like it's pretty active and the right people would read it.  I have an arcade cabinet and I run the steam version of  Killer Instinct through Big Box.  I don't use the steam link to run it, i use the actual .exe file.  I use a program called x360ce to emulate and xbox 360 controller using my arcade joysticks and buttons.

I have set x360ce to run as an additional app prior to launching Killer Instinct.  Works great.  But I am having a hard time closing x360ce after I close Killer Instinct and the x360ce UI is on top of the big box UI.  Also, this leaves my joysticks emulated and retroarch sees them as 2 additional controllers which take priority over my joysticks and player 1 is no longer player 1.

I've tried to create a .bat file to kill x360ce after I exit but it's not working.  If I select run after game it closes x360ce right after the game opens.  If I choose run before game and click wait until exit it does nothing...

Can I create a ahk to close x360ce after I exit killer instinct?  

@rom116 We do not stress a lot of forum rules here but we do ask that members not post the same question in multiple threads. This is a small forum compared to most so answer sometimes are not as fast as some are used to. So please do not post this same question in anymore threads.

This is probably a good spot for your question. One of names you see responding in the thread with answers is very knowledgeable when it comes to AHK. So give it some time for an answer.

You could probably create a launcher to both run the game exe and x360ce and then once it sees the game .exe is closed also close x360ce. I do something similar for a few games. I am not near my pc so I cannot share what the launcher looks like. How to make it was provided from help on our forum.

Link to comment
Share on other sites

20 minutes ago, Retro808 said:

@rom116 We do not stress a lot of forum rules here but we do ask that members not post the same question in multiple threads. This is a small forum compared to most so answer sometimes are not as fast as some are used to. So please do not post this same question in anymore threads.

This is probably a good spot for your question. One of names you see responding in the thread with answers is very knowledgeable when it comes to AHK. So give it some time for an answer.

You could probably create a launcher to both run the game exe and x360ce and then once it sees the game .exe is closed also close x360ce. I do something similar for a few games. I am not near my pc so I cannot share what the launcher looks like. How to make it was provided from help on our forum.

My bad.  I won't post anywhere else.  I only posted here because it seemed like the best place for it after I had already posted my own.  Somewhat new to batch files and never actually used AHK.  I appreciate that you cutting me some slack lol.  I am interested in creating a launcher.  Never heard of that but intrigued to learn more.  Thanks again.

Edited by rom116
Link to comment
Share on other sites

11 hours ago, rom116 said:

a .bat file to kill x360ce after I exit but it's not working.

What does your batch file look like?

 

12 hours ago, rom116 said:

If I select run after game it closes x360ce right after the game opens. 

It's possible that that the Steam game you're launching, even though using the exe, may do a sort of sub-launch.  So KI.exe (or whatever it is) when started, then launches "steam.exe -play-ki" and closes ki.exe.  At this point, LaunchBox see's ki.exe is no longer running, so then executes the "Automatically Run After Main Application" routine.  Just an example and just a guess.

Link to comment
Share on other sites

48 minutes ago, JoeViking245 said:

In your exit routine you created for your game, have it exit joytokey also.


Escape::
    WinClose, ahk_exe "hod2.exe"
    WinClose, ahk_exe "joytokey.exe"
ExitApp

(I presume that's the executable filename for joytokey).

Thanks a lot for this and may not be Ahk related but how do I use Joytokey and profiles for individual games??? 
how can I get it to launch with the game and correct config profile please. 
 

Not using rocketlauncher either ??☺️
 

thanks a lot 

Link to comment
Share on other sites

6 hours ago, JoeViking245 said:

What does your batch file look like?

 

It's possible that that the Steam game you're launching, even though using the exe, may do a sort of sub-launch.  So KI.exe (or whatever it is) when started, then launches "steam.exe -play-ki" and closes ki.exe.  At this point, LaunchBox see's ki.exe is no longer running, so then executes the "Automatically Run After Main Application" routine.  Just an example and just a guess.

Hey man.  Thanks for attempting to help me.  Here is my batch file- I have this working as intended with PS3 games which also require x360ce for my arcade joystick and buttons to work.

c:\windows\system32\cmd.exe /c c:\windows\system32\TASKKILL.exe /F /IM x360ce.exe
Edited by rom116
Link to comment
Share on other sites

@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 ;))

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