Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

User Image
solaris765
40 discussion posts
The Problem I am having is that I'm using BFS.DisplayFusion.RunFunction("") in a scripted function meant to be used as a toggle for another function. The former is supposed to run until I run the function again.

The problem I am having is that as soon as the latter is finished running the former quits as well instead of staying persistent.
Dec 30, 2014  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Could you post the script code so that we can test this out here?

Thanks!
Dec 31, 2014  • #2
User Image
solaris765
40 discussion posts
This is the code that is bugged

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
if (BFS.ScriptSettings.ReadValue("ProfileToggle") == "on" || BFS.ScriptSettings.ReadValue("ProfileToggle") == "")
{
BFS.ScriptSettings.WriteValue("ProfileToggle", "off");
}
else if (BFS.ScriptSettings.ReadValue("ProfileToggle") == "off" )
{
BFS.DisplayFusion.RunFunction("Update Monitor Profile Automatically"); <-should stay on but doesn't
BFS.ScriptSettings.WriteValue("ProfileToggle", "on");
}
else
{
BFS.Dialog.ShowMessageErrorMonospaced("Value of ProfileToggle Script Setting is incorrect.");
}

BFS.Dialog.ShowMessageInfo(BFS.ScriptSettings.ReadValue("ProfileToggle"));
}
}


and this is mock code for easy demonstration

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
while (BFS.ScriptSettings.ReadValue("ProfileToggle") != "off")
{
//run forever-ish
}
}
}
Dec 31, 2014  • #3
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
It looks like you might need to reverse these 2 lines from this:

Code

BFS.DisplayFusion.RunFunction("Update Monitor Profile Automatically"); <-should stay on but doesn't
BFS.ScriptSettings.WriteValue("ProfileToggle", "on");


To this:

Code

BFS.ScriptSettings.WriteValue("ProfileToggle", "on");
BFS.DisplayFusion.RunFunction("Update Monitor Profile Automatically"); <-should stay on but doesn't


Your "on" setting needs to be set before you run your other function. :)
Jan 2, 2015  • #4
User Image
solaris765
40 discussion posts
-.- wow. Thank you. Can't believe I didn't see that.
Jan 2, 2015  • #5
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)