Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
alex334
3 discussion posts
Hey

I'm currently playing with DisplayFusion for a potential project. Basically we need Firefox to open in full screen mode (like when you press F11).
I'm using DisplayFusion-9.1 (portable version) and the OS is Win10.

When DisplayFusion is running, I open Firefox (or Chrome) and I press F11, it doesn't go to full screen. If I close DisplayFusion and I press F11 then FF (or Chrome) goes to full screen.
How can I make sure that when I press F11, it works as expected when DF is running?

It seems the script "Open Website in Default Web Browser and Full Screen on Specific Monitor" only moves the window to the second monitor, but it fails to go full screen.
I tried SendKeys with "{F11}" and "{VK_122}" but it doesn't work.
How to make this script working?

Thanks
Alex
Dec 18, 2017  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
That's really strange! F11 works fine over here, with and without DisplayFusion running. Could you attach a copy of your troubleshooting info?
  • Open the Settings > Troubleshooting tab
  • Click the "Export Info to File" button
  • Reply with the file attached
Dec 18, 2017 (modified Dec 18, 2017)  • #2
User Image
alex334
3 discussion posts
Keith,

Thank you for your reply. In fact, it was my mistake, I had a custom function assigned to F11. This would catch any F11 key pressed. After removing this function, F11 works as expected (and the script "Open Website in Default Web Browser and Full Screen on Specific Monitor" as well).

Now I'm still facing an issue when trying to open a browser full screen after clicking on a link.
It's easy to reproduce. First here are 2 simple html files:

File index.html:

Code

<!DOCTYPE html>
<html>
<head>
  <title>demo</title>
</head>
<body>
  <a href="" onclick="openFct()" >open MyWindow1</a>
  <script>
    function openFct(e) {
        var child = window.open("mywindow1.html", "somegroup", "top=0,left=10");
        child.focus();
    }
  </script>
</body>
</html>


File mywindow1.html:

Code

<!DOCTYPE html>
<html>
<head>
  <title>MyWindow1</title>
</head>
<body>
    <div>MyWindow1</div>
</body>
</html>


Open "index.html" (with Firefox) and click on the link. It should open another window. I would like this new window to open on a second monitor in full screen (F11).

So I created the following function:

Code

public static void Run(IntPtr windowHandle)
{
        uint targetMonitor = 2;
        string windowTitleToMatch = "MyWindow1 - Mozilla Firefox";
        
        string windowTitleActual = BFS.Window.GetText(windowHandle);
        
        if (windowTitleActual.Contains(windowTitleToMatch)) {
            BFS.Window.MoveToMonitor(targetMonitor, windowHandle);
            BFS.General.ThreadWait(250);
            BFS.Window.Focus(windowHandle);
            BFS.Input.SendKeys("{VK_122}");
        }
}


Then I created a Trigger:
  • Event: Window Created
  • Frequency: Always
  • Process Filename: C:\Program Files (x86)\Mozilla Firefox\firefox.exe
  • Action: Run function <my function name>

Now click on the link again (in the html file) and it will open the window on the second monitor and go full screen. Yay it's working as expected! But if you close that new window and click on the link again then it seems the function is not executed because the new window remains on the first screen and is not full screen.
Now in Settings> Triggers, click on "Apply". Click the link again (in the html file) and it will work as expected.
It seems that every time I must click on "Apply" to make my function working again.

If I create another function (really similar to the first one):

Code

public static void Run(IntPtr windowHandle)
{
        BFS.Window.MoveToMonitor(2, windowHandle);
        BFS.General.ThreadWait(250);
        BFS.Window.Focus(windowHandle);
        BFS.Input.SendKeys("{VK_122}");       
}


With this function it will work all the time! I can click many time on the link and it will always open the window on the second monitor and go full screen. (I don't need to click on "Apply" all the time)

Can you reproduce this behavior?

In my function, I need to test the window title, because depending of the window title, I will move the window on a different monitor.
Do you know if I should modify something in my function?

Sorry for the long post. Please let me know if it is not clear.
Dec 19, 2017  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
The problem is that the new window is getting detected before the page has loaded, so when the script runs, the "windowTitleActual" is just "Mozilla Firefox"

If you add a few seconds delay (BFS.General.ThreadWait(3000);) before setting windowTitleActual, it should work correctly :)

Code

public static void Run(IntPtr windowHandle)
{
        uint targetMonitor = 2;
        string windowTitleToMatch = "MyWindow1 - Mozilla Firefox";
        
        BFS.General.ThreadWait(3000);

        string windowTitleActual = BFS.Window.GetText(windowHandle);
        
        if (windowTitleActual.Contains(windowTitleToMatch)) {
            BFS.Window.MoveToMonitor(targetMonitor, windowHandle);
            BFS.General.ThreadWait(250);
            BFS.Window.Focus(windowHandle);
            BFS.Input.SendKeys("{VK_122}");
        }
}
Dec 19, 2017 (modified Dec 19, 2017)  • #4
User Image
alex334
3 discussion posts
Adding a delay did solve the problem! Thanks a lot for your help
Dec 20, 2017  • #5
Keith Lammers (BFS)'s profile on WallpaperFusion.com
No worries, glad to hear it!
Dec 20, 2017  • #6
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)