<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>DisplayFusion RSS: [HELP][SOLVED] Scripted Function - Minimize window if both process file name and class meet criteria</title>
<atom:link href="https://www.displayfusion.com/Discussions/RSS/?TopicID=018bb585-668d-732c-a3df-abd7e2235c12" rel="self" type="application/rss+xml" />
<link>https://www.displayfusion.com/Discussions/RSS/?TopicID=018bb585-668d-732c-a3df-abd7e2235c12</link>
<description>DisplayFusion RSS: [HELP][SOLVED] Scripted Function - Minimize window if both process file name and class meet criteria</description>
<lastBuildDate>Mon, 14 Sep 2026 02:11:00 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.displayfusion.com/Discussions/RSS/?TopicID=018bb585-668d-732c-a3df-abd7e2235c12</generator>
<item>
<title>[HELP][SOLVED] Scripted Function - Minimize window if both process file name and class meet criteria</title>
<link>https://www.displayfusion.com/Discussions/View/helpsolved-scripted-function-minimize-window-if-both-process-file-name-and-class-meet-criteria/?ID=018bb585-668d-732c-a3df-abd7e2235c12</link>
<pubDate>Thu, 09 Nov 2023 19:18:21 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/helpsolved-scripted-function-minimize-window-if-both-process-file-name-and-class-meet-criteria/?ID=018bb585-668d-732c-a3df-abd7e2235c12</guid>
<category>DisplayFusion</category>
<description><![CDATA[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
Copy
Select All
using System;&#xA;using System.Drawing;&#xA;&#xA;public static class DisplayFusionFunction&#xA;{&#xA;    public static void Run(In...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
EDIT:<br/>
Never mind, I got it figured out with the help of ChatGPT! (original post at the bottom) <br/>
<br/>
Here's the final, working Scripted Function:<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code01a09dae9a077501b97fb54b870d7971" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code01a09dae9a077501b97fb54b870d7971Js'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code01a09dae9a077501b97fb54b870d7971Js" name="code01a09dae9a077501b97fb54b870d7971Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%;min-height:75px">using System;&#xA;using System.Drawing;&#xA;&#xA;public static class DisplayFusionFunction&#xA;{&#xA;    public static void Run(IntPtr windowHandle)&#xA;    {&#xA;        // Specify target file and class names&#xA;        var targetFileName = &quot;Example.exe&quot;;&#xA;        var targetClassName = &quot;ExampleClass&quot;;&#xA;        &#xA;        // Get main window by file&#xA;        IntPtr mainWindowByFile = BFS.Application.GetMainWindowByFile(&quot;*&quot; &#x2B; targetFileName);&#xA;        &#xA;        // Get window by class&#xA;        IntPtr windowByClass = BFS.Window.GetWindowByClass(targetClassName);&#xA;        &#xA;        // Check if both main window by file and window by class are found&#xA;        if (mainWindowByFile.ToString() != &quot;0&quot; &amp;&amp; windowByClass.ToString() != &quot;0&quot;)&#xA;        {&#xA;            // Minimize the window&#xA;            BFS.Window.Minimize(mainWindowByFile);&#xA;        }&#xA;    }&#xA;}</pre><textarea id="code01a09dae9a077501b97fb54b870d7971" name="code01a09dae9a077501b97fb54b870d7971" style="position:absolute;top:0;left:-999999px;width:1px;height:1px"></textarea></div>
</div></div></div> —————————————————————————————————————————————————<br/>
—————————————————————————————————————————————————<br/>
<br/>
<del>Can someone please help me create a scripted function that minimizes a window?<br/>
<br/>
I know I could either do this:</del><br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code01a09dae9a0e7086a68b11266764019b" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code01a09dae9a0e7086a68b11266764019bJs'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code01a09dae9a0e7086a68b11266764019bJs" name="code01a09dae9a0e7086a68b11266764019bJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%;min-height:75px">using System;&#xA;using System.Drawing;&#xA;&#xA;// The &#x27;windowHandle&#x27; parameter will contain the window handle for the:&#xA;//   - Active window when run by hotkey&#xA;//   - Trigger target when run by a Trigger rule&#xA;//   - TitleBar Button owner when run by a TitleBar Button&#xA;//   - Jump List owner when run from a Taskbar Jump List&#xA;//   - Currently focused window if none of these match&#xA;public static class DisplayFusionFunction&#xA;{&#xA;    public static void Run(IntPtr windowHandle)&#xA;    {&#xA;        BFS.Window.Minimize(BFS.Application.GetMainWindowByFile(&quot;*example.exe&quot;));&#xA;    }&#xA;}</pre><textarea id="code01a09dae9a0e7086a68b11266764019b" name="code01a09dae9a0e7086a68b11266764019b" style="position:absolute;top:0;left:-999999px;width:1px;height:1px"></textarea></div>
</div></div></div><br/>
<del>Or this:</del><br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code01a09dae9a10777484c1d463d3ff32ea" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code01a09dae9a10777484c1d463d3ff32eaJs'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code01a09dae9a10777484c1d463d3ff32eaJs" name="code01a09dae9a10777484c1d463d3ff32eaJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%;min-height:75px">using System;&#xA;using System.Drawing;&#xA;&#xA;// The &#x27;windowHandle&#x27; parameter will contain the window handle for the:&#xA;//   - Active window when run by hotkey&#xA;//   - Trigger target when run by a Trigger rule&#xA;//   - TitleBar Button owner when run by a TitleBar Button&#xA;//   - Jump List owner when run from a Taskbar Jump List&#xA;//   - Currently focused window if none of these match&#xA;public static class DisplayFusionFunction&#xA;{&#xA;    public static void Run(IntPtr windowHandle)&#xA;    {&#xA;        BFS.Window.Minimize(BFS.Window.GetWindowByClass(&quot;ExampleClass&quot;));&#xA;    }&#xA;}</pre><textarea id="code01a09dae9a10777484c1d463d3ff32ea" name="code01a09dae9a10777484c1d463d3ff32ea" style="position:absolute;top:0;left:-999999px;width:1px;height:1px"></textarea></div>
</div></div></div><br/>
<br/>
<del>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?</del>
</div>
]]></content:encoded>
</item>
</channel>
</rss>