Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: Connorsdad on May 20, 2013, 02:29:49 am

Title: Is it possible for ahk script to detect which rom is loaded ?
Post by: Connorsdad on May 20, 2013, 02:29:49 am
I'm looking to have a script to fire off a certain command depending on which rom is currently running and then issue another command when that emulator is closed.
Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: BadMouth on May 20, 2013, 12:02:16 pm
What front end are you using?

Mala can pass along the name of the rom as variable %1, but IIRC the autohotkey file needs to be compiled to an exe for it to work.
I use this with batch files fairly often, but haven't done it with ahk scripts although I make heavy use of ahk scripts in my setup.

This thread will give you an idea:
http://forum.arcadecontrols.com/index.php/topic,68419.0.html (http://forum.arcadecontrols.com/index.php/topic,68419.0.html)
Of course you'd be using if "%1" == romname goto whatever

Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: Connorsdad on May 20, 2013, 01:47:50 pm
I'm using hyperspin but I'll take a look anyhow, thanks :)

I want to clone, swap or detach my primary monitor (display will be shown on secondary monitor) when light gun games are running in different emulators. I haven't even tried this manually yet so not sure if it's possible anyway.
Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: BadMouth on May 20, 2013, 03:29:43 pm
DNA Dan's cab runs Hyperspin and rotates based on whether the game is vertical or horizontal.
You might be able to borrow some useful stuff from his setup files:
http://forum.arcadecontrols.com/index.php/topic,110471.msg1231576.html#msg1231576 (http://forum.arcadecontrols.com/index.php/topic,110471.msg1231576.html#msg1231576)
Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: Le Chuck on May 20, 2013, 08:27:20 pm
I'm using hyperspin but I'll take a look anyhow, thanks :)

I want to clone, swap or detach my primary monitor (display will be shown on secondary monitor) when light gun games are running in different emulators. I haven't even tried this manually yet so not sure if it's possible anyway.

KVM switch?
Title: Re: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: Connorsdad on May 21, 2013, 02:23:01 am
I'm using hyperspin but I'll take a look anyhow, thanks :)

I want to clone, swap or detach my primary monitor (display will be shown on secondary monitor) when light gun games are running in different emulators. I haven't even tried this manually yet so not sure if it's possible anyway.

Seems this isn't possible due to the fact the resolution set in the emulators for my primary monitor is too large for my secondary monitor, when I switch monitors it just crashes the emulators. So I have the choice of either using mame only for light gun games or running all emulators in the lower resolution :(

Any ideas?

I don't know if setting the resolution of the emulators on the fly is possible?
Title: Re: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: Connorsdad on May 21, 2013, 02:32:57 am
I'm using hyperspin but I'll take a look anyhow, thanks :)

I want to clone, swap or detach my primary monitor (display will be shown on secondary monitor) when light gun games are running in different emulators. I haven't even tried this manually yet so not sure if it's possible anyway.

KVM switch?

I don't know what a KVM switch is or what it does but I'll take a look :)
Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: Connorsdad on May 21, 2013, 03:02:38 am
If it's possible to run different instances of the same emulator in hyperspin I know I could simply run 2 versions of the ps1 emulator, 1 for normal (primary monitor) games and 1 for light gun (secondary monitor) games. The ps1 emulator epsxe lets you set which display to use in its config.

Just trying to think of different ways to tackle it.
Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: BadMouth on May 21, 2013, 09:35:02 am
If it's possible to run different instances of the same emulator in hyperspin I know I could simply run 2 versions of the ps1 emulator, 1 for normal (primary monitor) games and 1 for light gun (secondary monitor) games. The ps1 emulator epsxe lets you set which display to use in its config.

Just trying to think of different ways to tackle it.

Running different instances would be the simplest way to go about it.
I do that for a couple different emulators where I want different settings for different batches of games.

Changing the screen resolution is possible with autohotkey, although I'm not sure about multiple monitors.
It's also possible to have ahk change the emulator's ini file before it is launched.
With those, you are back to needing to determine which rom has launched.
Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: Connorsdad on May 26, 2013, 10:53:49 am
So far I have my ps1 lightgun games running a different emulator (which works with my aimtraks) from the same wheel as all other ps1 games, now I need help with my ahk as I am a complete noob when it comes to ahk, Is there a cleaner way of doing the following. My script so far:

Code: [Select]
Process, Wait, pcsxr-lightgun.exe

Process,Close, HyperSpinHelper.exe

sleep, 5000

run C:\Windows\System32\DisplaySwitch.exe /external

sleep, 3000

WinGetActiveTitle, title

WinMinimize, %title%

WinMaximize, %title%

Process,WaitClose, pcsxr-lightgun.exe

run C:\Windows\System32\DisplaySwitch.exe /extend

I have to minimize and maximize the window because there is a 10mm border at the bottom of the screen, if I shoot this it activates the hyperspin window and the emu loses focus, anybody know a better way of doing this as the hyperspin window is shown for 1 second which looks fugly ? I tried just maximising the window but it doesn't change. Just need to look into looping this script so it stays active. Im hoping to use this for all my emulators and lightgun games needing only to change the name of the process in each script.
Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: Connorsdad on May 26, 2013, 11:12:59 am
Got it working by adjusting the sleep timers, also got it looping so it stays resident :)

May not seem like much to you ahk gurus but to me, to load HS up, select point blank, see one monitor switch off and the game load on the other monitor and then all reverse on the press of the ESC key, I feel like Ive just programmed the new version of windows lol.
Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: Connorsdad on May 27, 2013, 05:55:22 am
How would I go about making the ahk script listen for different exes?

I was hoping to use just one script to listen for all lightgun emulators launching.


Eg.
Process, wait, programme1.exe or programme2.exe or programme3..... etc etc

If this isn't possible I'll just run 5 or 6 scripts to listen for each emulator, I just thought there might be a cleaner way of doing it.
Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: headkaze on May 27, 2013, 12:21:31 pm
Have your script wait and exit when the emulator exits and run it before you launch each emulator passing in the executable name to wait for as a command line parameter (http://www.autohotkey.com/docs/Scripts.htm#cmd).
Title: Re: Is it possible for ahk script to detect which rom is loaded ?
Post by: Connorsdad on May 27, 2013, 01:20:46 pm
Come again lol

As I said, total noob here, baby steps please :)