EDIT: See v5 script in post #17 or even later versions in this thread.
This version 3 script didn't run on all machines.
Original Post:
Tabbified, 80col, added comments to script statements
;; ****************************************************************************
;; AHK Script For Showing / Hiding TotalMixFX and RME Driver Settings Dialog
;; RME User Forum - v2 by Potscrubber (author) 12.10.2016
;; - v3 by ramses, cosmetics, document vars&statements
;; See: https://www.forum.rme-audio.de/viewtopic.php?id=24322
;; ****************************************************************************
#NoEnv ; performance and stability
SendMode Input ; for better speed and reliability
SetWorkingDir %A_ScriptDir% ; ensures consistent start directory
DetectHiddenWindows, Off ; default: Off
#SingleInstance force ; replaces old instance of program automatically
SetTitleMatchMode, 2 ; 2: window title can contain WinTitle anywhere
; set the actual hotkeys here
TotalMixKey = F1
DriverSettingsKey = !F1 ; Alt-F1
; driver variables - 5 sets for 5 common RME drivers - uncomment yours
; driver USB
; SettingsWin := "Fireface USB Settings"
; SettingsExe := "firefaceusb.exe"
; driver HDSPe
; SettingsWin := "Hammerfall DSP Settings"
; SettingsExe := "hdsp32.exe"
; driver USB_XT
; SettingsWin := "MADIface USB Settings"
; SettingsExe := "madifaceusb.exe"
; driver UFX+
SettingsWin := "MADIface Series Settings"
SettingsExe := "madifaceusb.exe"
; driver HDSPe_XT
; SettingsWin := "HDSPe FX Settings"
; SettingsExe := "hdspe_fx.exe"
; some other variable definitions
SysPath = C:\WINDOWS\System32
TotalMixWin := "RME TotalMix FX ahk_exe TotalMixFX.exe"
TotalMixExe := "TotalMixFX.exe"
; hotkey definitions
Hotkey, %TotalMixKey%, TotalMixKey ; launch/hide TotalMixFX
Hotkey, %DriverSettingsKey%, DriverSettingsKey ; launch/hide driver settings
return ;; END auto exec
;; ****************************************************************************
;; RME Devices Hotkeys
;; ****************************************************************************
TotalMixKey:
IfWinExist, %TotalMixWin%
{
; if minimized then restore.
WinGet, winState, MinMax, %TotalMixWin%
if (winState = -1)
{
WinRestore, %TotalMixWin%
return
}
; else close the window
WinClose, %TotalMixWin%
return
}
IfWinNotExist, %TotalMixWin%
{
Process, Exist, %TotalMixExe%
if not Errorlevel
{
Run, %SysPath%\%TotalMixExe%,, UseErrorLevel
if ErrorLevel = ERROR
{
MsgBox, 48,, Totalmix exe could not be launched!
return
}
; have to run again to create window first time
Sleep, 1000
Run, %SysPath%\%TotalMixExe%
}
else
{
WinShow, %TotalMixWin%
WinActivate, %TotalMixWin%
return
}
}
return
DriverSettingsKey:
IfWinExist, %SettingsWin%
{
WinClose, %SettingsWin%
return
}
IfWinNotExist, %SettingsWin%
{
Process, Exist, %SettingsExe%
if not Errorlevel
{
Run, %SysPath%\%SettingsExe%,, UseErrorLevel
if ErrorLevel = ERROR
{
MsgBox, 48,, Driver settings exe could not be launched!
return
}
; have to run again to create window first time
Sleep, 1000
Run, %SysPath%\%SettingsExe%
return
}
else
{
Run, %SysPath%\%SettingsExe%
return
}
}
return
BR Ramses - UFX III, 12Mic, XTC, M-1620 Pro D, RayDAT, ADI-2 Pro FS R BE, X10SRi-F, E5-1680v4, Win10