Jump to content
LaunchBox Community Forums

PCSX2 AHK Help


Ghostlines

Recommended Posts

I've been searching for hours but I cant seem to wrap my head around how to use AHKs. I've copy/pasted ones people have posted on the forums but anything I try to write doesnt work. It also doesnt help that I dont understand how it works. I've been reading tutorials for the past hour and I'm still not understanding it.

Here's what I'm trying to do; When PCSX2 opens, I'd want an AHK to press F3 just once to auto load a save state. Is this even possible? My theory is, I could write an AHK.exe and have it load before the launch of the rom in the additional apps feature.

Can someone with more experience show me if this possible, please?

Link to comment
Share on other sites

Should be possible. This assumes you have previously created a save state for the game you are going to execute. Put the code below in the 'Autohotkey Script' section of the Edit Emulator process for PCSX2.

#NoEnv
 Sleep, 3000
 SetKeyDelay, -1, 110
 Send {F3}
 Return

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

Link to comment
Share on other sites

Perfect! Instead of putting the code in the AHK Script section of the emulator, I converted it to an .exe. I set that .exe to launch before the main app when launching PCSX2 from launchbox and it auto loaded my save state! 

I'm going for a seamless experience with my launchbox and being able to boot directly from a save state adds to the immersion. For example, I have been wracking my brain for almost two months on how to load directly into Hyper Street Fighter Alpha without having to download/convert memory card saves, navigate menus, and otherwise launching Street Fighter Alpha Anthology proper. This opens so many more doors for hidden games within games. 

Thank you so much for your help!

  • Like 1
Link to comment
Share on other sites

  • 4 years later...
3 hours ago, atalec said:

Hi,

Sorry to respawn this old message but I want to do that too and it doesn't work with an ahk script

How did you do to make an exe ?

Please

If it doesn't work with a script, it probably won't work with a compiled exe.  I've never used save states in PCSX2, but I have created and setup an AutoHotkey script or 2.  My guess it's how you setup the script to run.

To directly answer your question, to compile an AHK script to an exe, you need to download and install AutoHotkey.  Once that's done, you simply right-click your script file (in Windows Explorer) and choose Compile.   But this really isn't necessary.

 

If you want to have it 'press F3' after launching any game with PCSX2, copy the above script**, edit your PCSX2 emulator [in LaunchBox] and paste in into the Running Script section.

** a 4-year later update: Change the last part of the script to (which actually should already be in that section)

; This section closes PCSX2 when pressing Escape
$Esc::
{
    WinClose, ahk_exe {{{StartupEXE}}}
}

 

If you wanting to do it on a per game basis using Additional Apps, follow these instructions:

If you do it this way, remove the last part of the script.

 

 

Link to comment
Share on other sites

4 hours ago, atalec said:

Hi,

Sorry to respawn this old message but I want to do that too and it doesn't work with an ahk script

How did you do to make an exe ?

Please

I do this with PCSX2, used it with R-Type Final last night even. I am still using PCSX2 v1.6 but I hoping that doesn't matter unless they changed the save/load state features in v1.7+ (and also assuming you're on v1.7.X)

I'm not 100% sure if PCSX2 responds appropriately to just sending "Send {F3}", I think it requires a down and up key state, all programs respond differently, and some are more finicky. I know for certain it works with "Send {F3 down}{F3 up}" which better emulates as if the key was physically pressed in real life.  You do not need to make an exe and you actually wouldn't want to, it's more work. Because then you would need to add the exe file as an additional app to each game you want this script to launch with and anytime you had to edit it, you would have to recompile the exe. I don't recommend that method. Using the "Running Script" field in the emulators settings is sufficient for the goal

 

This is all you really need for this to work. Leave in any default stuff regarding exiting the emulator, which I included here too

WinWait, ahk_exe pcsx2.exe ;Waits for the emulator window to exist
Sleep, 5000 ;Amount of time to wait after the emulator launches to load the save state. 1000 = 1 sec 
Send {F3 down}{F3 up} ;loads the currently selected save state

; This section closes PCSX2 when pressing Escape
$Esc::
WinClose, ahk_exe {{{StartupEXE}}}
Edited by skizzosjt
syntax error
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...