;SendMode Input MyRun("C:\Program Files\iTunes\iTunes.exe", "iTunes.exe") SetTitleMatchMode, 3 ; 1=starts-with, 2=contains, 3=exact-match-full-title WinWaitActive, ahk_class iTunes,,60 WinActivate, ahk_class iTunes sleep,2000 IfWinNotActive, ahk_class iTunes { MsgBox, Could not activate iTunes. Exiting... ExitApp } Sleep,1000 Send, !f Sleep, 750 send, y ; Since keystroke stuffing is un-reliable, try again after a second. Sleep,1000 Send, !f Sleep, 750 send, y return ;********************************************************************************** MyRun(cmdline, processname) { ;Msgbox, %cmdline% Process, Exist, %processname% if ErrorLevel { ;Run, K:\bin\growlnotify.exe /t:"Skipping process" "%processname% is already running." Sleep, 300 ; need a little delay because multiple concurrent growlnotify can crash growlnotify } else { Run, %cmdline% ;Run, K:\bin\growlnotify.exe /t:"Started process" "%processname%" } }