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: AHK help needed for monitor rotation fail safe  (Read 2555 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!
AHK help needed for monitor rotation fail safe
« on: December 01, 2013, 06:26:47 am »
I want to add a script that will stop my monitor from rotating when a key is pressed, just in case my micro switches fail. I think the coin buttons would be a good idea as they are on the front of my cp and I could press them in a millisecond if things went wrong. What I have so far, please go easy as I am a complete noob re ahk.

Code: [Select]
5::
run smccmd --resume --speed 0,,Hide
send {5 down}{5 up}
return



6::
run smccmd --resume --speed 0,,Hide
send {6 down}{6 up}
return

I think that the {key down}{key up} is telling the script to restart instead of doing what I want which is pressing 5 to insert a coin, as in 5::5. Any help is much appreciated.
    

lemonflavoured

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 22
  • Last login:January 18, 2014, 11:57:28 am
  • I want to build my own arcade controls!
Re: AHK help needed for monitor rotation fail safe
« Reply #1 on: December 01, 2013, 06:34:49 am »
I'm quite new to AHK but the following might work?

5::
run, smccmd --stop, Hide
send, {5 down}
Send, {5 up}
return



6::
run, smccmd --stop, Hide
send, {6 down}
send, {6 up}
return

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: AHK help needed for monitor rotation fail safe
« Reply #2 on: December 01, 2013, 08:02:08 am »


Code: [Select]
5::
run smccmd --resume --speed 0,,Hide
send, {5 down}
Send, {5 up}
return



6::
run smccmd --resume --speed 0,,Hide
send, {6 down}
send, {6 up}
return

Thanks but that didn't work either
    

lemonflavoured

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 22
  • Last login:January 18, 2014, 11:57:28 am
  • I want to build my own arcade controls!
Re: AHK help needed for monitor rotation fail safe
« Reply #3 on: December 01, 2013, 08:33:29 am »
Oh bugger. Hmm.

How about SendInput, {6 down}{6 up}? Is the motor stopping part of the code working but it's not sending the keystrokes? As i understand it you're wanting the keys 5 and 6 to be kind of "pass through" keys, you press them and want them to function normally but you also want them to send the motor stop command?

Also, are you the awesome guy who does a lot of charity work for your son? I follow your builds on OCuK.

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: AHK help needed for monitor rotation fail safe
« Reply #4 on: December 01, 2013, 10:24:38 am »
Thats correct I do want them to work as pass through keys :)

Awesome guy yes ;)
But not the one from OCuK.
    

lemonflavoured

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 22
  • Last login:January 18, 2014, 11:57:28 am
  • I want to build my own arcade controls!
Re: AHK help needed for monitor rotation fail safe
« Reply #5 on: December 01, 2013, 10:35:15 am »
I've worked it out. The script is kind of getting into an endless loop.

What's happening is you are monitoring key 5. When you press 5, the script also presses 5. When 5 is pressed, the script presses 5 again.

Hope this helps, you may need to rebind some keys!

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: AHK help needed for monitor rotation fail safe
« Reply #6 on: December 01, 2013, 11:44:21 am »
I know but I don't how to alter the script to get it to do what I want.

Sent from my SM-N9005 using Tapatalk

    

lemonflavoured

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 22
  • Last login:January 18, 2014, 11:57:28 am
  • I want to build my own arcade controls!
Re: AHK help needed for monitor rotation fail safe
« Reply #7 on: December 01, 2013, 11:54:06 am »
in MAME bind coin1 and coin2 to something else, e.g N and M

5::
run smccmd --resume --speed 0,,Hide
send, {N down}
Send, {N up}
return



6::
run smccmd --resume --speed 0,,Hide
send, {M down}
send, {M up}
return

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: AHK help needed for monitor rotation fail safe
« Reply #8 on: December 01, 2013, 03:36:54 pm »
I have 5 and 6 set for quite a few emulators, would be a mare to change. I'll sort it one way :)

Sent from my SM-N9005 using Tapatalk

    

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: AHK help needed for monitor rotation fail safe
« Reply #9 on: December 01, 2013, 03:39:02 pm »
But I could change the ipac config to something else then send 5 and 6. Hmmmmm

Sent from my SM-N9005 using Tapatalk

    

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: AHK help needed for monitor rotation fail safe
« Reply #10 on: December 02, 2013, 01:55:18 pm »
Sussed it :)

From the AutoHotKey help:
"($) This is usually only necessary if the script uses the Send command to send the keys that comprise the hotkey itself, which might otherwise cause it to trigger itself."

Code: [Select]
$5::
run smccmd --resume --speed 0,,Hide
send, {5 down}
Send, {5 up}
return



$6::
run smccmd --resume --speed 0,,Hide
send, {6 down}
send, {6 up}
return
    

lemonflavoured

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 22
  • Last login:January 18, 2014, 11:57:28 am
  • I want to build my own arcade controls!
Re: AHK help needed for monitor rotation fail safe
« Reply #11 on: December 02, 2013, 02:20:06 pm »
Wahey, ahk is awesome. Just like you are. You got a cabinet build log out anything? Also, what motor do you use? I have a rotating set up too and now you've got me all paranoid

Sent from my GT-I9505G using Tapatalk


lemonflavoured

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 22
  • Last login:January 18, 2014, 11:57:28 am
  • I want to build my own arcade controls!
Re: AHK help needed for monitor rotation fail safe
« Reply #12 on: December 02, 2013, 02:39:54 pm »
Just seen your WIP pictures, wow. I loved griff's Marvel vs Capcom Revolution and wanted to replicate it myself, alas my small house ended up being the limiting factor. I ended up going for a much smaller foot print build. Do you have the MAME auto-rotation scripts sorted? i wrote a number of things you might find useful: A marquee changing script and i made my own auto-rotation script as the one i was using was a bit buggy (for instance, it would rotate Mortal Kombat) as it used a string comparison, e.g the romname for mortal kombat is MK so it checked a large file for "MK" and if it found it, it rotates.

is a video showing the marquee stuff.

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: AHK help needed for monitor rotation fail safe
« Reply #13 on: December 02, 2013, 06:13:30 pm »
Loving the marquee monitor :)

I'm good for scripts thanks, I too have various scripts I made specifically for the different emulators I run. I also use the Mame rotation script from this forum which is great.

Sent from my SM-N9005 using Tapatalk

    

lemonflavoured

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 22
  • Last login:January 18, 2014, 11:57:28 am
  • I want to build my own arcade controls!
Re: AHK help needed for monitor rotation fail safe
« Reply #14 on: December 03, 2013, 10:17:45 am »
I think i tried the one from this forum which had the bug i mentioned in it. Is it a rotation.exe with a rotation.ini? rotation.ini has like set2_vertical= in it?

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: AHK help needed for monitor rotation fail safe
« Reply #15 on: December 03, 2013, 11:10:16 am »
The one I used was created by DNA Dan and resident AHK guru, nitz. There's no bug, read from this post on to see what you need to add;
http://forum.arcadecontrols.com/index.php/topic,110471.msg1234270.html#msg1234270
    

lemonflavoured

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 22
  • Last login:January 18, 2014, 11:57:28 am
  • I want to build my own arcade controls!
Re: AHK help needed for monitor rotation fail safe
« Reply #16 on: December 03, 2013, 11:26:49 am »
Ahh yeah, i never saw the lines to "fix" the certain roms. Anyhow, here's my version if you are interested. Doesn't use any work arounds. And here's the INI file:
http://pastebin.com/KAgJz3xK

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

IniRead, RotcurrState, Rotation.ini, defaults, defrotate

IniRead, RotState, Rotation.ini, %1%, Rotate

   
if (RotState = 1) {
iniwrite, 1, Rotation.ini, defaults, defrotate
; Run, irotate.exe /rotate=90
ExitApp
}
Else {
if (RotcurrState = 1) {
; Run, irotate.exe /rotate=90
iniwrite, 0, Rotation.ini, defaults, defrotate
}
ExitApp
}

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: AHK help needed for monitor rotation fail safe
« Reply #17 on: December 19, 2013, 05:53:22 am »
Sussed it :)

From the AutoHotKey help:
"($) This is usually only necessary if the script uses the Send command to send the keys that comprise the hotkey itself, which might otherwise cause it to trigger itself."

Code: [Select]
$5::
run smccmd --resume --speed 0,,Hide
send, {5 down}
Send, {5 up}
return



$6::
run smccmd --resume --speed 0,,Hide
send, {6 down}
send, {6 up}
return

Works fine with everything bar mame, coin buttons no longer register for certain games :(