<?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] How do I create a Scripted Function that disables the HotKeys of specific Function?</title>
<atom:link href="https://www.displayfusion.com/Discussions/RSS/?TopicID=0197470c-da3b-72ed-a5ce-045ebad2783d" rel="self" type="application/rss+xml" />
<link>https://www.displayfusion.com/Discussions/RSS/?TopicID=0197470c-da3b-72ed-a5ce-045ebad2783d</link>
<description>DisplayFusion RSS: [Help] How do I create a Scripted Function that disables the HotKeys of specific Function?</description>
<lastBuildDate>Fri, 22 May 2026 15:43:51 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.displayfusion.com/Discussions/RSS/?TopicID=0197470c-da3b-72ed-a5ce-045ebad2783d</generator>
<item>
<title>RE: [Help] How do I create a Scripted Function that disables the HotKeys of specific Function?</title>
<link>https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#9</link>
<pubDate>Wed, 09 Jul 2025 18:04:57 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#9</guid>
<category>DisplayFusion</category>
<description><![CDATA[Quote:
Quote:
If your logic is to disable the functionality when a program is not running, this is significantly easier.
Just put the following code at the top of your Run() methods.  (line 12)
Code
Copy
Select All
if(BFS.Application.IsAppRunningByFile(@"*\notepad.exe") == false)
return;...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
<div class="BackGrey"><div class="Text"><div><b>Quote:</b></div><div class="BackGrey"><div class="Text"><div><b>Quote:</b></div>If your logic is to disable the functionality when a program is not running, this is significantly easier.<br/>
<br/>
Just put the following code at the top of your Run() methods.  (line 12)<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="#code019e505b747c755890d4d653caa79295" 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('code019e505b747c755890d4d653caa79295Js'); 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="code019e505b747c755890d4d653caa79295Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">if(BFS.Application.IsAppRunningByFile(@"*\notepad.exe") == false)
    return;</pre><textarea id="code019e505b747c755890d4d653caa79295" name="code019e505b747c755890d4d653caa79295" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
Then replace "notepad.exe" with whatever your program is.  The return statement will prevent the rest of the code from running when that program is not detected by DF.<br/>
<br/>
The only annoying part is that DisplayFusion will show notifications for any scripted function running... which these still are.  You may wish to change the global Advanced Setting, "Disable Notification for Scripted Functions Running".</div></div><br/>
<br/>
I've pasted one of the Functions below. When the target process is <i>not</i> running, the Functions don't do anything, just as I want. I'm not sure how, but none when the process <i>is</i> running, none of the Functions actually <i>do</i> anything.<br/>
<br/>
Any idea why this is the case?<br/>
<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="#code019e505b7481728584468bf6bb64f1db" 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('code019e505b7481728584468bf6bb64f1dbJs'); 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="code019e505b7481728584468bf6bb64f1dbJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;

/*
   Works for Function names like:
     Multi-Clipboard_Copy_0
     Multi-Clipboard_Paste_7
*/
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        if(BFS.Application.IsAppRunningByFile(@"*\Example.exe") == false)
    return;
        // 1) Figure out slot (0-9) and mode (Copy / Paste) from the Function’s name
        string fnName = BFS.General.GetCurrentScriptName();   // e.g. "Multi-Clipboard_Copy_3"
        bool isCopy  = fnName.Contains("_Copy_",  StringComparison.OrdinalIgnoreCase);
        bool isPaste = fnName.Contains("_Paste_", StringComparison.OrdinalIgnoreCase);

        // Extract last character → digit
        char lastChar = fnName[fnName.Length - 1];
        if (!char.IsDigit(lastChar)) return;          // safety check
        int slot = lastChar - '0';                   // '0' -&gt; 0, … '9' -&gt; 9
        string keyName = $"MultiClip{slot}";

        // 2) COPY  -----------------------------------------------------
        if (isCopy)
        {
            BFS.Clipboard.Copy();                    // same as Ctrl+C
            BFS.General.Sleep(100);                  // tiny “ClipWait”
            BFS.ScriptSettings.WriteValue(
                keyName,
                BFS.Clipboard.GetText() ?? string.Empty);
            return;
        }

        // 3) PASTE -----------------------------------------------------
        if (isPaste)
        {
            string stored = BFS.ScriptSettings.ReadValue(keyName);
            if (!string.IsNullOrEmpty(stored))
            {
                BFS.Clipboard.SetText(stored);
                BFS.Clipboard.Paste();               // same as Ctrl+V
            }
        }
    }
}</pre><textarea id="code019e505b7481728584468bf6bb64f1db" name="code019e505b7481728584468bf6bb64f1db" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div></div></div><br/>
<br/>
Never mind, I got it figured out. I've adjusted all ten of my Copy functions and all ten of my Paste functions with the same fix. Below is one of the Copy functions as well as its corresponding Paste function.<br/>
<br/>
<ul class="ListBullet"><div class="Inline"><pre>Multi-Clipboard_Copy_1</pre></div>:</ul>
<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="#code019e505b748470fbbfbfce49a5cdda64" 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('code019e505b748470fbbfbfce49a5cdda64Js'); 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="code019e505b748470fbbfbfce49a5cdda64Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;

/*
   Works for Function names like:
     Multi-Clipboard_Copy_0
     Multi-Clipboard_Paste_7
*/
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        if(BFS.Application.IsAppRunningByFile("*Discovery.exe") == false)
    return;
        // 1) Figure out slot (0-9) and mode (Copy / Paste) from the Function’s name
        string fnName = BFS.General.GetCurrentScriptName();   // e.g. "Multi-Clipboard_Copy_3"
        bool isCopy  = fnName.Contains("_Copy_",  StringComparison.OrdinalIgnoreCase);
        bool isPaste = fnName.Contains("_Paste_", StringComparison.OrdinalIgnoreCase);

        // Extract last character → digit
        char lastChar = fnName[fnName.Length - 1];
        if (!char.IsDigit(lastChar)) return;          // safety check
        int slot = lastChar - '0';                   // '0' -&gt; 0, … '9' -&gt; 9
        string keyName = $"MultiClip{slot}";

        // 2) COPY  -----------------------------------------------------
        if (isCopy)
        {
            BFS.Clipboard.Copy();                    // same as Ctrl+C
            BFS.General.Sleep(100);                  // tiny “ClipWait”
            BFS.ScriptSettings.WriteValue(
                keyName,
                BFS.Clipboard.GetText() ?? string.Empty);
            return;
        }

        // 3) PASTE -----------------------------------------------------
        if (isPaste)
        {
            string stored = BFS.ScriptSettings.ReadValue(keyName);
            if (!string.IsNullOrEmpty(stored))
            {
                BFS.Clipboard.SetText(stored);
                BFS.Clipboard.Paste();               // same as Ctrl+V
            }
        }
    }
}</pre><textarea id="code019e505b748470fbbfbfce49a5cdda64" name="code019e505b748470fbbfbfce49a5cdda64" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
<ul class="ListBullet"><div class="Inline"><pre>Multi-Clipboard_Paste_1</pre></div>:</ul>
<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="#code019e505b74877664908da9c784a37e1a" 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('code019e505b74877664908da9c784a37e1aJs'); 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="code019e505b74877664908da9c784a37e1aJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;

/*
   Works for Function names like:
     Multi-Clipboard_Copy_0
     Multi-Clipboard_Paste_7
*/
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        if(BFS.Application.IsAppRunningByFile("*Discovery.exe") == false)
    return;
        // 1) Figure out slot (0-9) and mode (Copy / Paste) from the Function’s name
        string fnName = BFS.General.GetCurrentScriptName();   // e.g. "Multi-Clipboard_Copy_3"
        bool isCopy  = fnName.Contains("_Copy_",  StringComparison.OrdinalIgnoreCase);
        bool isPaste = fnName.Contains("_Paste_", StringComparison.OrdinalIgnoreCase);

        // Extract last character → digit
        char lastChar = fnName[fnName.Length - 1];
        if (!char.IsDigit(lastChar)) return;          // safety check
        int slot = lastChar - '0';                   // '0' -&gt; 0, … '9' -&gt; 9
        string keyName = $"MultiClip{slot}";

        // 2) COPY  -----------------------------------------------------
        if (isCopy)
        {
            BFS.Clipboard.Copy();                    // same as Ctrl+C
            BFS.General.Sleep(100);                  // tiny “ClipWait”
            BFS.ScriptSettings.WriteValue(
                keyName,
                BFS.Clipboard.GetText() ?? string.Empty);
            return;
        }

        // 3) PASTE -----------------------------------------------------
        if (isPaste)
        {
            string stored = BFS.ScriptSettings.ReadValue(keyName);
            if (!string.IsNullOrEmpty(stored))
            {
                BFS.Clipboard.SetText(stored);
                BFS.Clipboard.Paste();               // same as Ctrl+V
            }
        }
    }
}</pre><textarea id="code019e505b74877664908da9c784a37e1a" name="code019e505b74877664908da9c784a37e1a" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f"/>
</item>
<item>
<title>RE: [Help] How do I create a Scripted Function that disables the HotKeys of specific Function?</title>
<link>https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#8</link>
<pubDate>Fri, 13 Jun 2025 23:44:30 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#8</guid>
<category>DisplayFusion</category>
<description><![CDATA[Quote:
If your logic is to disable the functionality when a program is not running, this is significantly easier.
Just put the following code at the top of your Run() methods.  (line 12)
Code
Copy
Select All
if(BFS.Application.IsAppRunningByFile(@"*\notepad.exe") == false)
return;
Then re...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
<div class="BackGrey"><div class="Text"><div><b>Quote:</b></div>If your logic is to disable the functionality when a program is not running, this is significantly easier.<br/>
<br/>
Just put the following code at the top of your Run() methods.  (line 12)<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="#code019e505b7494774bb96d8d79c404d727" 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('code019e505b7494774bb96d8d79c404d727Js'); 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="code019e505b7494774bb96d8d79c404d727Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">if(BFS.Application.IsAppRunningByFile(@"*\notepad.exe") == false)
    return;</pre><textarea id="code019e505b7494774bb96d8d79c404d727" name="code019e505b7494774bb96d8d79c404d727" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
Then replace "notepad.exe" with whatever your program is.  The return statement will prevent the rest of the code from running when that program is not detected by DF.<br/>
<br/>
The only annoying part is that DisplayFusion will show notifications for any scripted function running... which these still are.  You may wish to change the global Advanced Setting, "Disable Notification for Scripted Functions Running".</div></div><br/>
<br/>
I've pasted one of the Functions below. When the target process is <i>not</i> running, the Functions don't do anything, just as I want. I'm not sure how, but none when the process <i>is</i> running, none of the Functions actually <i>do</i> anything.<br/>
<br/>
Any idea why this is the case?<br/>
<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="#code019e505b749c73ff915168ac2d394b2a" 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('code019e505b749c73ff915168ac2d394b2aJs'); 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="code019e505b749c73ff915168ac2d394b2aJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;

/*
   Works for Function names like:
     Multi-Clipboard_Copy_0
     Multi-Clipboard_Paste_7
*/
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        if(BFS.Application.IsAppRunningByFile(@"*\Example.exe") == false)
    return;
        // 1) Figure out slot (0-9) and mode (Copy / Paste) from the Function’s name
        string fnName = BFS.General.GetCurrentScriptName();   // e.g. "Multi-Clipboard_Copy_3"
        bool isCopy  = fnName.Contains("_Copy_",  StringComparison.OrdinalIgnoreCase);
        bool isPaste = fnName.Contains("_Paste_", StringComparison.OrdinalIgnoreCase);

        // Extract last character → digit
        char lastChar = fnName[fnName.Length - 1];
        if (!char.IsDigit(lastChar)) return;          // safety check
        int slot = lastChar - '0';                   // '0' -&gt; 0, … '9' -&gt; 9
        string keyName = $"MultiClip{slot}";

        // 2) COPY  -----------------------------------------------------
        if (isCopy)
        {
            BFS.Clipboard.Copy();                    // same as Ctrl+C
            BFS.General.Sleep(100);                  // tiny “ClipWait”
            BFS.ScriptSettings.WriteValue(
                keyName,
                BFS.Clipboard.GetText() ?? string.Empty);
            return;
        }

        // 3) PASTE -----------------------------------------------------
        if (isPaste)
        {
            string stored = BFS.ScriptSettings.ReadValue(keyName);
            if (!string.IsNullOrEmpty(stored))
            {
                BFS.Clipboard.SetText(stored);
                BFS.Clipboard.Paste();               // same as Ctrl+V
            }
        }
    }
}</pre><textarea id="code019e505b749c73ff915168ac2d394b2a" name="code019e505b749c73ff915168ac2d394b2a" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f"/>
</item>
<item>
<title>RE: [Help] How do I create a Scripted Function that disables the HotKeys of specific Function?</title>
<link>https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#7</link>
<pubDate>Mon, 09 Jun 2025 07:58:19 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#7</guid>
<category>DisplayFusion</category>
<description><![CDATA[Quote:
That's what it does.  If the application is not running, the function will abort.  So if it is running, the function will proceed as normal.  If I just don't understand you, change "false" to "true" in the if statement to do the opposite of what it does now.
My apologies, you're right. I...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
<div class="BackGrey"><div class="Text"><div><b>Quote:</b></div>That's what it does.  If the application is not running, the function will abort.  So if it is running, the function will proceed as normal.  If I just don't understand you, change "false" to "true" in the if statement to do the opposite of what it does now.</div></div><br/>
<br/>
My apologies, you're right. I got all mixed up and didn't correctly wrap my head around it.
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f"/>
</item>
<item>
<title>RE: [Help] How do I create a Scripted Function that disables the HotKeys of specific Function?</title>
<link>https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#6</link>
<pubDate>Mon, 09 Jun 2025 00:52:22 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#6</guid>
<category>DisplayFusion</category>
<description><![CDATA[That's what it does.  If the application is not running, the function will abort.  So if it is running, the function will proceed as normal.  If I just don't understand you, change "false" to "true" in the if statement to do the opposite of what it does now.]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
That's what it does.  If the application is not running, the function will abort.  So if it is running, the function will proceed as normal.  If I just don't understand you, change "false" to "true" in the if statement to do the opposite of what it does now.
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f"/>
</item>
<item>
<title>RE: [Help] How do I create a Scripted Function that disables the HotKeys of specific Function?</title>
<link>https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#5</link>
<pubDate>Mon, 09 Jun 2025 00:41:47 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#5</guid>
<category>DisplayFusion</category>
<description><![CDATA[Quote:
If your logic is to disable the functionality when a program is not running, this is significantly easier.
Just put the following code at the top of your Run() methods.  (line 12)
Code
Copy
Select All
if(BFS.Application.IsAppRunningByFile(@"*\notepad.exe") == false)
return;
Then re...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
<div class="BackGrey"><div class="Text"><div><b>Quote:</b></div>If your logic is to disable the functionality when a program is not running, this is significantly easier.<br/>
<br/>
Just put the following code at the top of your Run() methods.  (line 12)<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="#code019e505b74b4753580080ee18516c01c" 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('code019e505b74b4753580080ee18516c01cJs'); 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="code019e505b74b4753580080ee18516c01cJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">if(BFS.Application.IsAppRunningByFile(@"*\notepad.exe") == false)
    return;</pre><textarea id="code019e505b74b4753580080ee18516c01c" name="code019e505b74b4753580080ee18516c01c" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
Then replace "notepad.exe" with whatever your program is.  The return statement will prevent the rest of the code from running when that program is not detected by DF.<br/>
<br/>
The only annoying part is that DisplayFusion will show notifications for any scripted function running... which these still are.  You may wish to change the global Advanced Setting, "Disable Notification for Scripted Functions Running".</div></div><br/>
<br/>
Is there some way to enable the functionality when the specified process <i>is</i> running?
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f"/>
</item>
<item>
<title>RE: [Help] How do I create a Scripted Function that disables the HotKeys of specific Function?</title>
<link>https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#4</link>
<pubDate>Mon, 09 Jun 2025 00:02:10 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#4</guid>
<category>DisplayFusion</category>
<description><![CDATA[If your logic is to disable the functionality when a program is not running, this is significantly easier.
Just put the following code at the top of your Run() methods.  (line 12)
Code
Copy
Select All
if(BFS.Application.IsAppRunningByFile(@"*\notepad.exe") == false)
return;
Then replace "n...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
If your logic is to disable the functionality when a program is not running, this is significantly easier.<br/>
<br/>
Just put the following code at the top of your Run() methods.  (line 12)<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="#code019e505b74cc76cebf53698f6983eda7" 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('code019e505b74cc76cebf53698f6983eda7Js'); 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="code019e505b74cc76cebf53698f6983eda7Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">if(BFS.Application.IsAppRunningByFile(@"*\notepad.exe") == false)
    return;</pre><textarea id="code019e505b74cc76cebf53698f6983eda7" name="code019e505b74cc76cebf53698f6983eda7" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
Then replace "notepad.exe" with whatever your program is.  The return statement will prevent the rest of the code from running when that program is not detected by DF.<br/>
<br/>
The only annoying part is that DisplayFusion will show notifications for any scripted function running... which these still are.  You may wish to change the global Advanced Setting, "Disable Notification for Scripted Functions Running".
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f"/>
</item>
<item>
<title>RE: [Help] How do I create a Scripted Function that disables the HotKeys of specific Function?</title>
<link>https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#3</link>
<pubDate>Sun, 08 Jun 2025 23:40:49 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#3</guid>
<category>DisplayFusion</category>
<description><![CDATA[Quote:
I took a gander through the APIs and there isn't a straighforward way to do this.  You cannot enable/disable/add/remove hotkeys to DF functions through scripting.
The only thought that came to mind is to convert your functions to scripted functions, then inside each script it checks a sa...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
<div class="BackGrey"><div class="Text"><div><b>Quote:</b></div>I took a gander through the APIs and there isn't a straighforward way to do this.  You cannot enable/disable/add/remove hotkeys to DF functions through scripting.<br/>
<br/>
The only thought that came to mind is to convert your functions to scripted functions, then inside each script it checks a saved setting to see if it should actually perform work.  The hotkeys always run the script, but the script can decide to abort and do nothing.  Finally, another couple scripts to enable/disable the setting value to allow/disallow your other scripted functions.<br/>
<br/>
The annoying part would be to convert your existing functions to scripted functions.  (presumably, since I don't know how complicated your functions are)</div></div><br/>
<br/>
Thanks for your response, those sound like great ideas! They are Scripted Functions. I have ten Multi Clipboard Copy functions and ten corresponding Multi Clipboard Paste functions. The first of each are below.<br/>
<div class="Image"><a href="https://www.displayfusion.com/Discussions/Download/?ID=019751eb-1188-760d-9c13-b35b8a7e47aa" target="_blank" data-fancybox="" data-caption="https://www.displayfusion.com/Discussions/Download/?ID=019751eb-1188-760d-9c13-b35b8a7e47aa" HelpButtonData="https://www.displayfusion.com/Discussions/Download/?ID=019751eb-1188-760d-9c13-b35b8a7e47aa" HelpButtonDataAlign="BelowMiddle"><img src="https://www.displayfusion.com/Discussions/Download/?ID=019751eb-1188-760d-9c13-b35b8a7e47aa" alt="https://www.displayfusion.com/Discussions/Download/?ID=019751eb-1188-760d-9c13-b35b8a7e47aa" title=""></a></div><br/>
<div class="Inline"><pre>Multi-Clipboard_Copy_0</pre></div>:<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="#code019e505b74da763d9238ad72bd2fef5d" 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('code019e505b74da763d9238ad72bd2fef5dJs'); 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="code019e505b74da763d9238ad72bd2fef5dJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;

/*
   Works for Function names like:
     Multi-Clipboard_Copy_0
     Multi-Clipboard_Paste_7
*/
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        // 1) Figure out slot (0-9) and mode (Copy / Paste) from the Function’s name
        string fnName = BFS.General.GetCurrentScriptName();   // e.g. "Multi-Clipboard_Copy_3"
        bool isCopy  = fnName.Contains("_Copy_",  StringComparison.OrdinalIgnoreCase);
        bool isPaste = fnName.Contains("_Paste_", StringComparison.OrdinalIgnoreCase);

        // Extract last character → digit
        char lastChar = fnName[fnName.Length - 1];
        if (!char.IsDigit(lastChar)) return;          // safety check
        int slot = lastChar - '0';                   // '0' -&gt; 0, … '9' -&gt; 9
        string keyName = $"MultiClip{slot}";

        // 2) COPY  -----------------------------------------------------
        if (isCopy)
        {
            BFS.Clipboard.Copy();                    // same as Ctrl+C
            BFS.General.Sleep(100);                  // tiny “ClipWait”
            BFS.ScriptSettings.WriteValue(
                keyName,
                BFS.Clipboard.GetText() ?? string.Empty);
            return;
        }

        // 3) PASTE -----------------------------------------------------
        if (isPaste)
        {
            string stored = BFS.ScriptSettings.ReadValue(keyName);
            if (!string.IsNullOrEmpty(stored))
            {
                BFS.Clipboard.SetText(stored);
                BFS.Clipboard.Paste();               // same as Ctrl+V
            }
        }
    }
}</pre><textarea id="code019e505b74da763d9238ad72bd2fef5d" name="code019e505b74da763d9238ad72bd2fef5d" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
<div class="Inline"><pre>Multi-Clipboard_Paste_0</pre></div>:<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="#code019e505b74dd707881c25611ba18a452" 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('code019e505b74dd707881c25611ba18a452Js'); 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="code019e505b74dd707881c25611ba18a452Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;

/*
   Works for Function names like:
     Multi-Clipboard_Copy_0
     Multi-Clipboard_Paste_7
*/
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        // 1) Figure out slot (0-9) and mode (Copy / Paste) from the Function’s name
        string fnName = BFS.General.GetCurrentScriptName();   // e.g. "Multi-Clipboard_Copy_3"
        bool isCopy  = fnName.Contains("_Copy_",  StringComparison.OrdinalIgnoreCase);
        bool isPaste = fnName.Contains("_Paste_", StringComparison.OrdinalIgnoreCase);

        // Extract last character → digit
        char lastChar = fnName[fnName.Length - 1];
        if (!char.IsDigit(lastChar)) return;          // safety check
        int slot = lastChar - '0';                   // '0' -&gt; 0, … '9' -&gt; 9
        string keyName = $"MultiClip{slot}";

        // 2) COPY  -----------------------------------------------------
        if (isCopy)
        {
            BFS.Clipboard.Copy();                    // same as Ctrl+C
            BFS.General.Sleep(100);                  // tiny “ClipWait”
            BFS.ScriptSettings.WriteValue(
                keyName,
                BFS.Clipboard.GetText() ?? string.Empty);
            return;
        }

        // 3) PASTE -----------------------------------------------------
        if (isPaste)
        {
            string stored = BFS.ScriptSettings.ReadValue(keyName);
            if (!string.IsNullOrEmpty(stored))
            {
                BFS.Clipboard.SetText(stored);
                BFS.Clipboard.Paste();               // same as Ctrl+V
            }
        }
    }
}</pre><textarea id="code019e505b74dd707881c25611ba18a452" name="code019e505b74dd707881c25611ba18a452" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
I don't know how to modify these functions to do what you had suggested—if you know how to do it, would you mind modifying these to incorporate your suggested changes? What I need is for the HotKeys of these Scripted Functions to <i>only</i> be active whenever a specific <div class="Inline"><pre>.exe</pre></div> is running and then have the HotKeys <i>not</i> be active whenever the specified <div class="Inline"><pre>.exe</pre></div> is <i>not</i> running.
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f"/>
</item>
<item>
<title>RE: [Help] How do I create a Scripted Function that disables the HotKeys of specific Function?</title>
<link>https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#2</link>
<pubDate>Sun, 08 Jun 2025 04:01:12 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d#2</guid>
<category>DisplayFusion</category>
<description><![CDATA[I took a gander through the APIs and there isn't a straighforward way to do this.  You cannot enable/disable/add/remove hotkeys to DF functions through scripting.
The only thought that came to mind is to convert your functions to scripted functions, then inside each script it checks a saved sett...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
I took a gander through the APIs and there isn't a straighforward way to do this.  You cannot enable/disable/add/remove hotkeys to DF functions through scripting.<br/>
<br/>
The only thought that came to mind is to convert your functions to scripted functions, then inside each script it checks a saved setting to see if it should actually perform work.  The hotkeys always run the script, but the script can decide to abort and do nothing.  Finally, another couple scripts to enable/disable the setting value to allow/disallow your other scripted functions.<br/>
<br/>
The annoying part would be to convert your existing functions to scripted functions.  (presumably, since I don't know how complicated your functions are)
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f"/>
</item>
<item>
<title>[Help] How do I create a Scripted Function that disables the HotKeys of specific Function?</title>
<link>https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d</link>
<pubDate>Fri, 06 Jun 2025 21:01:54 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/help-how-do-i-create-a-scripted-function-that-disables-the-hotkeys-of-specific-function/?ID=0197470c-da3b-72ed-a5ce-045ebad2783d</guid>
<category>DisplayFusion</category>
<description><![CDATA[As shown in the screenshot below, I have a bunch of Functions that I've created HotKeys for that are all related to one another. What I need is to figure out how to automate disabling and enabling the HotKeys for just those specific Functions and not any others. I'm already aware of the default T...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
As shown in the screenshot below, I have a bunch of Functions that I've created HotKeys for that are all related to one another. What I need is to figure out how to automate disabling and enabling the HotKeys for <i><b>just</b></i> those specific Functions and not any others. I'm already aware of the default <div class="Inline"><pre>Toggle HotKeys</pre></div> Function, but I don't want to enable/disable HotKeys globally. Is this possible with a Scripted Function? If so, can someone please help me set it up?<br/>
<br/>
<div class="Image"><a href="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f" target="_blank" data-fancybox="" data-caption="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f" HelpButtonData="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f" HelpButtonDataAlign="BelowMiddle"><img src="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f" alt="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f" title=""></a></div>
</div>
]]></content:encoded>
<media:thumbnail url="https://www.displayfusion.com/Discussions/Download/?ID=0197470d-71f0-7076-827d-86c89d24c48f"/>
</item>
</channel>
</rss>