Alexxander

WinExists

4 posts in this topic

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 ?


Share this post


Link to post
Share on other sites



WinExists("[TITLE:1.mp3; CLASS:MediaPlayerClassicW;]")

 

1 person likes this

When the words fail... music speaks

Share this post


Link to post
Share on other sites

Thanks bro ..


Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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