Jump to content

Recommended Posts

Posted

i want to check if mpc windows is running file 1.mp3 or not

 

the following code will check if any window named 1.mp3

 

if WinExists("1.mp3","")

how can i make it check for 1.mp3 and for class "MediaPlayerClassicW"

so it must be mpc playing 1.mp3 not any windows named 1.mp3

 

any ideas ?

Posted

The WinExists in this example ends up the same WinExists as Andreik's example of post #2.

Local $sMp3File = "C:\Full Path\and\File Name.mp3" ; <--- Put MP3 file here

If FileExists($sMp3File) Then
    $sExec = RegRead("HKEY_CURRENT_USER\Software\MPC-HC\MPC-HC", "ExePath") ; Get full path and file name of the executable, "mpc-hc[64].exe".
    ShellExecute($sExec, '"' & $sMp3File & '" /play', '"' & StringRegExpReplace($sExec, "\\[^\\]*$", "") & '"') ; 3rd parameter - RE returns working directory path only.
    Sleep(1000)
    If WinExists("[TITLE:" & StringRegExpReplace($sMp3File, "^.*\\", "") & "; CLASS:MediaPlayerClassicW;]") Then ; RE returns FileName.mp3 only (no path)
        MsgBox(0, "", '"' & $sMp3File & '" is being played by MediaPlayerClassic.')
    EndIf
EndIf

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...