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?

Open 3 Websites Side by Side on Monitor 1

Description
This script will open the 3 URLs specified at the top of the script tiled on the monitor specified in the script.
Language
C#.net
Minimum Version
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Jan 14, 2020
Date Last Modified
Jan 14, 2020

Scripted Function (Macro) Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
		// Set the list of websites here
		string[] websiteURLs = { "https://www.displayfusion.com",
                                "https://www.traystatus.com",
                                "https://www.logfusion.ca" };
                                
        // Set the target monitor ID here
        uint monitorID = 1;
                                
        // Get the monitor bounds
        Rectangle monitorBounds = BFS.Monitor.GetMonitorWorkAreaByID(monitorID);
                                
        // Open each browser window and position it
        for (int i = 0; i < 3; i++)
        {
            // Set up the window y, width, and heigh values
            Rectangle windowBounds = new Rectangle();
            int windowWidth = (int)(monitorBounds.Width / 3);
            windowBounds.Y = monitorBounds.Y;
            windowBounds.Width = windowWidth;
            windowBounds.Height = monitorBounds.Height;
            
            // Open the window
            IntPtr window = BFS.Web.OpenUrlNewWindow(websiteURLs[i]);
            
            // Modify the X value depending on where we are in the loop and move the window
            if (i == 0)
            {
                windowBounds.X = monitorBounds.X;
                BFS.Window.SetSizeAndLocation(window, windowBounds.X, windowBounds.Y, windowBounds.Width, windowBounds.Height);
            }
            else if (i == 1)
            {
                windowBounds.X = monitorBounds.X + windowWidth;
                BFS.Window.SetSizeAndLocation(window, windowBounds.X, windowBounds.Y, windowBounds.Width, windowBounds.Height);
            }
            else if (i == 2)
            {
                windowBounds.X = monitorBounds.X + (windowWidth * 2);
                BFS.Window.SetSizeAndLocation(window, windowBounds.X, windowBounds.Y, windowBounds.Width, windowBounds.Height);
            }
        }
	}
}