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: AutoHotKey help for emulator exiting  (Read 8259 times)

0 Members and 1 Guest are viewing this topic.

Garetmax

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 50
  • Last login:March 01, 2015, 09:17:57 pm
AutoHotKey help for emulator exiting
« on: March 21, 2011, 10:08:11 pm »
Hi,

I'd like to use AutoHotKey to shut down some of my emulators, specifically Nebula and Visual Pinball 8 and 9.

I use an X-arcade tankstick and have moved a couple buttons around and re-configured them.
I have a button mapped to ] that I want to map to Alt-F4.

I've tried closemul and it simply does not work for me as it does others.
I've tried Mala hotkeys mapping and that also does not work on these emulators.

I want a simple autohotkey script that only loads for those emulators when I'm in them and then closes when that emulator is closed.

Here's what I have in my CloseEmu.AHK file so far that I found on the web but I don't know what I'm doing.
]::Send !{f4}
ExitAPP
return

How do I get an AHK file to run in the pre and post commands sections?
  
Also, I have a windows 7 computer now, so I don't know if batch files work anymore.  I haven't tried my daphne batch files and emulator yet.  I'm still getting this computer and Mala up and running again.


Thanks,
Scott
 :)

« Last Edit: March 21, 2011, 10:17:28 pm by Garetmax »

Garetmax

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 50
  • Last login:March 01, 2015, 09:17:57 pm
Re: AutoHotKey help for emulator exiting
« Reply #1 on: April 08, 2011, 08:22:45 pm »
I tried a bunch of things but just couldn't get this type of AHK that remaps keys to work.  I'm sure others with more knowledge could get it working.

It would lauch in the precommand window and then hang there.  I'm thinking maybe there's some kind of focus issue or something.  If I try launching again a couple more times then it works.

One thing for sure is that an AHK has to be converted to an exe for Mala to run it.

I ended up trying Closemul again and it worked.  The ascii code I needed for ] is 93 so I just needed to put that in there.  I'm not sure why it didn't work the first time as I did that previously.

Also, batch files on windows don't work either.  I downloaded a little bat to exe conversion program and that works great.

Celsius

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 81
  • Last login:May 10, 2015, 11:40:41 am
    • Rcade project
Re: AutoHotKey help for emulator exiting
« Reply #2 on: April 09, 2011, 02:13:05 am »
Just use the ifwinactive command and make sure ahk to load on start(so you don't need to compile or do anything in mala), here's an example
#IfWinActive ahk_class Project64 Version 1.6
[::Escape

#IfWinActive ahk_class KegaClass
[::Send !{F4}

So you tell ahk if a certain window/app comes active, it should use the following key remaps or commands. To know the name of the app window you can use Window spy that comes with ahk. If the app doesn't have a key to exit it, you can use Send !{F4} (being alt+F4 as you already know)
Hope this helps
« Last Edit: April 09, 2011, 02:15:23 am by Celsius »

Garetmax

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 50
  • Last login:March 01, 2015, 09:17:57 pm
Re: AutoHotKey help for emulator exiting
« Reply #3 on: April 12, 2011, 10:24:32 pm »
I've got it partially working but have a problem with it.

Here's the script I've got and it loads in my startup folder as EmuExit.AHK and is running in the taskbar.

#IfWinActive ahk_class WinZincWnd
]::Escape

I'm using windows-7 32 bit and the emulator I'm trying to exit is Zinc.  For Zinc I'm using Howard Castro's wrapper cmd-launch7.exe to launch zinc and the games and that's working great.

Here's my executable:
C:\Emulators\Programs\Sony - Zinc\cmd-launch7.exe

Here's my command line:
%rom%

I'm not using any Mala hotkeys.

If I go into a game and then hit my hotkey ] it will exit to Mala and looks fine.

The problem is that none of my Zinc games launch again.  It doesn't matter if I close the script or even close and restart Mala.  I have to completely reboot my computer and turn off the autohotkey to go into the Zinc games again.


What else would I need to add to the script?


Thanks,
Scott


« Last Edit: April 12, 2011, 10:40:37 pm by Garetmax »

Wade007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 309
  • Last login:April 06, 2017, 01:33:35 pm
  • A MAME cabinet at home is heaven
    • bit.ly/1cWnoIC
    • Cheapskategamer.com
Re: AutoHotKey help for emulator exiting
« Reply #4 on: April 28, 2012, 12:34:21 pm »
By the way. I'm running a Window 7 64 bit with X-Arcade Dual tankstick and Mala.

Daphne batch files work

I'm running Nebula's Sega Model 2. I use hotkeys to Escape and go back to Mala.
Go to Other Emu Config/Options/Edit Hotkeys

Create a "Close" function/name. In the field "Source" make it grey by clicking. Then assign any X-Arcade keystroke you want to. The only trouble I'm having is trying to assign two simulataneous keystrokes to be the new ESC key. This should send you right back to Mala.
My Super Arcade cabinet project:
Software blog article: http://bit.ly/1cWnoIC

Hardware blog article: http://bit.ly/1dWxjvP

YouTube video: http://bit.ly/1N818Xm

Super Arcade Cabinet Progress thread (Now Complete):
http://forum.arcadecontrols.com/index.php/topic,123292.0.html

Frontend Video Intro: http://bit.ly/1P9HPDN

empardopo

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 526
  • Last login:Today at 03:35:47 am
    • My personal forum
Re: AutoHotKey help for emulator exiting
« Reply #5 on: May 13, 2012, 06:46:24 pm »
Hi,

I'd like to use AutoHotKey to shut down some of my emulators, specifically Nebula and Visual Pinball 8 and 9.

I use an X-arcade tankstick and have moved a couple buttons around and re-configured them.
I have a button mapped to ] that I want to map to Alt-F4.

I've tried closemul and it simply does not work for me as it does others.
I've tried Mala hotkeys mapping and that also does not work on these emulators.

I want a simple autohotkey script that only loads for those emulators when I'm in them and then closes when that emulator is closed.

Here's what I have in my CloseEmu.AHK file so far that I found on the web but I don't know what I'm doing.
]::Send !{f4}
ExitAPP
return

How do I get an AHK file to run in the pre and post commands sections?
  
Also, I have a windows 7 computer now, so I don't know if batch files work anymore.  I haven't tried my daphne batch files and emulator yet.  I'm still getting this computer and Mala up and running again.


Thanks,
Scott
 :)



Hi, you could take a look to AllInOne!

monkey puzzle

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 193
  • Last login:March 23, 2024, 02:11:59 pm
Re: AutoHotKey help for emulator exiting
« Reply #6 on: May 20, 2012, 03:10:20 am »
I was having the same problems, but got it solved here: http://forum.arcadecontrols.com/index.php?topic=118795.0