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
Site News

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


  

Author Topic: AHK for Coin Input  (Read 324 times)

0 Members and 1 Guest are viewing this topic.

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 59
  • I want to build my own arcade controls!
AHK for Coin Input
« on: November 28, 2017, 12:10:09 pm »
Hello again,

I hope you guys can help me out with putting together a good Ahk for Coin Input.
Im preparing to add a coin mech.
With the X- Arcade only way to a add an extra button is the unused middle mouse button, since i want to credit button hidden example when guests come over

how do i make an ahk   -> exmple  middle mouse button = 5      i want it only active when Hyperspin is enabled so i can use the middle mouse button normally when hyperspin isnt active

randjamal

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 14
Re: AHK for Coin Input
« Reply #1 on: November 28, 2017, 12:54:29 pm »
Something like this:

Code: [Select]
#IfWinActive ahk_class hyperspin
MButton::
Send, 5

You'll need to replace "hyperspin" with the ahk_class for the hyperspin program (right click on the ahk tray icon and select "window spy")

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 59
  • I want to build my own arcade controls!
Re: AHK for Coin Input
« Reply #2 on: November 28, 2017, 03:04:30 pm »
Ok i tried the ahk

#IfWinActive ahk_class ThunderRT6FormDC
MButton::
Send, 5

but it doesnt work yet , what is wrong  windows spy gives me that ahk class

randjamal

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 14
Re: AHK for Coin Input
« Reply #3 on: November 28, 2017, 04:12:45 pm »
As a first step can you get it working with Notepad?

i.e.
Code: [Select]
#IfWinActive ahk_class Notepad
MButton::
Send, 5

If this works then you know the issue is with ahk's recognition of Hyperspin. If it doesn't the issue is with something else with your setup.

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 59
  • I want to build my own arcade controls!
Re: AHK for Coin Input
« Reply #4 on: November 29, 2017, 04:24:55 am »
yes the test ahk works
so like you said the issue is with ahk's recognition of Hyperspin

If the ahk works in Only HyperSpin , will the function middle mouse::5 also work with Mame , Sega Model etc. 
Or will it work with the ahk class from HyperSpin

i typed in the exact ahk_class displayed with Windows Spy, why doesnt it work?
« Last Edit: November 29, 2017, 04:25:44 pm by Moksi »

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 59
  • I want to build my own arcade controls!
Re: AHK for Coin Input
« Reply #5 on: November 30, 2017, 09:24:40 am »
Also just an Ahk with MButton::Send, 5 

doesnt work with hyperspin its like it only works in windows

randjamal

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 14
Re: AHK for Coin Input
« Reply #6 on: November 30, 2017, 04:22:16 pm »
Hmm...I don't use Hyperspin, so I can't test, but the next things i would try would be to replace send with one of the other send methods.

Code: [Select]
#IfWinActive ahk_class ThunderRT6FormDC
MButton::
Sendplay, 5
For sendplay to be effective the script needs to be run with administrative rights.

or

Code: [Select]
#IfWinActive ahk_class ThunderRT6FormDC
MButton::
Sendinput, 5

DrakeTungsten

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 135
  • Forging the furnace, for the final grand slam!
Re: AHK for Coin Input
« Reply #7 on: November 30, 2017, 10:01:10 pm »
I'm not clear what you mean by "work with Hyperspin". It sounds like you are using Hyperspin to run AHK scripts, but you actually want the hotkeys to be in effect when running an emulator launched from Hyperspin, right? More recent versions of MAME don't work with AHK, at least the pre-compiled versions don't. Possibly other emulators don't work with AHK either. If your AHK inside of HS is valid, then the problem is probably the individual emulators' compatability with AHK. I suggest running your AHK scripts and emulators without HS to investigate.

The last I checked, MAME can be compiled in such a way that AHK will work with it. There isn't a direct "work with AHK" flag, but googling MAME and AHK should point you in the right direction.

nexusmtz

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 225
Re: AHK for Coin Input
« Reply #8 on: December 01, 2017, 04:41:42 am »
There isn't a direct "work with AHK" flag, but googling MAME and AHK should point you in the right direction.

Keyboardprovider was added around v0173.
If you set keyboardprovider to dinput in mame.ini (or add -keyboardprovider dinput to the command line), code like the following will work:

Code: [Select]
MButton::
ifwinactive ahk_class MAME
{
  sendinput {5 down}
  sleep 30
  sendinput {5 up}
}
return

Note that the sleep delay may have to be adjusted, but 30 works for me.

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 59
  • I want to build my own arcade controls!
Re: AHK for Coin Input
« Reply #9 on: December 01, 2017, 06:00:51 am »
Yes it probably better to make the ahk work with Mame & the other systems.
I just want to enable the middle mouse button as key 5 when playing those systems , so that when i dont play the mouse button functons normally.

i will try everything out you guys said

WIth mame im using version 0.155

But other option i think which will save me time is buying an i-pac to connect directly to the coin mech

because i have Sega model 2 , supermodel, Sega Ring, Sega Naomi, Taito Type X so then i have to figure out each one to work with ahk if its even possible
« Last Edit: December 01, 2017, 06:18:34 am by Moksi »

  
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31