Jump to content
LaunchBox Community Forums

Trying to launch MAME from AHK file?


Johnny T
Go to solution Solved by JoeViking245,

Recommended Posts

Hi all

I'm trying to launch ChaseHQ from an AHK file so that I can have MameHooker running instead of LEDBlinky.

I've tried lots of different variants but I'm getting nowhere and wondered if someone could help?

Here's where I'm up to...

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force

SetWorkingDir, "D:\LaunchBox Arcade\Emulators\MAME\MAME Arcade"  ;where mame is located. Note: No "\" after "Mame".
MAMERun = mame.exe
GameRDP = "D:\LaunchBox Arcade\Games\Arcade\chasehq.zip"  ;Path and Machine (rom) folder

Process,Close,LEDBlinky.exe
Run,taskkill /im "LEDBlinky.exe" /F
Sleep 2500
Process,Close,mamehook.exe
Run,taskkill /im "mamehook.exe" /F
Sleep 2500
Run, "D:\LaunchBox Arcade\Emulators\MameHooker\mamehooker5.1\mamehook.exe"
Sleep 2500
Run, %MAMERun% -"D:\LaunchBox Arcade\Games\Arcade\chasehq.zip", , Hide


Escape::
    Process,Close,mamehook.exe
    Run,taskkill /im "mamehook.exe" /F
    Sleep 300
    Process,Close,mame.exe
    Run,taskkill /im "mame.exe" /F
WinClose, ahk_exe mame.exe
    Sleep 300
    Run, "D:\LaunchBox Arcade\LEDBlinky\LEDBlinky.exe"
return

 

I just get an error when it comes to launching MAME ?

Link to comment
Share on other sites

  • Solution
39 minutes ago, Johnny T said:

I just get an error when it comes to launching MAME ?

You have an extra - (dash) right before the "path\to\ROM.zip".  Remove it.

Run, %MAMERun% -"D:\LaunchBox Arcade\Games\Arcade\chasehq.zip", , Hide

Run, %MAMERun% "D:\LaunchBox Arcade\Games\Arcade\chasehq.zip", , Hide

;  OR

Run, %MAMERun% "%GameRDP%", , Hide

 

Link to comment
Share on other sites

Thanks @JoeViking245 you cracked it!

I thought I still had an error but with a bit more experimentation it's now working.

You were right with your fix but I also had an issue with quotation marks around the SetWorkingDir variable that I didn't need.

So my full script is now:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force

SetWorkingDir, D:\LaunchBox Arcade\Emulators\MAME\MAME Arcade  ;where mame is located. Note: No "\" after "Mame".
MAMERun = mame.exe
GameRDP = D:\LaunchBox Arcade\Games\Arcade\chasehq.zip  ;Path and Machine (rom) folder

Process,Close,LEDBlinky.exe
Run,taskkill /im "LEDBlinky.exe" /F
Sleep 2500
Process,Close,mamehook.exe
Run,taskkill /im "mamehook.exe" /F
Sleep 2500
Run, "D:\LaunchBox Arcade\Emulators\MameHooker\mamehooker5.1\mamehook.exe"
Sleep 2500
Run, %MAMERun% "%GameRDP%", , Hide


Escape::
    Process,Close,mamehook.exe
    Run,taskkill /im "mamehook.exe" /F
    Sleep 300
    Process,Close,mame.exe
    Run,taskkill /im "mame.exe" /F
WinClose, ahk_exe mame.exe
    Sleep 300
    Run, "D:\LaunchBox Arcade\LEDBlinky\LEDBlinky.exe"
return

 

This is working perfectly - thanks very much for your help! :)  Let's go Mr Driver.........

 

 

Edited by Johnny T
  • Game On 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...