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?

User Image
Bernardo Castellanos
1 discussion post
Hi, I have been trying to open up multiple sites at once and placing them in specific positions. This script works fine with chrome but it doesn't with MS Edge which is what I would like to use. Heres the script for reference.

using System;
using System.Drawing;
using System.Diagnostics;
using System.Threading;

public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
// Define the applications and websites with their target monitor and positions
string[,] appsAndWebsites = {
{ "https://chatgpt.com/", "1", "41", "41", "1223", "1310" },
{ "obsidian", "1", "1304", "41", "1236", "1310" },
{ "https://www.mindbodyonline.com/business", "1", "2580", "41", "1235", "635" },
{ "https://teams.microsoft.com/v2/?clientexperience=t2", "1", "2580", "716", "1235", "635" },
{ "https://outlook.office.com/mail/", "1", "3855", "41", "1224", "635" },
{ "https://app.ninety.io/home", "1", "3855", "716", "1224", "635" },
{ "https://trinet.hrpassport.com/ui-portal-global/#/app.main.iapp?url=%23%2Fssowidget%2Fhire§ion=Company&menuId=114&external=Y", "2", "5136", "-126", "1048", "602" },
{ "https://app.predictiveindex.com/dashboard", "2", "5136", "492", "1048", "603" },
{ "https://employers.indeed.com/jobs?co=US&hl=en_US&from=gnav-menu-homepage&ikw=gnav-header-hire&isid=employerlink-US&trafficTK=1ho3vttqfimhu800&jstm=1718563562376&sortDirection=DESC&sortField=datePostedOnIndeed", "2", "5136", "1111", "1048", "603" },
{ "https://crm.sasquatchstrength.com/v2/location/HZj3qdFMVRelxWRUpk7D/conversations/conversations/VJQdQJMpdCw2hyjfPj2D", "3", "-1064", "-126", "1048", "602" },
{ "https://crm.sasquatchstrength.com/v2/location/HZj3qdFMVRelxWRUpk7D/conversations/conversations/bsRE70yZ2QeLdXEC8RLx", "3", "-1064", "492", "1048", "603" }
};

// Open the applications and websites and move them to their target monitors
for (int i = 0; i < appsAndWebsites.GetLength(0); i++)
{
string appOrWebsite = appsAndWebsites[i, 0];
uint monitorID = Convert.ToUInt32(appsAndWebsites[i, 1]);
int x = Convert.ToInt32(appsAndWebsites[i, 2]);
int y = Convert.ToInt32(appsAndWebsites[i, 3]);
int width = Convert.ToInt32(appsAndWebsites[i, 4]);
int height = Convert.ToInt32(appsAndWebsites[i, 5]);

if (appOrWebsite == "obsidian")
{
// Open the Obsidian app and move it to the specified position
Process obsidianProcess = Process.Start(@"C:\Users\bcast\AppData\Local\Programs\obsidian\Obsidian.exe");
if (obsidianProcess != null)
{
// Wait for the process to start and get the window handle
obsidianProcess.WaitForInputIdle();
Thread.Sleep(5000); // Add delay to ensure window handle is available
IntPtr obsidianHandle = obsidianProcess.MainWindowHandle;
while (obsidianHandle == IntPtr.Zero)
{
obsidianHandle = obsidianProcess.MainWindowHandle;
Thread.Sleep(100);
}
BFS.Window.MoveToMonitor(monitorID, obsidianHandle);
BFS.Window.SetSizeAndLocation(obsidianHandle, x, y, width, height);
}
}
else
{
IntPtr window = BFS.Web.OpenUrlNewWindow(appOrWebsite);
BFS.Window.MoveToMonitor(monitorID, window);
BFS.Window.SetSizeAndLocation(window, x, y, width, height);
}
}
}
}
Aug 2, 2024  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Could you export the script via the DisplayFusion settings > Functions > Scripted Function > Export Scripted Function, and send it over?
Aug 6, 2024  • #2
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)