Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Is it possible for ahk script to detect which rom is loaded ?  (Read 3247 times)

0 Members and 1 Guest are viewing this topic.

Connorsdad

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 268
  • Last login:May 18, 2024, 04:28:42 pm
  • I want to build my own arcade controls!
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.
    

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9272
  • Last login:Today at 07:12:41 am
  • ...
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #1 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
Of course you'd be using if "%1" == romname goto whatever


Connorsdad

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 268
  • Last login:May 18, 2024, 04:28:42 pm
  • I want to build my own arcade controls!
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #2 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.
    

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9272
  • Last login:Today at 07:12:41 am
  • ...
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #3 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

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #4 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?

Connorsdad

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 268
  • Last login:May 18, 2024, 04:28:42 pm
  • I want to build my own arcade controls!
Re: Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #5 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?
    

Connorsdad

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 268
  • Last login:May 18, 2024, 04:28:42 pm
  • I want to build my own arcade controls!
Re: Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #6 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 :)
    

Connorsdad

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 268
  • Last login:May 18, 2024, 04:28:42 pm
  • I want to build my own arcade controls!
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #7 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.
    

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9272
  • Last login:Today at 07:12:41 am
  • ...
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #8 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.

Connorsdad

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 268
  • Last login:May 18, 2024, 04:28:42 pm
  • I want to build my own arcade controls!
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #9 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.
    

Connorsdad

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 268
  • Last login:May 18, 2024, 04:28:42 pm
  • I want to build my own arcade controls!
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #10 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.
    

Connorsdad

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 268
  • Last login:May 18, 2024, 04:28:42 pm
  • I want to build my own arcade controls!
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #11 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.
    

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #12 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.
« Last Edit: May 27, 2013, 12:23:19 pm by headkaze »

Connorsdad

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 268
  • Last login:May 18, 2024, 04:28:42 pm
  • I want to build my own arcade controls!
Re: Is it possible for ahk script to detect which rom is loaded ?
« Reply #13 on: May 27, 2013, 01:20:46 pm »
Come again lol

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