You'll need Autohotkey and USbdeview. Put USBdeviw in the same directory as the script (or adapt the script). Before you change the devicenames in the script run USBdeview to get the names of the devices.
So here's the commented script (save as .ahk)
Code: Select all
RunWait, usbdeview.exe /stext usbdeviewlog.txt /DisplayDisconnected 0 /sort "~connected",,hide ;Writes connected USB-devices to a file (The 'sort' command is probably obsolete)
FileRead, USBDevices, usbdeviewlog.txt ;Writes the file to a variable
IfInString, USBDevices, Launchpad ;Checks the variable if a certain device is connected
{
IfWinNotExist, ahk_exe MTPlayer.exe ;Checks if the program is already running
{
Run, MTPlayer.exe, C:\Program Files (x86)\MT Player [nativeKONTROL]\, Hide ;Runs the program associated to the device
}
}
IfNotInString, USBDevices, microkontrol ;Checks if another device is connected
MsgBox, 0, Check for Keyboard, microKontrol not connected!`rAbleton Live starts in 10 seconds..., 10 ;Displays a Messagebox lasting 10 seconds if the device is not connected
IfWinNotExist, ahk_exe Ableton Live 8.exe ; Checks if the program is already running
{
Run, Ableton Live 8.exe, C:\ProgramData\Ableton\Live 8\Program\ ; Runs the program
}