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 Window Positions, Load Monitor Profile, Restore Window Positions

Description
This script will save your window positions, then load a Monitor Profile, and then restore the window positions. It's useful on systems where Windows decides to shuffle around your open applications when the monitor configuration changes. Note that this script is only useful if you're switching between monitor profiles where the primary monitor is the same monitor, since the window positions are saved based on their X,Y location, which is calculated starting at the top-left corner of the primary monitor.
Language
C#.net
Minimum Version
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Feb 12, 2015
Date Last Modified
Feb 12, 2015

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
//   - Window Location target when run by a Window Location 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)
	{
		BFS.DisplayFusion.RunFunction("Save Window Positions");
		BFS.General.ThreadWait(1000);
		BFS.DisplayFusion.LoadMonitorProfile("MonitorProfileName");
		BFS.General.ThreadWait(5000);
		BFS.DisplayFusion.RunFunction("Restore Window Positions From Last Save");
	}
}