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?
Save up to 50% on our desktop apps during our big Year End Sale!Save up to 50% on our desktop apps during our big Year End Sale, including DisplayFusion, ClipboardFusion, FileSeek, LogFusion, TrayStatus, and VoiceBot!Save up to 50% on our desktop apps during our big Year End Sale!

Move all windows from monitor #3 to monitor #2

Description
This script will move all windows from monitor 3 to monitor 2.
Language
C#.net
Minimum Version
Created By
Anoka84423
Contributors
-
Date Created
5d ago
Date Last Modified
5d ago

Scripted Function (Macro) Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
		// Set the Monitor ID you want to move the windows from
		uint sourceMonitorID = 3;

		// Set the target monitor ID here
		uint targetMonitorID = 2;

		// Loop through the visible windows on the monitor and move them to the monitor that has the mouse cursor
		foreach (IntPtr window in BFS.Window.GetVisibleWindowHandlesByMonitor(sourceMonitorID))
		{
			// If the window is minimized, move it to monitor 2 and minimize it
			if (BFS.Window.IsMinimized(window))
			{
				BFS.Window.MoveToMonitor(targetMonitorID, window);
				BFS.Window.Minimize(window);
			}
			// Otherwise, just move it to monitor 2
			else
			{
				BFS.Window.MoveToMonitor(targetMonitorID, window);
			}
		}
	}
}