Jump to content

WinExists


Recommended Posts

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

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
 Share

  • Recently Browsing   0 members

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