this worked for me, chillinwater at the hyperspin forum provided it, just make sure the directory matches where you have cpwizard.exe
else if (systemName = "MAME" && executable = "mame.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
Run, "I:\Program Files (x86)\CPWizard\CPWizard.exe" -emu "%systemName%" -game "%romName%" -timeout 9000
sleep, 8000
Gui +AlwaysOnTop -Caption +ToolWindow
Gui, color, 0
Gui Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%,
Runwait, %executable% %romName%, %EmuPath%, Hide UseErrorLevel
sleep,1000
gui destroy
Process, WaitClose, %executable%
WinActivate, HyperSpin
exitapp
}