using System;
using System.Collections.Generic;
using System.Drawing;
public static class DisplayFusionFunction
{
public static void Run()
{
// Set the window titles here
string[] windowTitles = {"Word", "PowerPoint", "Excel"};
// Set the rotation time in milliseconds
uint rotationTimeMS = 5000;
// Do a sanity check on the rotation time and exit if it's too low
if (rotationTimeMS < 5000)
{
BFS.Dialog.ShowMessageError("Your rotation time is less than 5 seconds, this will make it difficult to exit the script. Exiting now.");
return;
}
// Find all of the windows and put them in a list
List<IntPtr> foundWindows = new List<IntPtr>();
foreach (IntPtr window in BFS.Window.GetVisibleAndMinimizedWindowHandles())
{
foreach (string windowTitle in windowTitles)
{
if (BFS.Window.GetText(window).ToLower().Contains(windowTitle.ToLower()))
{
foundWindows.Add(window);
}
}
}
// Exit if no windows found
if (foundWindows.Count == 0)
{
BFS.Dialog.ShowMessageError("No windows found that match the titles. Exiting");
return;
}
// Rotate through them
int i = 0;
while (true)
{
BFS.Window.Focus(foundWindows[i]);
i++;
// Reset the index when we're at the end of the foundWindows array
if (i == foundWindows.Count)
{
i = 0;
}
BFS.General.ThreadWait(rotationTimeMS);
}
}
}