Jump to content
(Open Beta) HyperSpin 2 is now available for everyone ×

Autohotkey script help


Recommended Posts

Posted

Anyone know any good tricks to launch AHK scripts before a game, rom or emulator launches? In PC launcher there's a pre-launch place, but it doesn't launch the script soon enough to take effect before the game kicks in (post-exit script launch works great though).

I also don't even see a way to pre-launch/load scripts for non-PC games.

Is there any good way to do this? Any tricks?

I need to be able to launch a small script automatically when I launch a game from Hyperspin, but it needs time to actually run before the game launches. I've been working on this for days and it's really, really starting to piss me off. Any help would be appreciated.

Posted

Anyone?

It also seems that setting a startup .AHK script in the HyperHQ settings doesn't actually enable the script...

I have to minimize Hyperspin first before I can get it to work.

The scripts work, but how in Gods name do I get Hyperspin/HyperlaunchHQ to register them?

Posted

I think you have to go to hyperlaunch hq, go to pc games, go to the module tab, edit module settings, snap the window so you can see the game list and +button, go to the pc game that needs the prescript, enter in the path to you ahk. This is what I'm going to do if someone knows the ahk script I could use to press enter or spacebar so the pop up message is pressed automatically before the game starts (megamanx7)

Man that's sick! I love what you made here and would love to add it to my set up! Don't forget to upload it to the download page! (Tapatalk signature)

Posted

I think you have to go to hyperlaunch hq, go to pc games, go to the module tab, edit module settings, snap the window so you can see the game list and +button, go to the pc game that needs the prescript, enter in the path to you ahk. This is what I'm going to do if someone knows the ahk script I could use to press enter or spacebar so the pop up message is pressed automatically before the game starts (megamanx7)

Man that's sick! I love what you made here and would love to add it to my set up! Don't forget to upload it to the download page! (Tapatalk signature)

That's exactly what I'm doing. Problem is it doesn't work. The scripts don't seem to trigger that way (except the PostExit one. That one works perfectly)

When I get home Ill try to write a couple scripts that might help you with MegaMan.

Posted

I know the prescript works because I got it working with mind craft. I think it's in the default root. Off the top of my head it's in the hyperlaunch folder, module extensions or maybe in the pclauncher module folder you should see pre and post scripts

Man that's sick! I love what you made here and would love to add it to my set up! Don't forget to upload it to the download page! (Tapatalk signature)

Posted

So you got a script to work by manually placing it in the correct folder/path? I haven't tried that, I've only tried entering it into the options box within hyperlaunchHQ. I'll try it your way to see if it works for me.

What is it you got to work there? An AHK script file?

Posted

Ya it was mind craft. The git by default has everything in there. Check out the pclauncher folder and I think it's called extensions or something folder. You should see the extra folder. It's a start up script

Man that's sick! I love what you made here and would love to add it to my set up! Don't forget to upload it to the download page! (Tapatalk signature)

Posted

Might have figured out why my script runs and works but doesn't seem to activate for the game.

From looking at the log it appears when you launch a game the HL VJoy Keymapper settings are loaded almost first thing.

However whatever you have set to run under Prelaunch settings don't kick in for another 46 lines or so.

My guess is HL is loading the Keymapper settings long before it loads the actual drivers those settings need. So it never works.

You would think a setting called prelaunch would actually run sooner.

Maybe User Functions.ahk can work around this, but so far I can't get it to work at all. I'm really starting to hate all of this.

Posted

Have a scipt running at hs launch that listens for emulator/game.exe to launch.

Yeah. It will have to be set up like that.

Turns out that the User Functions Init.ahk settings actually run even later than the Prelaunch settings by a couple lines.

I don't know how to write a script as complicated as what you suggest. I can try to set my script as the Prelaunch script and then try to set the VJoy Keymapper enable code to happen afterwards. Maybe. So far I haven't gotten that to work. I've tried the AHK syntax as it is in the log file & module but no luck yet.

I may just give up on this being an automatic process for now and just keep it manual like I have it now (on my control panel I hold the P1 Start button and hit two Player 2 buttons to anable the drivers). It works, but automatic would be worlds better.

Posted

That would be awesome thanks.

What do you use this script for on your cab?

Switching between monitors (shutdown lower monitor and display on upper monitor for light gun games) and rotating my lower monitor.

sig2.png?raw=1sig.jpg?raw=1

 

Posted

It's too late to switch my cab on now or I would share, I will post when I finish work tomorrow. It's basically a list of;

If exe1 exists do this, when it closes do this.

If exe2 exists do this ....

And so on.

sig2.png?raw=1sig.jpg?raw=1

 

Posted

Awesome. That sounds like it might do the trick.

 

I ran across your cab over 3 months ago just before I started to build mine. Very awesome what you did there. Super impressive work.

Posted

Here you go.

Loop
{

;Demul Lightgun

Process, Wait, demul_lightgun.exe, 0.1
If (ErrorLevel != 0)
{
run C:\Windows\System32\DisplaySwitch.exe /external
Process,WaitClose, demul_lightgun.exe
run C:\Windows\System32\DisplaySwitch.exe /extend
}

----------------------------------------------------------------


;Playstation Lightgun

Process, Wait, pcsxr-lightgun.exe, 0.1
If (ErrorLevel != 0)
{
sleep, 2000
run C:\Windows\System32\DisplaySwitch.exe /external
sleep, 1000
WinGetActiveTitle, title
WinMinimize, %title%
WinMaximize, %title%
Process,WaitClose, pcsxr-lightgun.exe
run C:\Windows\System32\DisplaySwitch.exe /extend
}

-----------------------------------------------------------------


;Playstation 2 Lightgun

Process, Wait, pcsxr-lightgun-PS2.exe, 0.1
If (ErrorLevel != 0)
{
run C:\Windows\System32\DisplaySwitch.exe /external
Process,WaitClose, pcsxr-lightgun-PS2.exe
run C:\Windows\System32\DisplaySwitch.exe /extend
}

-------------------------------------------------------------------


;Pinball FX2

Process, Wait, Pinball FX2.exe, 0.1
If (ErrorLevel != 0)
{
run smccmd --resume --speed 2050,,Hide
Process,WaitClose, Pinball FX2.exe
run smccmd --resume --speed -2250,,Hide
}


-------------------------------------------------------------------


;Nintendo DS

Process, Wait, DeSmuME_0.9.10_x64.exe, 0.1
If (ErrorLevel != 0)
{
run C:\HyperSpin\HyperLaunch\Module Extensions\hide idle mouse.exe
;sleep, 1000
;sleep, 1000
run smccmd --resume --speed 2050,,Hide
;run C:\HyperSpin\HyperLaunch\Module Extensions\irotate.exe /1:rotate=90
Process,WaitClose, DeSmuME_0.9.10_x64.exe
;run C:\HyperSpin\HyperLaunch\Module Extensions\irotate.exe /1:rotate=0 /exit
;Process close, swapscreen.exe
;sleep, 1000
Process close, hide idle mouse.exe
run smccmd --resume --speed -2250,,Hide
;run C:\HyperSpin\HyperLaunch\Module Extensions\qres.exe /x:1920 /y:1080
}


-------------------------------------------------------------------


;Sega Model 3 Lightgun

Process, Wait, Supermodel2.exe, 0.1
If (ErrorLevel != 0)
{
sleep, 2000
run C:\Windows\System32\DisplaySwitch.exe /external
Process,WaitClose, Supermodel2.exe
run C:\Windows\System32\DisplaySwitch.exe /extend
}


--------------------------------------------------------------------



;Sega Model 2 Lightgun

Process, Wait, emulator_multicpu.exe, 0.1
If (ErrorLevel != 0)
{
run C:\Windows\System32\DisplaySwitch.exe /external
Process,WaitClose, emulator_multicpu.exe
run C:\Windows\System32\DisplaySwitch.exe /extend
}


--------------------------------------------------------------------


;Taito Type X Vertical Games

Process, Wait, gamevertical.exe, 0.1
If (ErrorLevel != 0)
{
run smccmd --resume --speed 2050,,Hide
run C:\HyperSpin\HyperLaunch\Module Extensions\irotate.exe /1:rotate=180 
Process,WaitClose, gamevertical.exe
run C:\HyperSpin\HyperLaunch\Module Extensions\irotate.exe /1:rotate=0 /exit
run smccmd --resume --speed -2250,,Hide
run C:\HyperSpin\HyperLaunch\Module Extensions\bring back focus.ahk
sleep, 3000
Process, close, iRotate.exe
}


---------------------------------------------------------------------


;Demul Vertical Games

Process, Wait, demul_vertical.exe, 0.1
If (ErrorLevel != 0)
{
run smccmd --resume --speed 2050,,Hide
Process,WaitClose, demul_vertical.exe
run smccmd --resume --speed -2250,,Hide
}



---------------------------------------------------------------------


;PopCap HeavyWeapon

Process, Wait, HeavyWeapon.exe, 0.1
If (ErrorLevel != 0)
{
run C:\Windows\System32\DisplaySwitch.exe /clone
Process,WaitClose, HeavyWeapon.exe
run C:\Windows\System32\DisplaySwitch.exe /extend
}


----------------------------------------------------------------------



;PopCap Hammerheads

Process, Wait, HammerHeads.exe, 0.1
If (ErrorLevel != 0)
{
run C:\Windows\System32\DisplaySwitch.exe /clone
Process,WaitClose, HammerHeads.exe
run C:\Windows\System32\DisplaySwitch.exe /extend
}


-----------------------------------------------------------------------


;android vertical

Process, Wait, androidvertical.exe, 0.1
If (ErrorLevel != 0)
{
Process, Wait, androidvertical.exe
run smccmd --resume --speed 2050,,Hide
run C:\HyperSpin\HyperLaunch\Module Extensions\irotate.exe /1:rotate=270
sleep, 3000
run C:\HyperSpin\HyperLaunch\Module Extensions\inverse mouse.ahk
Process,WaitClose, HD-Frontend.exe
run C:\HyperSpin\HyperLaunch\Module Extensions\irotate.exe /1:rotate=0
send !z
run smccmd --resume --speed -2250,,Hide
sleep, 3000
Process, close, iRotate.exe
}


-----------------------------------------------------------------------


;android vertical alternative

Process, Wait, androidverticalalternative.exe, 0.1
If (ErrorLevel != 0)
{
Process, Wait, androidverticalalternative.exe
run smccmd --resume --speed 2050,,Hide
run C:\HyperSpin\HyperLaunch\Module Extensions\irotate.exe /1:rotate=90
sleep, 3000
Process,WaitClose, HD-Frontend.exe
run C:\HyperSpin\HyperLaunch\Module Extensions\irotate.exe /1:rotate=0
run smccmd --resume --speed -2250,,Hide
sleep, 3000
Process, close, iRotate.exe
}




-----------------------------------------------------------------------


;PopCap Chuzzle

Process, Wait, Chuzzle.exe, 0.1
If (ErrorLevel != 0)
{
sleep, 1000
run C:\Windows\System32\DisplaySwitch.exe /internal
Process,WaitClose, Chuzzle.exe
run C:\Windows\System32\DisplaySwitch.exe /extend

}


-----------------------------------------------------------------------



;PopCap PeggleNights

Process, Wait, PeggleNights.exe, 0.1
If (ErrorLevel != 0)
{
sleep, 1000
run C:\Windows\System32\DisplaySwitch.exe /clone
Process,WaitClose, PeggleNights.exe
run C:\Windows\System32\DisplaySwitch.exe /extend
}





-----------------------------------------------------------------------


}

Have a play with this :)

sig2.png?raw=1sig.jpg?raw=1

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...