<?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: Screen fading on a schedule</title>
<atom:link href="https://www.displayfusion.com/Discussions/RSS/?TopicID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6" rel="self" type="application/rss+xml" />
<link>https://www.displayfusion.com/Discussions/RSS/?TopicID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6</link>
<description>DisplayFusion RSS: Screen fading on a schedule</description>
<lastBuildDate>Thu, 08 Oct 2026 10:22:47 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.displayfusion.com/Discussions/RSS/?TopicID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6</generator>
<item>
<title>RE: Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#11</link>
<pubDate>Fri, 12 Jul 2024 13:17:02 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#11</guid>
<category>DisplayFusion</category>
<description><![CDATA[Yep we keep track of who has asked for what, so we can follow up if we add it in]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Yep we keep track of who has asked for what, so we can follow up if we add it in <img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/face-smile.light.svg" alt=":)" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:16px;height:16px;" HelpButtonData=":)" />
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#10</link>
<pubDate>Thu, 11 Jul 2024 21:21:21 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#10</guid>
<category>DisplayFusion</category>
<description><![CDATA[Thanks v.much Thomas for the scripts and Owen for notificaiton of this latest release.
Just out of interest... how do you know to come back to this thread to notify of this specific feature?  Is it done with tags?
Thanks
Al]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Thanks v.much Thomas for the scripts and Owen for notificaiton of this latest release.<br/>
<br/>
Just out of interest... how do you know to come back to this thread to notify of this specific feature?  Is it done with tags?<br/>
<br/>
Thanks<br/>
Al
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#9</link>
<pubDate>Wed, 26 Jun 2024 14:11:09 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#9</guid>
<category>DisplayFusion</category>
<description><![CDATA[We've released a new beta that allows you set to a gradual fade time. You can grab it here: https://www.displayfusion.com/Download/Beta/
Thanks!]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
We've released a new beta that allows you set to a gradual fade time. You can grab it here: <a href="https://www.displayfusion.com/Download/Beta/" target="_blank" rel="nofollow"><b>https://www.displayfusion.com/Download/Beta/</b></a><br/>
<br/>
Thanks!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#8</link>
<pubDate>Mon, 04 Feb 2019 04:18:23 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#8</guid>
<category>DisplayFusion</category>
<description><![CDATA[Sorry for the late response!
I was able to modify the script to be able to listen for the change of transparency value. The only downside is that you'll now need 3 scripts. One to toggle the dimming functionality and listen, another to increase the transparency value, and another to decrease it....]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
<p>Sorry for the late response!</p>
<p>
I was able to modify the script to be able to listen for the change of transparency value. The only downside is that you'll now need 3 scripts. One to toggle the dimming functionality and listen, another to increase the transparency value, and another to decrease it.
</p>
<p>
Here's the first script:
</p>
<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="#code01a11b0976f2744ea14b74e823060da4" 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('code01a11b0976f2744ea14b74e823060da4Js'); 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="code01a11b0976f2744ea14b74e823060da4Js" name="code01a11b0976f2744ea14b74e823060da4Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%;min-height:75px">using System;&#xA;using System.Drawing;&#xA;using System.Windows.Forms;&#xA;using System.Threading;&#xA;using System.Collections.Generic;&#xA;&#xA;// The &#x27;windowHandle&#x27; parameter will contain the window handle for the:&#xA;//   - Active window when run by hotkey&#xA;//   - Window Location target when run by a Window Location 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;    private static readonly string SettingName = &quot;DimMonitor_TransparentForm_Running&quot;;&#xA;    private static readonly string TransparencySettingName = &quot;DimMonitor_TransparentForm_TransparencyValue&quot;;&#xA;    public static void Run(IntPtr windowHandle)&#xA;    {&#xA;        // toggle the setting from running to not running, and vice versa&#xA;        ToggleSetting();&#xA;        &#xA;        // check to see if we should exit&#xA;        bool isExiting = !IsTransparentWindowRunning();&#xA;                &#xA;        // if we are exiting, exit&#xA;        if(isExiting)&#xA;            return;&#xA;            &#xA;        // get the transparency value. if there&#x27;s none, set it to 30%&#xA;        decimal transparency = 30;&#xA;        if(new List&lt;string&gt;(BFS.ScriptSettings.GetValueNames()).Contains(TransparencySettingName))&#xA;            transparency = (decimal)BFS.ScriptSettings.ReadValueInt(TransparencySettingName);&#xA;        else&#xA;            BFS.ScriptSettings.WriteValueInt(TransparencySettingName, 30);&#xA;        &#xA;        // add all but the primary monitor to the list of monitors that will be dimmed&#xA;        List&lt;Form&gt; forms = new List&lt;Form&gt;();&#xA;        foreach(uint id in BFS.Monitor.GetMonitorIDs())&#xA;            forms.Add(new TransparentForm(id, transparency));&#xA;        &#xA;        // this will open the forms we added to the list by using our custom application context&#xA;        Application.Run(new MultipleFormApplicationContext(forms));&#xA;    }&#xA;    &#xA;    // this function toggles the script settings from running to not running&#xA;    private static void ToggleSetting()&#xA;    {&#xA;        string status = BFS.ScriptSettings.ReadValue(SettingName);&#xA;        if(status.Equals(&quot;running&quot;, StringComparison.Ordinal))&#xA;            BFS.ScriptSettings.WriteValue(SettingName, &quot;not&quot;);&#xA;        else&#xA;            BFS.ScriptSettings.WriteValue(SettingName, &quot;running&quot;);&#xA;    }&#xA;    &#xA;    // this function allows us to see the currect state of the script&#xA;    private static bool IsTransparentWindowRunning()&#xA;    {&#xA;        string status = BFS.ScriptSettings.ReadValue(SettingName);&#xA;        return status.Equals(&quot;running&quot;, StringComparison.Ordinal);&#xA;    }&#xA;    &#xA;    // extend the ApplicationContext class to support opening multiple forms&#xA;    private class MultipleFormApplicationContext : ApplicationContext &#xA;    {&#xA;        internal MultipleFormApplicationContext(List&lt;Form&gt; forms)&#xA;        {&#xA;            //open each of the forms, and add our closing event to them&#xA;            foreach(Form form in forms)&#xA;            {&#xA;                form.FormClosed &#x2B;= OnFormClosed;&#xA;                form.Show();    &#xA;            }        &#xA;        }&#xA;        &#xA;        // when all the forms close, make sure to exit the application&#xA;        private void OnFormClosed(object sender, EventArgs e)&#xA;        {&#xA;            if(Application.OpenForms.Count == 0)&#xA;                ExitThread();&#xA;        }&#xA;    }&#xA;    &#xA;    // extend the Form class to get the behavior we want&#xA;    private class TransparentForm : Form &#xA;    {&#xA;        // this will tell us what monitor to open on&#xA;        private uint MonitorId;&#xA;        &#xA;        // this will tell us what transparency to use&#xA;        private decimal LastTransparency;&#xA;        &#xA;        // this will help us with some threading&#xA;        private object ThreadLock = new object();&#xA;        &#xA;        // the contructor for our class&#xA;        internal TransparentForm(uint monitorId, decimal transparency)&#xA;        {        &#xA;            this.MonitorId = monitorId;&#xA;            lock(this.ThreadLock)&#xA;                this.LastTransparency = transparency;&#xA;            &#xA;            this.SuspendLayout();&#xA;            &#xA;            // setup the layout of this form&#xA;            this.BackColor = Color.Black;&#xA;            this.FormBorderStyle = FormBorderStyle.None;&#xA;            this.ShowInTaskbar = false;&#xA;            &#xA;            // setup the form load event&#xA;            this.Load &#x2B;= Form_Load;            &#xA;            &#xA;            this.ResumeLayout(false);&#xA;        }&#xA;        &#xA;        private void Form_Load(object sender, EventArgs e)&#xA;        {&#xA;            // set the window to be always on top&#xA;            BFS.Window.SetAlwaysOnTop(this.Handle, true);&#xA;            &#xA;            // make the window transparent&#xA;            lock(this.ThreadLock)&#xA;                BFS.Window.SetTransparency(this.Handle, this.LastTransparency);&#xA;            &#xA;            // add a windows style to the current style that will&#xA;            // tell this window to ignore user input&#xA;            uint style = (uint)BFS.Window.GetWindowStyleEx(this.Handle);&#xA;            BFS.Window.SetWindowStyleEx((BFS.WindowEnum.WindowStyleEx)(style | (uint)BFS.WindowEnum.WindowStyleEx.WS_EX_TRANSPARENT | (uint)BFS.WindowEnum.WindowStyleEx.WS_EX_LAYERED), this.Handle);&#xA;        &#xA;            // move the window to the desired monitor&#xA;            this.Bounds = BFS.Monitor.GetMonitorBoundsByID(this.MonitorId);&#xA;            &#xA;            // start up a thread to listen for an exit event&#xA;            new Thread(new ThreadStart(ExitListener)).Start();&#xA;        }&#xA;        &#xA;        private void ExitListener()&#xA;        {&#xA;            while(true)&#xA;            {&#xA;                // if we should close, tell the main thread to close the form&#xA;                if(!IsTransparentWindowRunning())&#xA;                {&#xA;                    try&#xA;                    {&#xA;                        this.Invoke((MethodInvoker) delegate&#xA;                        {&#xA;                            this.Close();&#xA;                        });&#xA;                    }&#xA;                    catch // something went wrong, ignore&#xA;                    {&#xA;                    }&#xA;                        &#xA;                    break;&#xA;                }&#xA;                &#xA;                // check to see if we need to update the transparency&#xA;                bool isNeedingToUpdateTransparency = false;&#xA;                int transparency = BFS.ScriptSettings.ReadValueInt(TransparencySettingName);&#xA;                lock(this.ThreadLock)&#xA;                {&#xA;                    if(transparency != (int)this.LastTransparency)&#xA;                    {  &#xA;                        this.LastTransparency = (decimal)transparency;&#xA;                        isNeedingToUpdateTransparency = true;&#xA;                    }&#xA;                }&#xA;&#xA;                if(isNeedingToUpdateTransparency)&#xA;                {&#xA;                    decimal temp = (decimal)transparency;&#xA;                    this.Invoke((MethodInvoker) delegate&#xA;                    {&#xA;                        BFS.Window.SetTransparency(this.Handle, temp);&#xA;                    });&#xA;                }&#xA;                &#xA;                // sleep for a quarter of a second&#xA;                BFS.General.ThreadWait(250);&#xA;            }&#xA;        }&#xA;    }&#xA;}</pre><textarea id="code01a11b0976f2744ea14b74e823060da4" name="code01a11b0976f2744ea14b74e823060da4" style="position:absolute;top:0;left:-999999px;width:1px;height:1px"></textarea></div>
</div></div></div>

<p>Here's the second that will increase the value:</p>
<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="#code01a11b0976f7759391c65518a0faca53" 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('code01a11b0976f7759391c65518a0faca53Js'); 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="code01a11b0976f7759391c65518a0faca53Js" name="code01a11b0976f7759391c65518a0faca53Js" 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;    private static readonly string TransparencySettingName = &quot;DimMonitor_TransparentForm_TransparencyValue&quot;;&#xA;    public static void Run(IntPtr windowHandle)&#xA;    {&#xA;        int transparency = BFS.ScriptSettings.ReadValueInt(TransparencySettingName) &#x2B; 5;&#xA;        if(transparency &gt; 100)&#xA;            transparency = 100;&#xA;            &#xA;        BFS.ScriptSettings.WriteValueInt(TransparencySettingName, transparency);&#xA;    }&#xA;}</pre><textarea id="code01a11b0976f7759391c65518a0faca53" name="code01a11b0976f7759391c65518a0faca53" style="position:absolute;top:0;left:-999999px;width:1px;height:1px"></textarea></div>
</div></div></div>

<p>Here's the third that will decrease the value:</p>
<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="#code01a11b0976fa7383b307ec8b75e04ba5" 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('code01a11b0976fa7383b307ec8b75e04ba5Js'); 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="code01a11b0976fa7383b307ec8b75e04ba5Js" name="code01a11b0976fa7383b307ec8b75e04ba5Js" 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;    private static readonly string TransparencySettingName = &quot;DimMonitor_TransparentForm_TransparencyValue&quot;;&#xA;    public static void Run(IntPtr windowHandle)&#xA;    {&#xA;        int transparency = BFS.ScriptSettings.ReadValueInt(TransparencySettingName) - 5;&#xA;        if(transparency &lt; 0)&#xA;            transparency = 0;&#xA;            &#xA;        BFS.ScriptSettings.WriteValueInt(TransparencySettingName, transparency);&#xA;    }&#xA;}</pre><textarea id="code01a11b0976fa7383b307ec8b75e04ba5" name="code01a11b0976fa7383b307ec8b75e04ba5" style="position:absolute;top:0;left:-999999px;width:1px;height:1px"></textarea></div>
</div></div></div>

<p>I hope this works for you!</p>
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#7</link>
<pubDate>Thu, 11 Oct 2018 19:48:06 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#7</guid>
<category>DisplayFusion</category>
<description><![CDATA[I'll pass this over to Thomas to answer, as he was the original author of this script]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
I'll pass this over to Thomas to answer, as he was the original author of this script <img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/face-smile.light.svg" alt=":)" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:16px;height:16px;" HelpButtonData=":)" />
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#6</link>
<pubDate>Wed, 10 Oct 2018 00:24:38 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#6</guid>
<category>DisplayFusion</category>
<description><![CDATA[Just a thought...
Would it be easy to get the script to read the previous transparency value and increase or decrease it by a set increment?
That way, I could have just two scripts to tun the brightness up & down
One that has a hotkey of something like
CTRL SHIFT  -
and another that has a ho...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Just a thought... <br/>
<br/>
Would it be easy to get the script to read the previous transparency value and increase or decrease it by a set increment?<br/>
<br/>
That way, I could have just two scripts to tun the brightness up & down<br/>
<br/>
One that has a hotkey of something like<br/>
CTRL SHIFT  -<br/>
<br/>
and another that has a hotkey of<br/>
CTRL SHIFT +<br/>
<br/>
Any guidance appreciated<br/>
Al
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#5</link>
<pubDate>Wed, 10 Oct 2018 00:16:14 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#5</guid>
<category>DisplayFusion</category>
<description><![CDATA[Hi Keith,
Please could you point out exactly where i need to change the transparency value and how to remove the screen chooser (as i always want all the monitors to fade.
Code
Copy
Select All
using System;&#xA;using System.Drawing;&#xA;using System.Windows.Forms;&#xA;using System.Threading;...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Hi Keith,<br/>
<br/>
Please could you point out exactly where i need to change the transparency value and how to remove the screen chooser (as i always want all the monitors to fade.<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="#code01a11b0977107714a818770b111a797c" 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('code01a11b0977107714a818770b111a797cJs'); 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="code01a11b0977107714a818770b111a797cJs" name="code01a11b0977107714a818770b111a797cJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%;min-height:75px">using System;&#xA;using System.Drawing;&#xA;using System.Windows.Forms;&#xA;using System.Threading;&#xA;using System.Collections.Generic;&#xA;&#xA;// Based entirely on NetMage&#x27;s &quot;Fade All Monitors Except the Primary Monitor to Black&quot; which was based on Thomas&#x27; &quot;Dim All Monitors Except Primary&quot;&#xA;&#xA;public static class DisplayFusionFunction {&#xA;    private static readonly string SettingName = &quot;BlackenMonitors_Run&quot;;&#xA;    public static void Run(IntPtr windowHandle) {&#xA;        //toggle the setting from running to not running, and vice versa&#xA;        ToggleSetting();&#xA;&#xA;        if (RunFadeMonitors()) {&#xA;            //add the selected monitor to the form&#xA;            var forms = new List&amp;lt;Form&amp;gt;();&#xA;            forms.Add(new TransparentForm(BFS.Monitor.ShowMonitorSelector()));&#xA;        &#xA;            //this will open the forms we added to the list by using our custom application context&#xA;            Application.Run(new MultipleFormApplicationContext(forms));&#xA;        }&#xA;    }&#xA;    &#xA;    //this function allows us to see the currect state of the script&#xA;    private static bool RunFadeMonitors() {&#xA;        return BFS.ScriptSettings.ReadValue(SettingName) == &quot;run&quot;;&#xA;    }&#xA;&#xA;    //this function toggles the script settings from running to not running&#xA;    private static void ToggleSetting() {&#xA;        BFS.ScriptSettings.WriteValue(SettingName, RunFadeMonitors() ? &quot;not&quot; : &quot;run&quot;);&#xA;    }&#xA;&#xA;    //extend the ApplicationContext class to support opening multiple forms&#xA;    private class MultipleFormApplicationContext : ApplicationContext {&#xA;        internal MultipleFormApplicationContext(List&amp;lt;Form&amp;gt; forms) {&#xA;            //open each of the forms, and add our closing event to them&#xA;            foreach(Form form in forms) {&#xA;                form.FormClosed &#x2B;= OnFormClosed;&#xA;                form.Show();&#xA;            }&#xA;        }&#xA;&#xA;        //when all the forms close, make sure to exit the application&#xA;        private void OnFormClosed(object sender, EventArgs e) {&#xA;            if(Application.OpenForms.Count == 0)&#xA;                ExitThread();&#xA;        }&#xA;    }&#xA;    &#xA;    //extend the Form class to get the behavior we want&#xA;    private class TransparentForm : Form {&#xA;        //this will tell us what monitor to open on&#xA;        private uint MonitorId;&#xA;        private uint FadeWait;&#xA;        private decimal TransparentIncrement;&#xA;        &#xA;        //this will tell us our current transparency&#xA;        private decimal Transparency;&#xA;        &#xA;        //the contructor for our class&#xA;        internal TransparentForm(uint monitorId) {        &#xA;            MonitorId = monitorId;&#xA;            Transparency = 0m;&#xA;            const decimal FadeTime = 2.0m; // seconds&#xA;            TransparentIncrement = 1m; // percent&#xA;            FadeWait = (uint)(TransparentIncrement * 10m * FadeTime);&#xA;            &#xA;            SuspendLayout();&#xA;            &#xA;            //setup the layout of this form&#xA;            BackColor = Color.Black;&#xA;            FormBorderStyle = FormBorderStyle.None;&#xA;            ShowInTaskbar = false;&#xA;            //move the window to the desired monitor&#xA;            Rectangle bounds = BFS.Monitor.GetMonitorBoundsByID(MonitorId);&#xA;            Location = new Point(bounds.X, bounds.Y);&#xA;            Size = new Size(bounds.Width, bounds.Height);&#xA;            StartPosition = FormStartPosition.Manual;&#xA;            &#xA;            BFS.Window.SetAlwaysOnTop(Handle, true);&#xA;            BFS.Window.SetTransparency(Handle, Transparency);&#xA;&#xA;            //setup the form load event&#xA;            Load &#x2B;= Form_Load;            &#xA;            &#xA;            ResumeLayout(false);&#xA;        }&#xA;        &#xA;        private void Form_Load(object sender, EventArgs e) {&#xA;            //add a windows style to the current style that will&#xA;            //tell this window to ignore user input&#xA;            uint style = (uint)BFS.Window.GetWindowStyleEx(Handle) | (uint)BFS.WindowEnum.WindowStyleEx.WS_EX_TRANSPARENT | (uint)BFS.WindowEnum.WindowStyleEx.WS_EX_LAYERED;&#xA;            BFS.Window.SetWindowStyleEx((BFS.WindowEnum.WindowStyleEx)style, Handle);&#xA;            &#xA;            //start up a thread to listen for an exit event&#xA;            new Thread(new ThreadStart(ExitListener)).Start();&#xA;        }&#xA;&#xA;        private void ExitListener() {&#xA;            while(true) {&#xA;                //if we should close, tell the main thread to close the form&#xA;                if(RunFadeMonitors()) {&#xA;                    // Fade to Black&#xA;                    if (Transparency &amp;lt; 100m) {&#xA;                        Transparency &#x2B;= TransparentIncrement;&#xA;                        BFS.Window.SetTransparency(Handle, Transparency);&#xA;                    }&#xA;&#xA;                    //sleep&#xA;                    BFS.General.ThreadWait((Transparency &amp;lt; 100m) ? FadeWait : 250u);                &#xA;                }&#xA;                else {&#xA;                    if (this.Transparency &amp;gt; 0m) {&#xA;                        // Fade back in&#xA;                        Transparency -= TransparentIncrement;&#xA;                        BFS.Window.SetTransparency(Handle, Transparency);&#xA;&#xA;                        //sleep&#xA;                        BFS.General.ThreadWait((Transparency &amp;lt; 100m) ? FadeWait : 250u);&#xA;                    }&#xA;                    else {&#xA;                        try {&#xA;                            this.Invoke((MethodInvoker) delegate {&#xA;                                Close();&#xA;                            });&#xA;                        }&#xA;                        catch { //something went wrong, ignore&#xA;                        }&#xA;                        &#xA;                        break;&#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;}</pre><textarea id="code01a11b0977107714a818770b111a797c" name="code01a11b0977107714a818770b111a797c" style="position:absolute;top:0;left:-999999px;width:1px;height:1px"></textarea></div>
</div></div></div><br/>
<br/>
Many thanks in advance<br/>
<br/>
Al
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#4</link>
<pubDate>Sat, 28 Oct 2017 00:33:23 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#4</guid>
<category>DisplayFusion</category>
<description><![CDATA[Thanks for the feedback, guys! Scheduling will be coming hopefully in the next major version. In the meantime, you could duplicate my script, change the fading level in it, and then call whichever one you need via DisplayFusionCommand.exe like so:
"C:\Program Files (x86)\DisplayFusion\DisplayFus...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Thanks for the feedback, guys! Scheduling will be coming hopefully in the next major version. In the meantime, you could duplicate my script, change the fading level in it, and then call whichever one you need via DisplayFusionCommand.exe like so:<br/>
<br/>
"C:\Program Files (x86)\DisplayFusion\DisplayFusionCommand" -functionrun "ScriptedFunctionName"<br/>
<br/>
Hope that helps!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#3</link>
<pubDate>Thu, 26 Oct 2017 19:09:27 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#3</guid>
<category>DisplayFusion</category>
<description><![CDATA[It sounds like similar functionality to F.lux (scheduled fade times / duration), though not as advanced as what you have set up (kudos on that, btw!)  What you are requesting would be a great feature, then I could stop using F.lux and Palingo.
I would also like to add upon this request - It woul...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
It sounds like similar functionality to F.lux (scheduled fade times / duration), though not as advanced as what you have set up (kudos on that, btw!)  What you are requesting would be a great feature, then I could stop using F.lux and Palingo.<br/>
<br/>
I would also like to add upon this request - It would be nice to have a quick control for changing the dimming percentage, like Palingo does, in the taskbar (fader or a list of values would be nice), since at times, during the faded period, it is necessary to disable / adjust the fade quickly.<br/>
<br/>
Finally, a quick fade from brightness levels (from 100% to 50%, for example) in increments of 10% over 5 seconds would be much nicer on the eyes, rather than a quick 'bam' from 100% to 50%.  This is most noticeable when fading the non-active window and switching between them.
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#2</link>
<pubDate>Thu, 26 Oct 2017 18:46:55 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6#2</guid>
<category>DisplayFusion</category>
<description><![CDATA[PS: It would be great to see some scheduling options in the Fading GUI (and perhaps even some ability to link it to the sunset / sunrise data from weather.com based on your nearest city)
I wish I was clever enough to write a function for this, alas I'm not; so it's a suggestion for a future release]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
PS: It would be great to see some scheduling options in the Fading GUI (and perhaps even some ability to link it to the sunset / sunrise data from weather.com based on your nearest city) <br/>
<br/>
I wish I was clever enough to write a function for this, alas I'm not; so it's a suggestion for a future release <img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/face-smile.light.svg" alt=":)" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:16px;height:16px;" HelpButtonData=":)" />
</div>
]]></content:encoded>
</item>
<item>
<title>Screen fading on a schedule</title>
<link>https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6</link>
<pubDate>Thu, 26 Oct 2017 18:38:32 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/screen-fading-on-a-schedule/?ID=d36bc03f-48bd-40a0-8bda-eb4fabc25be6</guid>
<category>DisplayFusion</category>
<description><![CDATA[Hi,
I'm delighted to see the inclusion of screen fading GUI in the latest release of DF.
(which is great, the only bug so far is the dimming flickers when Windows system notifications appear).
I work in a conservatory, so my monitors need to be full brightness during the day, gradually fading ...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Hi,<br/>
<br/>
I'm delighted to see the inclusion of screen fading GUI in the latest release of DF.<br/>
(which is great, the only bug so far is the dimming flickers when Windows system notifications appear).<br/>
<br/>
I work in a conservatory, so my monitors need to be full brightness during the day, gradually fading as it turns to dusk.<br/>
<br/>
I've been using a piece of software called "Pangolin Screen Brightness" to control this for years.  Its a very simple app, so I had to string together batch scripts which altered the registry entry for the dimming value.  This was a belts & braces approach but it worked.<br/>
<br/>
Now I'm looking to replicate this in DF. I have seen there are a few functions already scripted (such as "<i>Fade Selected Monitor to Black</i>" by BF's very own Keith Lammers) which presumably could be altered to dim all screens.  Its the scheduling I need some advice on please:<br/>
<br/>
SIMPLE APPROACH:<br/>
Is it possible to schedule the dimming level to change at set times of the day using functions?<br/>
<br/>
ADVANCED APPROACH:<br/>
I use a Z-Wave multi sensor to detect the light level in my conservatory (this alters sporadically due to the cloud cover, rain etc).  I use Event Ghost to perform actions when the light levels rise / fall above certain thresholds*.  Can I somehow make a procedure call (or command line call etc) to trigger a function to change the dimming level?<br/>
<br/>
Thanks in advance for any advice.<br/>
<br/>
Regards<br/>
Al<br/>
<br/>
* For anybody who's interested; I use a SmartApp within the Samsung SmartThings IDE to automatically make a HTTP call to Event Ghost on my PC when the light sensor reaches certain levels.  EvenGhost can then run a batch / call or whatever's needed to interface with Display Fusion.
</div>
]]></content:encoded>
</item>
</channel>
</rss>