Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

Launch and Move Video File to Monitor 2

Description
This script will open the video file specified in the Path variable and move it to monitor 2.
Language
C#.net
Minimum Version
Created By
Vanavah
Contributors
-
Date Created
Dec 6, 2023
Date Last Modified
Dec 6, 2023

Scripted Function (Macro) Code

using System;
using System.Drawing;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
		
		//Enter the path to the video file here
		//string Path = "C:\\Users\\(YourUser)\\Documents\\JWMedia\\Videos";
		string Path = "C:\\Users\\vanav\\OneDrive\\Documents\\JWMedia";

		//Start the video
		BFS.Application.Start(Path, "");
		BFS.General.ThreadWait(1000);

		//Grab the window and move it to monitor 2
		
		//IntPtr mirrorWindow = BFS.DisplayFusion.MirrorWindow(windowHandle);
		//BFS.Window.MoveToMonitorMaximized(2, mirrorWindow);
		
		//Use This
		IntPtr FocusedWindow = BFS.Window.GetFocusedWindow();
		BFS.Window.MoveToMonitor(2, FocusedWindow);
		BFS.General.ThreadWait(1000);

		//Send the CTRL+H key
		BFS.Input.SendKeys("^{H}");
		
		//Send the F11 key
		//BFS.Input.SendKeys("{VK_122}");
		
		//Play/Pause
		//BFS.Input.SendKeys("{VK_179}");


	}
}