Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
Jay64
11 discussion posts
I thought I did the right thing, I made a function for stickey notes to move it to my second monitor near the top of the screen.

Steps: Window Location
Enable
Add
Select Application --->C:\Windows\System32\StikyNot.exe
Use current monitor (4 30" 1600p screenS)
Window Size ---> Run Selected function on the Window
Location ---> All Windows
Function --> Edit Function
Function Action: Manage Window

Custom Function Actions
Move window to specified location Position X 2560 Positiony 150
Dont change width (BTW if you use the target to link a location it just fills in width/height change

When this is done when I open stickey notes it goes to the top far right of the screen. The only way to get it to work is I make this function a hot key. My goal though is to:

Make a Hotkey and for this one hotkey to open the program, and move the window. I cant find anything on macros can someone help me figure out how to do this?
Nov 24, 2014  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
We should actually be able to do this with the Scripted Functions in the DisplayFusion 7.0 beta. I'll see if I can whip one up for you tomorrow :)
Nov 25, 2014  • #2
User Image
solaris765
40 discussion posts
I've been trying to do the same thing for a couple of days as well through scripted functions.

It's safe to say I'm still learning, but so far I can't seem to get it working with child windows. Specifically the steam friends list and chat box. If I make any breakthroughs I'll post back here.
Nov 25, 2014  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
@Jay: We need to make a small change to the scripting functions for Beta 10, and then I'll have a script for you :)

@Solaris: Could you attach your existing script, and let me know what issues you're having with it? We'll check it out and see if there's a way to improve it.
Nov 25, 2014  • #4
User Image
solaris765
40 discussion posts
Well I have been gathering opened window information with this:

Code

using System;
using System.Drawing;
using System.Collections.Generic;

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

int len = handles.Length;
SortedDictionary<int, string> positions = new SortedDictionary<int, string>();
string output = "";

for (int i = 0; i < len; i++)
{
positions.Add((int)handles[i], BFS.Window.GetBounds(handles[i].ToString());
}

foreach (KeyValuePair<int, string> key in positions)
{
output += "ID: " + key.Key + " Location: " + key.Value + " "
+ BFS.Window.GetText((IntPtr)key.Key) + "\r\n";
}

BFS.Dialog.ShowMessageInfo(output);
}
}

Which is great.
(side note here. the format.string function does not work very well with BFS.Dialog.ShowMessageInfo.)

And this is what I'm using to move the windows to its desired location. I haven't had time to try anything for child windows yet.

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
if (BFS.Application.IsAppRunningByFile(@"C:\Program Files (x86)\Steam\Steam.exe"))
{
IntPtr steam = BFS.Application.GetMainWindowByAppID(BFS.Application.GetAppIDByFile(@"C:\Program Files (x86)\Steam\Steam.exe"));
BFS.Window.SetSizeAndLocation(steam,1,1,1000,663);
}
}
}


edit: trimmed the code of unneeded comments.
Nov 26, 2014 (modified Nov 26, 2014)  • #5
User Image
Jay64
11 discussion posts
Appreciate the hard work!
Nov 26, 2014  • #6
Keith Lammers (BFS)'s profile on WallpaperFusion.com
What issues were you running into with format.string?
Nov 27, 2014  • #7
User Image
solaris765
40 discussion posts
mainly the padding I rewrote some of my code to include a formatted string. so you can see the problem more clearly.

Code

using System;
using System.Drawing;
using System.Collections.Generic;

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

int len = handles.Length;
SortedDictionary<int, string> positions = new SortedDictionary<int, string>();

string formatted = "";

for (int i = 0; i < len; i++)
{
positions.Add((int)handles[i], BFS.Window.GetBounds(handles[i]).ToString());
}

foreach (KeyValuePair<int, string> key in positions)
{
formatted += string.Format("ID: {0,-15} Location: {1,50} {2} \r\n", key.Key, key.Value,
BFS.Window.GetText((IntPtr)key.Key)); 
}

BFS.Dialog.ShowMessageInfo(formatted);
}
}


When you run the output my goal is to have each section line-up in the output.

FYI I just started to learn C# about a week ago coming from a c++ background so its very possible this is my problem.
Nov 27, 2014 (modified Nov 27, 2014)  • #8
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, cool! For the next beta, we're adding a ShowMessageInfoMonospaced function that should hopefully do the trick :)
Dec 1, 2014  • #9
User Image
solaris765
40 discussion posts
The mono spaced function works great! thanks for getting this working!
Dec 5, 2014  • #10
Keith Lammers (BFS)'s profile on WallpaperFusion.com
No problem, glad to hear it!
Dec 8, 2014  • #11
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)