Jump to content
LaunchBox Community Forums
Lordmonkus

Auto Hotkey Scripts

Recommended 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 function (the <> at the top of the post box).

Launch Higan in fullscreen mode since not all versions of Higan has a command line parameter to do this:

#NoEnv

Sleep, 3000
SetKeyDelay, -1, 110
Send {F11}
Return

Universal close emulator with the Escape key, useful for ePSXe:

$Esc::
{
    Process, Close, {{{StartupEXE}}}
} 

Hide your mouse cursor for certain emulators that don't hide your mouse, change the numbers to match your monitors resolution:

MouseMove, 1920, 1080

Here is a script from @Reynbow that closes out the Higan emulator properly so that it doesn't lose your save game data.

$ESC::WinClose, ahk_exe higan.exe

 

  • Thanks 2

Share this post


Link to post
Share on other sites

AHK script for Xarcade tankstick users to exit emulators that do not have internal binding options since Xarcade simulates key strokes. It is modified from the script in this post

Script is set to use Player 4 start button and Player 2 start button as exit. Hold P4 and P2 for more than 2 seconds. Simply change "4" and/or "2" to the key of choice if you desire to use an alternate button key. This is using default Xarcade layout. 

Also you can lengthen or shorten the duration you have to hold the combo by changing "Duration > 2" (this is seconds)

 


~4 & 2::

Duration=0

Loop

{	Duration ++

	If !GetKeyState("4","P") || !GetKeyState("2","P")

		Break

	If Duration > 2

	{	

        Process, Close, {{{StartupEXE}}}

		break

	}

	Sleep, 1000

}

return

 

  • Like 1

Share this post


Link to post
Share on other sites

In some emulators with some LB versions, this ahk line might crash or exit BB when exiting the game or cause something else undesirable (it is rare though):

Process, Close, {{{StartupEXE}}}

If that happens, one of these other options should solve the problem:



For Demul:

$Esc::
{
     WinClose, ahk_class window ahk_exe demul.exe
} 


For Retroarch:

$Esc::
{
    WinClose, ahk_class RetroArch
} 


For Dolphin:

$Esc::
{
    WinClose, ahk_class wxWindowNR
} 

 

Share this post


Link to post
Share on other sites

In case you want to hide the mouse pointer and have nomousy.exe, you can add this ahk code to your emulator's AutoHotkey Script tab (example is for Demul since that one often needs this):

Run, R:\LaunchBox\Games\Tools\nomousy.exe /hide
$Esc::
{
        Run, R:\LaunchBox\Games\Tools\nomousy.exe
        WinClose, ahk_class window ahk_exe demul.exe
}

Just change the path to where you put your nomousy.exe file.

Share this post


Link to post
Share on other sites

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\Xpadder.exe /m
$Esc::
{
        Run, C:\Xpadder\Xpadder.exe /C
	Process, Close, {{{StartupEXE}}}
}

Just change the path to where you put your Xpadder.exe file.

  • Thanks 2

Share this post


Link to post
Share on other sites
On 1-7-2017 at 3:33 AM, Retro808 said:

AHK script for Xarcade tankstick users to exit emulators that do not have internal binding options since Xarcade simulates key strokes. It is modified from the script in this post

Script is set to use Player 4 start button and Player 2 start button as exit. Hold P4 and P2 for more than 2 seconds. Simply change "4" and/or "2" to the key of choice if you desire to use an alternate button key. This is using default Xarcade layout. 

 



~4 & 2::

Duration=0

Loop

{	Duration ++

	If !GetKeyState("4","P") || !GetKeyState("2","P")

		Break

	If Duration > 2

	{	

        Process, Close, {{{StartupEXE}}}

		break

	}

	Sleep, 1000

}

return

 

This looks exectly something that am struggling with for the last 4 days, i have installed AHK could you explain me maybe how i can use this for example with dc emulator nulldc.

How can i add this script within the emulator

Sorry if this is a stupid questions

Share this post


Link to post
Share on other sites

@FlawLezZ

I simply copy then paste the script into the Autohotkey tab in the Edit Emulator screen within the Launchbox options.

 

Capture.JPG

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Retro808 said:

@FlawLezZ

I simply copy then paste the script into the Autohotkey tab in the Edit Emulator screen within the Launchbox options.

 

Capture.JPG

Much appreciated !! ill try it out in next few days !! Thanks man !

Share this post


Link to post
Share on other sites

I would love to find a way to set my Ultimark U360 analog stick to 4 way on LaunchBox launch and after a game ends.  Anyone have an AHK for that, and some instruction on where to apply it?

Also, best way to automatically apply U360 settings per game?  I used to use hypermap with HyperSpin but am not sure how to configure it properly with LaunchBox.

Thanks.

Share this post


Link to post
Share on other sites

Another "close emulator" script that sends Alt + F4

$Esc::
{
    Process, Close, {{{StartupEXE}}}
}


vk07sc000::
  Send, !{F4}
  Return

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
17 minutes ago, lordmonkus said:

Another "close emulator" script that sends Alt + F4


$Esc::
{
    Process, Close, {{{StartupEXE}}}
}


vk07sc000::
  Send, !{F4}
  Return

 

Thank you! This is very useful for the vice-win (Commodore computers) emulator!

Share this post


Link to post
Share on other sites

This will put CxBx Reloaded into full screen after launching. You can change the app title to whatever you want, to make it work with other emulators.

#NoEnv

WinWaitActive , Cxbx-Reloaded
SetKeyDelay, -1, 110
Send {Alt Down}{Enter}{Alt Up}
Return

 

  • Thanks 1

Share this post


Link to post
Share on other sites

This is one that I stole from someone on here. I can't remember who it was but credit to them. Exit PCSX2 emulator:

; This section closes PCSX2 when pressing Escape
$Esc::
{
	Process, Close, {{{StartupEXE}}}
}

 

Share this post


Link to post
Share on other sites

Using the process,close script with higan causes issues with the higan not having chance to update the save.ram file. 

At the moment the only solution I've found is to use the 

ESC::

send !{f4}

But this only works if higan is not full screen. When I try and map the full screen toggle button to the AHk script it doesn't work, higan just ignores it. Is there any way to write a script to get around it?

 

Share this post


Link to post
Share on other sites

Is there any script that replaces ESC with ALT+F4 for Fusion and for ePSXe? The latter in particular gives me some trouble with disc swapping when I run it from within Launchbox. 

Share this post


Link to post
Share on other sites
3 hours ago, Shalashaskka said:

Is there any script that replaces ESC with ALT+F4 for Fusion and for ePSXe? The latter in particular gives me some trouble with disc swapping when I run it from within Launchbox. 

Try this:

vk07sc000::
  Send, !{F4}
  Return

 

Share this post


Link to post
Share on other sites

Sorry I have nothing else then.
I don't use Fusion because of the problems it has and there simply is no reason to use it when we got Retroarch and the Genesis GX core which is superior in every way.

Share this post


Link to post
Share on other sites
12 hours ago, lordmonkus said:

Sorry I have nothing else then.
I don't use Fusion because of the problems it has and there simply is no reason to use it when we got Retroarch and the Genesis GX core which is superior in every way.

Well, Fusion I don't really care about. Not doing much disc swapping on that emulator. My primary concern is trying to stop ePSXe from closing every time I hit ESC, since that's the key bound to bringing up the menu and selecting what rom it's reading.

But thanks for the help regardless.

Share this post


Link to post
Share on other sites

I do the same for PS1 emulation, I use Retroarch over ePSXe. I have no idea what sort of CPU you have in your system and if it would be capable of Retroarch for PS1, I do know though that ePSXe is faster on lower end spec hardware because my HTPC cannot handle Retroarch for PS1.

Share this post


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