Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

A recent AVG and Avast antivirus update is preventing DisplayFusion 9.9 from launching on some systems.
If you're running into this issue, please update to the latest DisplayFusion 10.0 Beta.

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);
		}
	}
}