<?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: Scripted Function Bug Support.</title>
<atom:link href="https://www.displayfusion.com/Discussions/RSS/?TopicID=4626242d-8ad3-4998-a6cc-3033f8209134" rel="self" type="application/rss+xml" />
<link>https://www.displayfusion.com/Discussions/RSS/?TopicID=4626242d-8ad3-4998-a6cc-3033f8209134</link>
<description>DisplayFusion RSS: Scripted Function Bug Support.</description>
<lastBuildDate>Thu, 30 Apr 2026 22:25:38 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.displayfusion.com/Discussions/RSS/?TopicID=4626242d-8ad3-4998-a6cc-3033f8209134</generator>
<item>
<title>RE: Scripted Function Bug Support.</title>
<link>https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#7</link>
<pubDate>Tue, 17 Mar 2015 14:33:27 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#7</guid>
<category>DisplayFusion</category>
<description><![CDATA[Awesome, glad to hear you got it sorted out! We received the submissions for those scripts this morning too, so we'll add them to the repository as soon as we've had a chance to test them here
Thanks!]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Awesome, glad to hear you got it sorted out! We received the submissions for those scripts this morning too, so we'll add them to the repository as soon as we've had a chance to test them here <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=":)" HelpButtonDataAlign="BelowMiddle" /><br/>
<br/>
Thanks!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Scripted Function Bug Support.</title>
<link>https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#6</link>
<pubDate>Mon, 16 Mar 2015 21:12:43 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#6</guid>
<category>DisplayFusion</category>
<description><![CDATA[After my original post I did make some changes on how the script interacted with itself, monitor profiles and the primary screen resolution. And at this point with my own testing I haven't run into any more of the same errors.
I'm going to continue stress testing the script and if I can't break ...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
After my original post I did make some changes on how the script interacted with itself, monitor profiles and the primary screen resolution. And at this point with my own testing I haven't run into any more of the same errors. <br/>
<br/>
I'm going to continue stress testing the script and if I can't break it you can drop this thread. <br/>
<br/>
The version of the script I gave you was yet untested as I was working on it when you replied to the thread so it might actually work fine at this point.<br/>
<br/>
Edit: As a side note. Sometimes when I do run the script to change the monitor profile. The windows task bar disappears and the Display Fusion task bars appear half height. Its easily fixed by moving the windows task bar to a different side of the screen and back. But it is a bit annoying.<br/>
<br/>
Edit 2: I've done my testing and everything is in order. It looks like I was applying the monitor profiles to the wrong resolution before. <br/>
Thanks for taking a look though! <img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/face-laugh-squint.light.svg" alt=":D" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:16px;height:16px;" HelpButtonData=":D" HelpButtonDataAlign="BelowMiddle" />
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Scripted Function Bug Support.</title>
<link>https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#5</link>
<pubDate>Mon, 16 Mar 2015 19:41:02 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#5</guid>
<category>DisplayFusion</category>
<description><![CDATA[Thank you
I feel like I may need to add that in order for the program to continue the nvidia control panel must be closed.]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Thank you <br/>
I feel like I may need to add that in order for the program to continue the nvidia control panel must be closed.
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Scripted Function Bug Support.</title>
<link>https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#4</link>
<pubDate>Mon, 16 Mar 2015 18:40:09 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#4</guid>
<category>DisplayFusion</category>
<description><![CDATA[Thanks! We'll check this out and see what we can find]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Thanks! We'll check this out and see what we can find <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=":)" HelpButtonDataAlign="BelowMiddle" />
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Scripted Function Bug Support.</title>
<link>https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#3</link>
<pubDate>Mon, 16 Mar 2015 18:15:45 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#3</guid>
<category>DisplayFusion</category>
<description><![CDATA[Absolutely!
I'm actually working on this as we speak.
Code
Copy
Select All
using System;
using System.Drawing;
// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Window Location target when run by a Window Location rule...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Absolutely!<br/>
<br/>
I'm actually working on this as we speak.<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="#code019de07f6361704b81f360efea313768" 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('code019de07f6361704b81f360efea313768Js'); 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="code019de07f6361704b81f360efea313768Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Drawing;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Window Location target when run by a Window Location rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
//Nvidia control panel executable location.
string nvctl = "A:\\Program Files\\NVIDIA Corporation\\Control Panel Client\\nvcplui.exe";

//Can add to or remove from list to fit needs.
string[] predictedPrograms = {
"A:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
"A:\\Program Files\\Logitech Gaming Software\\LCore.exe",
"A:\\Program Files (x86)\\Skype\\Phone\\Skype.exe"
};

//Saves all running Programs
string[] arr = BFS.Application.GetAllRunningApplicationFiles();

//Close predicted Programs.
for (int i = 0; i &lt; predictedPrograms.Length; ++i)
BFS.Application.Kill(BFS.Application.GetAppIDByFile(predictedPrograms&#91i&#93));

BFS.Application.Start(nvctl, "");
System.Threading.Thread.Sleep(800); //Wait

BFS.Window.SetLocation(BFS.Window.GetWindowByText("NVIDIA Control Panel"),0,0);

if (BFS.ScriptSettings.ReadValue("Surround") == "true")
DisableSurround();
else
EnableSurround();

//Wait for nvctl to get closed by user.
BFS.Application.WaitForExitByFile(nvctl,0);

//Re-Open predicted Programs.
for (int i = 0; i &lt; arr.Length; ++i)
if (!BFS.Application.IsAppRunningByFile(arr&#91i&#93))
BFS.Application.Start(arr&#91i&#93, "");
/*
// default Resolution
if (BFS.ScriptSettings.ReadValue("Surround") == "false")
BFS.DisplayFusion.RunFunction("Load Monitor Profile: Default");

// nVidia Surround / AMD Eyefinity
else if (BFS.ScriptSettings.ReadValue("Surround") == "true")
BFS.DisplayFusion.RunFunction("Load Wallpaper Profile: Nvidia Surround");*/

BFS.DisplayFusion.RunFunction("Update Monitor Profile");

//included toggle
if (BFS.ScriptSettings.ReadValue("Surround") == "false")
BFS.ScriptSettings.WriteValue("Surround", "true");
else
BFS.ScriptSettings.WriteValue("Surround", "false");

}

//Manipulates Nvidia control panel to Enable Surround.
public static void EnableSurround()
{

BFS.Input.SetMousePosition(337, 279);
BFS.Input.LeftClickMouse();
System.Threading.Thread.Sleep(500); //Wait

BFS.Input.SetMousePosition(831, 685);
BFS.Input.LeftClickMouse();
System.Threading.Thread.Sleep(500); //Wait
}

//Manipulates Nvidia control panel to Disable Surround.
public static void DisableSurround()
{

BFS.Input.SetMousePosition(337, 258);
BFS.Input.LeftClickMouse();
System.Threading.Thread.Sleep(500); //Wait

BFS.Input.SetMousePosition(831, 685);
BFS.Input.LeftClickMouse();
System.Threading.Thread.Sleep(500); //Wait

}

}</pre><textarea id="code019de07f6361704b81f360efea313768" name="code019de07f6361704b81f360efea313768" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
And this is currently the code its calling that's causing the bugs above. It works the same integrated into the end of the above in place of the function call or as it is now.<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="#code019de07f6364747aaea384f9e3012e8f" 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('code019de07f6364747aaea384f9e3012e8fJs'); 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="code019de07f6364747aaea384f9e3012e8fJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Drawing;
using System.Windows.Forms;

//Code brought to you by: solaris765
//Because numbers after my screen name are fun.
//Automatically changes Monitor Profile based on resolution changes.
//
// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Window Location target when run by a Window Location rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
int defaultResolutionWidth = 1920;
int nonstandardReslolutionWidth = 5760;

// default Resolution
if (Screen.PrimaryScreen.Bounds.Width == defaultResolutionWidth)
{
BFS.DisplayFusion.LoadMonitorProfile("Default");
BFS.ScriptSettings.WriteValue("Profile", "Default");
}

// nVidia Surround / AMD Eyefinity
else if (Screen.PrimaryScreen.Bounds.Width == nonstandardReslolutionWidth)
{
BFS.DisplayFusion.LoadMonitorProfile("Nvidia Surround");
BFS.ScriptSettings.WriteValue("Profile", "Nvidia Surround");
}
}
}</pre><textarea id="code019de07f6364747aaea384f9e3012e8f" name="code019de07f6364747aaea384f9e3012e8f" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Scripted Function Bug Support.</title>
<link>https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#2</link>
<pubDate>Mon, 16 Mar 2015 18:07:37 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134#2</guid>
<category>DisplayFusion</category>
<description><![CDATA[Could you attach a copy of the script so that we can test this out here?
Thanks!]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Could you attach a copy of the script so that we can test this out here?<br/>
<br/>
Thanks!
</div>
]]></content:encoded>
</item>
<item>
<title>Scripted Function Bug Support.</title>
<link>https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134</link>
<pubDate>Sat, 14 Mar 2015 23:51:01 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/scripted-function-bug-support/?ID=4626242d-8ad3-4998-a6cc-3033f8209134</guid>
<category>DisplayFusion</category>
<description><![CDATA[I'm Writing a bit of Code to replace my "Update Monitor Profile Automatically" Function but I'm running into a similar set of bugs.
The problem is that if I try to change my monitor profile within my function it'll throw this error.
Code
Copy
Select All
An error has occurred while applying y...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
I'm Writing a bit of Code to replace my "Update Monitor Profile Automatically" Function but I'm running into a similar set of bugs.<br/>
<br/>
The problem is that if I try to change my monitor profile within my function it'll throw this error.<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="#code019de07f636d70dea6c2b5ce3722d069" 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('code019de07f636d70dea6c2b5ce3722d069Js'); 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="code019de07f636d70dea6c2b5ce3722d069Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">An error has occurred while applying your new Monitor configuration.
Please check your settings and try again.
Error: CurrentMonitor is NULL [1]: Current: [NVIDIA GeForce GTX 970\Generic PnP Monitor (ID: 2 • Primary: False • Attached: False • Extra: False • Split: False • Split Padding: L=0, R=0, T=0, B=0 • Bounds: {X=0,Y=0,Width=0,Height=0} • WorkArea: {X=0,Y=0,Width=0,Height=0} • Clone: {X=0,Y=0,Width=0,Height=0} • Driver: Unknown • Device: \\.\DISPLAY30 • TA:ID: 0 • TA:AID: 0:0 • Output: Other • DPIScaleX: 0 • DPIScaleY: 0 • Orientation: Landscape)] All: Count: 4
- NVIDIA GeForce GTX 970\IPS236 (ID: 1 • Primary: False • Attached: False • Extra: False • Split: False • Split Padding: L=0, R=0, T=0, B=0 • Bounds: {X=0,Y=0,Width=0,Height=0} • WorkArea: {X=0,Y=0,Width=0,Height=0} • Clone: {X=0,Y=0,Width=0,Height=0} • Driver: Unknown • Device:  • TA:ID: 1048850 • TA:AID: 359663079:0 • Output: DisplayPortExternal • DPIScaleX: 0 • DPIScaleY: 0 • Orientation: Landscape)
- NVIDIA GeForce GTX 970\IPS236 (ID: 2 • Primary: True • Attached: True • Extra: False • Split: False • Split Padding: L=0, R=0, T=0, B=0 • Bounds: {X=0,Y=0,Width=1920,Height=1080} • WorkArea: {X=0,Y=0,Width=1920,Height=1040} • Clone: {X=0,Y=0,Width=0,Height=0} • Driver: Builtin • Device: \\.\DISPLAY29 • TA:ID: 1048852 • TA:AID: 359663079:0 • Output: DisplayPortExternal • DPIScaleX: 0 • DPIScaleY: 0 • Orientation: Landscape)
- NVIDIA GeForce GTX 970\IPS236 (ID: 3 • Primary: False • Attached: False • Extra: False • Split: False • Split Padding: L=0, R=0, T=0, B=0 • Bounds: {X=0,Y=0,Width=0,Height=0} • WorkArea: {X=0,Y=0,Width=0,Height=0} • Clone: {X=0,Y=0,Width=0,Height=0} • Driver: Unknown • Device:  • TA:ID: 1048849 • TA:AID: 359663079:0 • Output: HDMI • DPIScaleX: 0 • DPIScaleY: 0 • Orientation: Landscape)
- NVIDIA GeForce GTX 970\DELL 2005FPW (ID: 4 • Primary: False • Attached: False • Extra: False • Split: False • Split Padding: L=0, R=0, T=0, B=0 • Bounds: {X=0,Y=0,Width=0,Height=0} • WorkArea: {X=0,Y=0,Width=0,Height=0} • Clone: {X=0,Y=0,Width=0,Height=0} • Driver: Unknown • Device:  • TA:ID: 1048848 • TA:AID: 359663079:0 • Output: DVI • DPIScaleX: 0 • DPIScaleY: 0 • Orientation: Landscape)</pre><textarea id="code019de07f636d70dea6c2b5ce3722d069" name="code019de07f636d70dea6c2b5ce3722d069" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
or this error <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="#code019de07f636f752683ea6048d7e50527" 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('code019de07f636f752683ea6048d7e50527Js'); 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="code019de07f636f752683ea6048d7e50527Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">An error has occurred while applying your new Monitor configuration.
Please check your settings and try again.
Error: Failed to call SetDisplayConfig. [HR: 87]</pre><textarea id="code019de07f636f752683ea6048d7e50527" name="code019de07f636f752683ea6048d7e50527" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
Depending on which profile its calling.<br/>
<br/>
It should be noted that if I run the profile switch from the monitor configuration control panel or its own function it runs fine.
</div>
]]></content:encoded>
</item>
</channel>
</rss>