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?

Move Window and Mouse Cursor to the Selected Monitor

Description
This script will move the focused window and mouse cursor to the monitor chosen in the monitor selector window that opens when the script is run.
Language
C#.net
Minimum Version
Created By
PabloMartinez
Contributors
-
Date Created
Jun 27, 2017
Date Last Modified
Jun 27, 2017

Scripted Function (Macro) Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
        // Show monitor selector
        var monId = BFS.Monitor.ShowMonitorSelector();
        
		// Move focused window to selected monitor
		BFS.Window.MoveToMonitor(monId, windowHandle);
		
		// Get window bounds
		var wBounds = BFS.Window.GetBounds(windowHandle);
		
		// Move mouse to center of window
		BFS.Input.SetMousePosition(wBounds.Width / 2 + wBounds.X, wBounds.Height / 2 + wBounds.Y);
	}
}