Jump to content
LaunchBox Community Forums

Auto Hotkey Scripts


Recommended Posts

22 minutes ago, CtinD said:

I think there's a bit of confusion. I only posted that here and no other place on this site. I then went over to the main AutoHotKey forums site and asked there. It is super cringe for me creating new threads and double posting, so I avoid it at all costs. 

No confusion. You posted the same question in the thread here. It is not a big issue to worry over. We are not overt sticklers to rules here, we do like to keep posts for same questions to a minimum though.

Screen Shot 2021-02-08 at 12.20.27 PM.png

  • Like 1
Link to post
Share on other sites
  • Replies 598
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

I want to have a single thread for this so please share your useful and interesting AHK scripts here. Provide a short description of what the script does put the script in the post using the code

Was way too fast without any delay but it's perfect with sleep, 100. Thanks again! You guys will both get a shout out in the next release for C64 Dreams  

In case you want to start Xpadder.exe with an emulator's games and then exit Xpadder when exiting the game, you can add this ahk code to your emulator's AutoHotkey Script tab: Run, C:\Xpadder\Xpad

Posted Images

27 minutes ago, Retro808 said:

No confusion. You posted the same question in the thread here. It is not a big issue to worry over. We are not overt sticklers to rules here, we do like to keep posts for same questions to a minimum though.

Screen Shot 2021-02-08 at 12.20.27 PM.png

See my last line? I was so tired last night. I legitimately  thought i was messaging a friend on here. I apologize and have deleted that post. I really have no idea how I managed to do that. 

  • Haha 1
Link to post
Share on other sites
5 hours ago, JoeViking245 said:

You could probably write a script to check it (and possibly reconnect it).  But you'd be much better off fixing the underlying issue.image.thumb.png.cf34a9a0c40f519ed25b723d32771142.png 

I guess I could but 2.0 speeds suck. Couldn't it even effect newer games? I have 2021 games on it. 

It does sound like this is likely the issue though, what a bunch of bs another thing broken on Windows 10. 

Edited by Jayinem
Link to post
Share on other sites

I created a little script with AutoHotKey to be able to quit Raiden IV using the Esc key. and I took the opportunity to modify the z and x keys:
#SingleInstance, Off
Esc :: F2
LCtrl :: z
Alt :: x
return
Everything works, but the script remains open after closing Raiden IV. How to close the script at the same time as the game (Raiden IV: Overkill). Small precision, the script is compiled in .exe
thank you 😉

Link to post
Share on other sites
LCtrl:: z
Alt:: x
$Esc::
{
  Send, {F2}
  ExitApp
}

"ExitApp" will close the script after it 'presses' F2 [to close Raiden].

You probably don't need nor want to have "#SingleInstance, Off".  Thought it shouldn't be an issue because of "ExitApp", if something weird were to happen, you wouldn't want it running 2 (or more) instances.  If you're adamant about having something there, I'd recommend using  "#SingleInstance, Force" instead.

Link to post
Share on other sites

@Gerald You kinda said (and your script shows) that you remapped the Escape key to F2.  (Just like you remapped Alt to x)  I assumed F2 was what you pressed to quit Raiden [if a keyboard were connected].  As in, you press Escape (or the equivalent button on your cab) and it sends F2 to the game to exit it.

So if you were playing the game, and say you did have a keyboard, what would you press to quit the game?   Or did you not mean to remap the Escape key and pressing it actually exits the game already?

Link to post
Share on other sites

@ JoeViking245,
no, it's the other way around, I remapped "F2" to Esc, X to Alt and Z to LCtrl.
I would like to close my script at the same time as Raiden IV.
Thank you for your help. 😉

Link to post
Share on other sites
2 hours ago, Gerald said:

no, it's the other way around, I remapped "F2" to Esc, X to Alt and Z to LCtrl.

Semantics.

3 hours ago, Gerald said:

I would like to close my script at the same time as Raiden IV.

 

3 hours ago, JoeViking245 said:

So if you were playing the game, and say you did have a keyboard, what would you press to quit the game?

 

Link to post
Share on other sites

this should be an easy one...

i'm looking to send either the right alt or right control with a key press.  let's say right control with the 'n' key and right alt with the 'o' key.  can someone help?

thanks all!

Link to post
Share on other sites
On 2/9/2021 at 11:19 AM, Gerald said:

Everything works, but the script remains open after closing Raiden IV. How to close the script at the same time as the game (Raiden IV: Overkill). Small precision, the script is compiled in .exe

I reread your post (a lot more carefully this time).  Since your script is an already compiled exe file in which everything works, what you can do is:

Write another script and compile it.    Then in LaunchBox, Edit your Raiden IV game, go to the Additional Apps section, click Add ApplicationBrowse to the location for this newly compiled script and select it.  Check the box for Automatically Run After Main Application. Click OK.

In this new script, put

WinClose, ahk_exe MyRaidenScript.exe

Replace "MyRaidenScript.exe" with the name of your compiled .exe file that you're wanting to have closed.

Apologies for my prior confusion.

Link to post
Share on other sites

Hi,

I'm trying to script an AHK that will launch a resolution changer with a profile to change the resolution to 1080, then launch a game, then when I press escape (which closes the game already) launch the resolution changer again with a profile to change back to 4K.

With my (very limited) knowledge of AHK, I have the following:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Run, C:\DisplayChanger2\dc2x86.exe -configure="1080p60.xml"
return

Run, E:\Launchbox\Games\Teknoparrot\Sega Nu\Luigi's Mansion Arcade\exe\x64\Game Loader All RH.exe
return

Esc::
Run, C:\DisplayChanger2\dc2x86.exe -configure="4K60.xml"

The AHK does change the resolution to 1080, and back to 4K when I press Esc but it never launches the game. Any tips?

Note: If I directly launch the game, it loads up fine.

Thanks...Piper

Link to post
Share on other sites

@PiperCalls  Remove both "return".  And if the Esc function doesn't work, put a "$" in front of it.

Run, C:\DisplayChanger2\dc2x86.exe -configure="1080p60.xml"
Run, E:\Launchbox\Games\Teknoparrot\Sega Nu\Luigi's Mansion Arcade\exe\x64\Game Loader All RH.exe

$Esc::
Run, C:\DisplayChanger2\dc2x86.exe -configure="4K60.xml"

 

Link to post
Share on other sites
23 hours ago, JoeViking245 said:

@PiperCalls  Remove both "return".  And if the Esc function doesn't work, put a "$" in front of it.


Run, C:\DisplayChanger2\dc2x86.exe -configure="1080p60.xml"
Run, E:\Launchbox\Games\Teknoparrot\Sega Nu\Luigi's Mansion Arcade\exe\x64\Game Loader All RH.exe

$Esc::
Run, C:\DisplayChanger2\dc2x86.exe -configure="4K60.xml"

 

Unfortunately same result. It will change rez & back but never launches the game. If I launch the game directly at that same location it loads up fine.

Link to post
Share on other sites

I have a Game That Has Two Exits. and it will not escape quickly no matter what i do.

The Controls Are:

When Loading Game:

ESC = quit

 

In-Game:

Soft Reset= ALT+F4

This Particular game has to soft reset before the ESC works.

Since im using arcade controls i would like to be able to press 1+2 simultaneously and that would send Alt+F4. Then when it takes me to the beginning i can just press escape like normal.

can someone help me please? and would i paste this in running ahk script or exit ahk script?

thank you in advance

 

Link to post
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
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...