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?

Move All Windows Left or Right

Description
This script moves all windows to the next monitor, then on the next run, it moves them back
Language
C#.net
Minimum Version
Created By
Thomas Malloch (BFS)
Contributors
-
Date Created
Mar 18, 2015
Date Last Modified
Mar 18, 2015

Scripted Function (Macro) Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
	public static void Run()
	{
		const string leftOrRight = "Script_Move_Left_Or_Right_Setting";
		string setting = BFS.ScriptSettings.ReadValue(leftOrRight);
		bool isMovingRight = (setting.Length == 0) || (setting.Equals("right"));
		BFS.ScriptSettings.WriteValue(leftOrRight, (isMovingRight) ? "left" : "right");
		
		foreach(IntPtr window in BFS.Window.GetVisibleWindowHandles())
		{
			if(isMovingRight)
				BFS.Window.MoveToNextMonitor(window);
			else
				BFS.Window.MoveToPreviousMonitor(window);
		}
	}
}