Build Your Own Arcade Controls Forum

Front End Support => MaLa Frontend => Topic started by: Hitek on February 14, 2013, 03:52:35 am

Title: Autohotkey, Mala, and NullDC
Post by: Hitek on February 14, 2013, 03:52:35 am
Howdy yall,
I'm finally getting around to getting NullDC set up on my arcade cab, and I have all setup the way I want it, except getting it to exit properly.
I have autohotkey loaded with a small script, which I assumed would look for the NullDC process, and if it was present when the ESC key was pressed, it would kill the process and return to Mala. This all works perfectly fine, but now, that is the ONLY thing the ESC key works for. It seems that Autohotkey's default action is to take over a key completely.
I don't want autohotkey to take over control of the ESC key, I just want it to listen for it, and if NullDC happens to be up when it's pressed, kill the NullDC process.
Is there any way to accomplish this with autohotkey? If not, How do you guys exit NullDC?

Here's my script for reference:
Code: [Select]
ESC::
Process, Exist, nullDC_Win32_Release-NoTrace.exe
{
If ErrorLevel
{
process, Close, nullDC_Win32_Release-NoTrace.exe
}
}

Thanks,
Keith
Title: Re: Autohotkey, Mala, and NullDC
Post by: Celsius on February 14, 2013, 06:36:26 am
you should probably use the ifwinactive command, so the exit function is only used when nulldc is open
http://www.autohotkey.com/docs/commands/_IfWinActive.htm (http://www.autohotkey.com/docs/commands/_IfWinActive.htm)
Title: Re: Autohotkey, Mala, and NullDC
Post by: BadMouth on February 14, 2013, 09:12:09 am
Haven't tested this, but off the top of my head-

Pre Command in Mala:
Code: [Select]
cmd /c start "" "C:\nulldc.ahk"(specify full path to your autohotkey script)

AutoHotKey script:

Code: [Select]
ESC::
Process, Close, nullDC_Win32_Release-NoTrace.exe

ExitApp
Return

The script should start when Mala launches the NullDC game and terminate when you press ESC.
Title: Re: Autohotkey, Mala, and NullDC
Post by: Hitek on February 14, 2013, 05:16:04 pm
you should probably use the ifwinactive command, so the exit function is only used when nulldc is open
http://www.autohotkey.com/docs/commands/_IfWinActive.htm (http://www.autohotkey.com/docs/commands/_IfWinActive.htm)
That's what the "Process, Exists" does, it only executes the exit function if NullDC is running, and that works, the problem is that while it's listening for the ESC key, no other app can use the ESC key, including Mala.

I believe Badmouth has the right Idea though, instead of having ahk running all the time, i just need to start and stop it with NullDC. I'll try that this evening and see how it works out.

Thanks yall,
Keith
Title: Re: Autohotkey, Mala, and NullDC
Post by: Hitek on February 14, 2013, 10:37:59 pm
Yep, BadMouth's suggestion works like a charm, thanks!

Keith
Title: Re: Autohotkey, Mala, and NullDC
Post by: Celsius on February 15, 2013, 02:43:18 am
got 1 ahk script for everything running in the background and in 1 game esc just works as an esc key and in the other as quit/close
Title: Re: Autohotkey, Mala, and NullDC
Post by: BadMouth on February 15, 2013, 09:43:56 am
Yep, BadMouth's suggestion works like a charm, thanks!

Keith

Credit for the pre-command goes to DrVenture & Wade007.
I lifted it from a thread where they worked it out  :)