Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
solaris765
40 discussion posts
First off on a slightly unrelated note.
Is there documentation for the BFS script for writing functions? And if so where can I find it.

So what my question really is, is there a way to manipulate the save/ restore window position function through scripting?
This would be awesome for making monitor configurations that much more powerful.
Nov 13, 2014  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
There isn't any browseable documentation at the moment, but if you type "BFS." you'll get an Intellisense type box with the available namespaces. You can click each one to get a tooltip, and after typing a name space, the Intellisense box will switch to all of the functions available in that namespace, which also have tooltips that show the syntax and examples.

What exactly were you looking to change in the Save/Restore Window Positions via script?
Nov 14, 2014  • #2
User Image
solaris765
40 discussion posts
Oh cool thanks. I was thinking I would setup an Nvidia surround profile with pre-opened programs in specific locations and the same for my standard use.

I may play with more scripting and get more profiles going but I want to achieve this goal first.

The reason I wanted to use the save window location feature is so child windows can be pre-positioned as well. since "open window location" doesn't seem to work with them.

I guess my follow up question would be: Is there a way to export Window Save positions to a file or a list? So I can keep multiple instances of data.
Nov 14, 2014  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, I've investigated, but currently it's not possible to do because of the way that the Save Window Position function works.

If we're able to make this possible in a future version, I'll be sure to let you know!

In the meantime, it is still possible to write a script to launch applications and put them in specific locations, and if you can launch the child windows via the script (command line, simulated click, or whatever), you should also be able to position them with the script as well.

If you'd like an example script, please let me know and we'll whip one up :)
Nov 25, 2014  • #4
User Image
solaris765
40 discussion posts
hmm would it be possible to set position by window name? Because if that's the case then I think I can get this working.
Nov 26, 2014  • #5
Keith Lammers (BFS)'s profile on WallpaperFusion.com
It's not possible at the moment, but we'll definitely take a look and see if we can add it :)
Nov 26, 2014  • #6
User Image
solaris765
40 discussion posts
Awesome, thank you. I think I can technically do it by retrieving all active window handles and using those to search for a specific string but that seems like a very inneffieceint and roundabout way of doing things.
Especially sinceit will require loops and arrays every time its called.
Nov 27, 2014  • #7
User Image
solaris765
40 discussion posts
So I went ahead and wrote the code necessary to achieve my goal, I was wrong about the arrays. I didn't need any.
It works like a charm, however the more windows that are open the more inefficient that becomes.

Code

using System;
using System.Drawing;
using System.Windows.Forms;

public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
IntPtr[] handles = BFS.Window.GetVisibleWindowHandles();
int len = handles.Length;

IntPtr steam = new IntPtr();
IntPtr friends = new IntPtr();
IntPtr chat = new IntPtr();

////////////////////////////////////////////////////////////////////////

for (int i = 0; i < len; i++)
{
if (BFS.Window.GetText(handles[i]) == "Steam")
steam = handles[i]v;

else if (BFS.Window.GetText(handles[i]) == "Friends")
friends = handles[i]v;

//If anything else contains the string " - Chat" this will not work.
//But there isn't much I can do abnout that.
else if (BFS.Window.GetText(handles[i]).IndexOf(" - Chat") > 0)
chat = handles[i]v;
}

////////////////////////////////////////////////////////////////////////

//I would rather check the loaded monitor profile.
if (Screen.PrimaryScreen.Bounds.Width == 1920) 
{
BFS.Window.SetSizeAndLocation(steam,-1920,0,1000,663);
BFS.Window.SetSizeAndLocation(friends,-220,0,220,1039);
BFS.Window.SetSizeAndLocation(chat,-902,553,663,387);
}

else
{ 
BFS.Window.SetSizeAndLocation(steam,0,0,1000,663);
BFS.Window.SetSizeAndLocation(friends,1700,0,220,1039);
BFS.Window.SetSizeAndLocation(chat,1018,553,663,387);
}

}
}
Nov 29, 2014  • #8
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Nice! We are adding the ability to get the handle by window title in the next beta. I'll let you know as soon as it's available :)
Dec 1, 2014  • #9
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Just a quick heads up that the latest beta now has the ability to get a window handle by window title in the script editor :)

You can use BFS.Window.GetWindowByText.

Thanks!
Dec 8, 2014 (modified Dec 8, 2014)  • #10
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)