Alexxander Posted August 22, 2015 Share Posted August 22, 2015 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 ? Link to comment Share on other sites More sharing options...
Andreik Posted August 22, 2015 Share Posted August 22, 2015 WinExists("[TITLE:1.mp3; CLASS:MediaPlayerClassicW;]") Alexxander 1 Link to comment Share on other sites More sharing options...
Alexxander Posted August 22, 2015 Author Share Posted August 22, 2015 Thanks bro .. Link to comment Share on other sites More sharing options...
Malkey Posted August 22, 2015 Share Posted August 22, 2015 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now