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:
<!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:
<!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:
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):
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.