Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

Close Previous MPV Instances

Description
Since MPV is decidedly difficult about this, I made and tested this little script specifically for it and it's much easier than pipe workarounds to get a single MPV instance. Only needs the trigger to target MPV once per window and run this.
Language
C#.net
Minimum Version
Created By
Jayde Ver Elst58609
Contributors
-
Date Created
1d ago
Date Last Modified
1d ago

Scripted Function (Macro) Code

using System;
using System.Collections.Generic;

public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        IntPtr[] handles = BFS.Window.GetVisibleAndMinimizedWindowHandles();

        foreach (IntPtr win in handles)
        {
            // Skip the newly created window
            if (win == windowHandle)
                continue;

            // Get process ID for this window
            uint pid = BFS.Application.GetAppIDByWindow(win);

            // Get the filename for that process
            string exe = BFS.Application.GetMainFileByAppID(pid);

            if (exe != null && exe.ToLower().EndsWith("mpv.exe"))
            {
                // Close the old mpv window
                BFS.Window.Close(win);
            }
        }
    }
}