So how to fix the script? Also if I made more mistakes or if somethings should be done in another way, plz feel free to comment. Cheers.
Code: Select all
#SingleInstance, Off ; Allow multiple instances
#Persistent
#Warn
mpc_filepath:="D:\mpc-be64\mpc-be64.exe"
mpc_args:="/play /randomize /new M:\Movies /new V:\Videos"
Run, %mpc_filepath% " . " %mpc_args%,,UseErrorLevel,pid
if (ErrorLevel)
MsgBox,0x10, Error, Video Player could not be launched.
SetTimer, CheckPlayerRunning, 200
Return ;------------------------------ auto-exec region -----------------------------------------------------
#IfWinActive, ahk_exe mpc-be64.exe
~MButton::
while (GetKeyState("MButton", "P")) {
SendInput, {Right}
Sleep, 50
}
return
#IfWinActive
~ESC:: ; Close Process & Exit Script
Loop
{
Process, Exist, mpc-be64.exe
if ErrorLevel
Process, Close, mpc-be64.exe
else
ExitApp
}
return
; Activate Window
CheckPlayerRunning:
Process, Exist, mpc-be64.exe
If !ErrorLevel
ExitApp
else
{
MouseGetPos, , , id, control
WinGetClass, class, ahk_id %id%
if (class = "MPC-BE")
WinActivate, ahk_id %id%
}
return