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 (exit) for SUperModel 3  (Read 6197 times)

0 Members and 1 Guest are viewing this topic.

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
AHK (exit) for SUperModel 3
« on: October 06, 2017, 03:23:54 pm »
ive been trying some things but i cant seem to figure out how to make Supermodel exit with a different input than the Esc button within Hyperspin

if anyone has managed it to make it work or have an supermodel ahk file or command for hyperspin that would be alot of help since i have an x-arcade

brad808

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 818
  • Last login:May 22, 2023, 08:18:15 pm
Re: AHK (exit) for SUperModel 3
« Reply #1 on: October 06, 2017, 05:08:40 pm »
When in doubt alt+f4 or key command that equates to alt f4.

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
Re: AHK (exit) for SUperModel 3
« Reply #2 on: October 06, 2017, 08:50:12 pm »
hmmm i tried to remap the esc button to key 4 ,did that with ahk didnt work
 
tried to set it esc :: alt + F4 but ahk doesnt recognize command

im not that good with it , maybe some one has a layout with all the right commands

DrakeTungsten

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:August 14, 2022, 06:36:45 pm
  • I effed with the wrong person!
    • No Quarter - a basic FE, WIP
Re: AHK (exit) for SUperModel 3
« Reply #3 on: October 06, 2017, 09:34:24 pm »
Do this in AHK for Alt + F4

!{F4}

Obviously, with a Send or SendInput or similar in front of it.
No Quarter - a basic FE, WIP

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1004
  • Last login:Today at 08:59:43 am
Re: AHK (exit) for SUperModel 3
« Reply #4 on: October 07, 2017, 03:07:24 am »
Or the brutal way :
Code: [Select]
Esc::
Process, close, supermodel.exe

Change the name of the process according to what you need

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
Re: AHK (exit) for SUperModel 3
« Reply #5 on: October 07, 2017, 04:20:46 am »
mmm uh ok thxfor helping out first

I want to press the two flipper buttons (key 3 & 4) to quit Supermodel instead of the Esc key
if thats possible ,or one side flipper button like key 4 to quit it

how do i give that command in the supermodel ahk

i tried to play around with this ; This section closes Supermodel when pressing Escape
 
; This section closes Supermodel when pressing Escape
 $Esc::
 {
     Process, Close, {{{StartupEXE}}}
 }
Send, {ALTDOWN}{NDOWN}{ALTUP}
Process, Close, supermodel.exe
ExitAPP
return

i tried this $Esc::4   

the keymapper ahk test sees when i press Esc as a 4  but in hyperspin it does not close supermodel

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
Re: AHK (exit) for SUperModel 3
« Reply #6 on: October 08, 2017, 06:35:18 am »
anybody that managed to change the exit button for supermodel in hyperspin.

It only seems to close for me with Esc which is not on the X-Arcade

With Demul the ahk works easily , only Supermodel is feisty :banghead:

DrakeTungsten

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:August 14, 2022, 06:36:45 pm
  • I effed with the wrong person!
    • No Quarter - a basic FE, WIP
Re: AHK (exit) for SUperModel 3
« Reply #7 on: October 08, 2017, 12:07:16 pm »
My AHK is rusty, bit unless a guru chimes in, I can help a bit...

I don't follow all of your code. I'm not sure why any of the braces are there. None of them seem necessary.  But if all the lines of code are being processed, then I guess it's OK, so don't remove them on my say-so. The one thing I know for sure you're doing wrong is your mapping of "$Esc::4". This means to send the character "4" to the program which has input focus. This is not what you asked to do. Based on what you asked for, "$Esc" should not show up anywhere in the code. You want to map the key "4" to the code which exits the emulator, so what you should have done is replace "$Esc" with "4". So again, assuming the rest of the code is fine, substitute the line "$Esc::" with the line "4::"
« Last Edit: October 08, 2017, 12:09:35 pm by DrakeTungsten »
No Quarter - a basic FE, WIP

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
Re: AHK (exit) for SUperModel 3
« Reply #8 on: October 08, 2017, 04:21:39 pm »
 i tried that but it doesnt respond , but only Esc works

i tried a bunch of things like    4::send !{F4} 

Supermodel has that Esc button Locked down  :badmood:   


DrakeTungsten

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:August 14, 2022, 06:36:45 pm
  • I effed with the wrong person!
    • No Quarter - a basic FE, WIP
Re: AHK (exit) for SUperModel 3
« Reply #9 on: October 08, 2017, 05:42:55 pm »
argonlefou's method works for me.

Hyperspin doesn't appear to be the problem of Alt-F4 not being recognized. That appears to be an issue with Supermodel (it is not unheard-of for some programs to not work with AHK input shenanigans) I tried supermodel, and couldn't get it to close either by sending alt-F4 when "4" is pressed. Using argonlefouou's method, however, did close Supermodel. I didn't use Hyperspin, I just ran supermodel from the command line after loading an AHK script that simply consisted of

Code: [Select]
4::
Process, close, Supermodel.exe
ExitApp

I see you already have a "process, close, supermodel.exe" line, but are you sure it's getting there? It's outside a block you defined with some braces. I don't know if that's valid AHK or whether it's some kind of HS extension.
« Last Edit: October 08, 2017, 05:46:59 pm by DrakeTungsten »
No Quarter - a basic FE, WIP

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
Re: AHK (exit) for SUperModel 3
« Reply #10 on: October 09, 2017, 12:49:57 am »
 OK , i tried the code but it didnt work

if i run it from the commandline maybe then itll work to first remap the key in supermodel itself then it will also work in hyperspin

how do i that ?

R083RT0

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:June 22, 2023, 01:09:46 pm
    • my videos
Re: AHK (exit) for SUperModel 3
« Reply #11 on: October 09, 2017, 08:15:59 am »
'press key 3 & key 4 to exit Supermodel'

4::
if not GetKeyState("3","P")
return
Winclose, Supermodel
sleep, 1000
exitapp

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
Re: AHK (exit) for SUperModel 3
« Reply #12 on: October 09, 2017, 08:42:10 am »
; press key 3 & key 4 to exit Supermodel

4::
if not GetKeyState("3","P")
return
Winclose, Supermodel
sleep, 1000
exitapp

this works if i run Supermodel without Hyperspin & ahk is running

when i put this code into hyperspin keymapper it doesnt work



how can i point the ahk to run when Supermodel is functioning in hyperspin
« Last Edit: October 09, 2017, 09:27:24 am by Moksi »

R083RT0

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:June 22, 2023, 01:09:46 pm
    • my videos
Re: AHK (exit) for SUperModel 3
« Reply #13 on: October 09, 2017, 09:53:36 am »
i don't have hyperspin, can you show (or attach) the supermodel part ahk script from hyperspin?

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
Re: AHK (exit) for SUperModel 3
« Reply #14 on: October 09, 2017, 10:23:38 am »
i used that same code you posted in hyperspin but that doesnt work

i did something else i made a ahk and used your code and placed it in the windows Startup folder so it starts when win starts
& then it worked for me in HyperSpin.

But only if the ahk is running in the systray , if you use it one time it automatically closes the ahk.

So if this ahk just keeps running i should have no problem to close it with any keys , how can i keep the ahk running constant in the systray

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
Re: AHK (exit) for SUperModel 3
« Reply #15 on: October 09, 2017, 12:01:36 pm »
; press key 3 & key 4 to exit Supermodel

4::
if not GetKeyState("3","P")
return
Winclose, Supermodel
sleep, 1000
return


works with making the ahk yourself & put it in the windows Startup folder

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
Re: AHK (exit) for SUperModel 3
« Reply #16 on: October 09, 2017, 02:08:03 pm »
with this enabled now i have another little problem.
 
with this script running all the time i cant press 4 because the script has it locked

possible i can give a command to active the script when hyperspin is started en stop the script when hyperspin is closed.

and how to type that command to the script i use


R083RT0

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:June 22, 2023, 01:09:46 pm
    • my videos
Re: AHK (exit) for SUperModel 3
« Reply #17 on: October 09, 2017, 05:13:56 pm »
better script....

~3 & 4::
Winclose, Supermodel
sleep, 1000
return

DrakeTungsten

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:August 14, 2022, 06:36:45 pm
  • I effed with the wrong person!
    • No Quarter - a basic FE, WIP
Re: AHK (exit) for SUperModel 3
« Reply #18 on: October 09, 2017, 09:08:21 pm »
The #IfWin family of directives is what you want to use to have a hotkey in effect only when a certain program is running (#IfWinExist), or has focus (#IfWinActive)

https://autohotkey.com/docs/commands/_IfWinActive.htm

I tested this with Supermodel and it works (if I switch to Notepad, even with Supermodel running, I can type a "4". If I hit "4" on the Supermodel Window, then Supermodel exits)
Code: [Select]
#IfWinActive, Supermodel
4::
Winclose, Supermodel
sleep, 1000
return
I assume this would also work with Roberto's "~3 & 4::" substitution. You probably do want this only in effect when Supermodel is running instead of basing the hotkey on Hyperspin, unless Supermodel is the only emulator you are going to use from Hyperspin. If for some reason you do prefer to use Hyperspin as the program for AHK to look for, then you would have to use the #IfWinExist directive instead of #IfWinActive.

BTW, why the "sleep"?
No Quarter - a basic FE, WIP

Moksi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 194
  • Last login:March 18, 2024, 09:10:04 am
  • I want to build my own arcade controls!
Re: AHK (exit) for SUperModel 3
« Reply #19 on: October 10, 2017, 07:00:07 am »
yes  :applaud: it works perfectly now. 

thanks for the help!