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
Felix Vejdegren55995
2 discussion posts
Hi!
I'm trying to write a scripted function that moves a window to a specific monitor and resizes it. Why I need it as a scripted function and not as a normal one is because I need an if statement that checks what profile I'm running. I can't get it to work however. I have tried with MoveToMonitor (works) and then SetSizeAndLocation (doesnt work).
I have also tried the MoveToMonitorResized function which should be the obvious choice I think but I don't understand the parameters that function should take. Any help is appreciated.
May 11, 2022  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Hi Felix,

Could you send me over the script you're working with?

Thanks!
May 11, 2022  • #2
User Image
Felix Vejdegren55995
2 discussion posts

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)
    {
        if (BFS.DisplayFusion.GetCurrentMonitorProfile() == "Home"){

            //BFS.Window.MoveToMonitor(1, windowHandle);
            BFS.Window.SetSizeAndLocation(windowHandle, 0,0,1720,1400);
            
        }
        
        else if(BFS.DisplayFusion.GetCurrentMonitorProfile() == "Office"){
            BFS.Window.MoveToMonitorMaximized(3, windowHandle);
        }
    }
}


The problem I have is in the if statement if the profile is "Home". This function currently just moves my window to the left and sets my desired size, but it doesn't move monitor. What I would like to happen is, move to monitor 1, you can see the commented line in the code, and then set size and location. But as soon as I remove the comment the set size and location stops working. It only takes the first line.
May 11, 2022  • #3
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Could you send me a copy of your troubleshooting info? Here are the steps:
  • Open the Settings > Troubleshooting tab
  • Click the "Export Info to File" button
  • Reply with the file attached

Thanks!
May 11, 2022  • #4
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)