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.

Open and switch between 2 websites

Description
Opens 2 websites in the default browser, maximized on monitor 1, then switches between them every 5 seconds. To stop the script, right-click the tray icon and choose Stop.
Language
C#.net
Minimum Version
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Aug 4, 2017
Date Last Modified
Aug 4, 2017

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
//   - Trigger target when run by a Trigger 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)
	{
        // Set the website URLs here
        string website1 = "https://www.displayfusion.com";
        string website2 = "https://www.clipboardfusion.com";
	
        // Open the two websites
		IntPtr window1 = BFS.Web.OpenUrlNewWindow(website1);
		IntPtr window2 = BFS.Web.OpenUrlNewWindow(website2);
		
		// Maximize them on monitor 1
		BFS.Window.MoveToMonitorMaximized(1, window1);
		BFS.Window.MoveToMonitorMaximized(1, window2);

        // Switch between them every 5 seconds
        while(true)
        {
            BFS.Window.Focus(window1);
            BFS.General.ThreadWait(5000);
            BFS.Window.Focus(window2);
            BFS.General.ThreadWait(5000);
        }
	}
}