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
James Stansell
10 discussion posts
I've been an avid pro user of DF for about a year now and loooove it. Anyway, I'm trying to figure out if i can add custom functions on to the changing of a profile. Specifically, I'm trying to do the following:

I have two monitors in two different rooms. I've set up the profiles to change the primary monitor and default sound device with a custom key combination. However, since the monitors are in different rooms, I also want all the windows to shift to the other monitor at the same time. Right now I'm just using the "move all windows to current monitor' shortcut, but this of course requires another key combination. It's not a huge inconvenience, but if possible I would like it to switch the windows to the primary monitor or next screen along with the profile change. I know I could change the profiles to just disable the second monitor, hence moving all the windows, but I'd still prefer being able to leave both monitors connected.

Thank you very much!!!
Nov 26, 2014  • #1
User Image
solaris765
40 discussion posts
This is possible with a custom function.
If you don't want to/don't know how to write it I could get it written for you later today.
Just let me know. :D
Nov 26, 2014  • #2
User Image
James Stansell
10 discussion posts
awesome! i'd certainly be willing to learn, do you know if there's a guide or how-to written up somewhere? (unless it's something like java script, in that case i'm lost). if not, i'd very much appreciate you writing up the function for me. thanks!
Nov 26, 2014  • #3
User Image
solaris765
40 discussion posts
On the function tab there are some buttons at the top. The one that says add scripted is what you want.

The code can be in C# or visual basic. Default is C#.
There isn't any documentation on display fusions functions yet so what you're going to do is type BFS. And an intellisense box will show up that you can go through to get more information on what functions do what.

I won't be back at my computer till later today so I can't give you more detail then that off memory. I'll post back here when I have more info for you if need be.
Nov 26, 2014  • #4
User Image
James Stansell
10 discussion posts
ah apparently i was still using stable, while this is a beta feature. so i updated to beta and have been messing around with the code. i have no real idea how C# works, but i did manage to make the function work.... almost. here's what i have so far:

Code

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)
{
//running a custom scripted function is the same as running a regular function from the DisplayFusion API.
//just reference the function by name, and DisplayFusion will run it
BFS.DisplayFusion.RunFunction("Load Next Monitor Profile (alphabetically)");

//you can run built-in functions too
BFS.DisplayFusion.RunFunction("Move All Windows to Current Monitor");
}
}


this code does exactly what i want it to do, but ONLY if i run it from the code editor. once i run it from a hotkey or titlebar button, nothing happens. DF pops up a "running: room switch", but it doesn't change anything.

i'm assuming this line is the issue:

Code

public static void Run(IntPtr windowHandle)


since it says this above:

Code

// 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


but sadly i have no earthly idea what the parameter needs to be changed to.
Nov 26, 2014  • #5
Keith Lammers (BFS)'s profile on WallpaperFusion.com
That was actually a bug in 7.0 Beta 9, but we've just posted 7.0 Beta 10, and it should be all fixed up. Could you try running your function from the hotkey again after updating to Beta 10?
Nov 26, 2014  • #6
User Image
James Stansell
10 discussion posts
yep that did the trick! thanks a bunch guys, works like a charm! i'm off to disable the toast message pop-ups now :laugh:
Nov 26, 2014  • #7
User Image
solaris765
40 discussion posts
Not bad. Congrats buddy.
Nov 27, 2014  • #8
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Awesome! You can disable the toast popups in the Settings > Advanced Settings window :)
Nov 27, 2014  • #9
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)