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
Beak
37 discussion posts
EDIT:
Never mind, I got it figured out with the help of ChatGPT! (original post at the bottom)

Here's the final, working Scripted Function:

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        // Specify target file and class names
        var targetFileName = "Example.exe";
        var targetClassName = "ExampleClass";
        
        // Get main window by file
        IntPtr mainWindowByFile = BFS.Application.GetMainWindowByFile("*" + targetFileName);
        
        // Get window by class
        IntPtr windowByClass = BFS.Window.GetWindowByClass(targetClassName);
        
        // Check if both main window by file and window by class are found
        if (mainWindowByFile.ToString() != "0" && windowByClass.ToString() != "0")
        {
            // Minimize the window
            BFS.Window.Minimize(mainWindowByFile);
        }
    }
}
—————————————————————————————————————————————————
—————————————————————————————————————————————————

Can someone please help me create a scripted function that minimizes a window?

I know I could either do this:

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)
    {
        BFS.Window.Minimize(BFS.Application.GetMainWindowByFile("*example.exe"));
    }
}

Or this:

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)
    {
        BFS.Window.Minimize(BFS.Window.GetWindowByClass("ExampleClass"));
    }
}


But I want the script to minimize the window only if it meets BOTH of the specified criteria. I have no idea how to do even the simplest of scripting operations, so if anyone is willing to, could someone create this scripted function for me?
Nov 9, 2023 (modified Nov 9, 2023)  • #1
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)