I have a very simple Trigger:
Event:
Window Focused
Frequency:
Always
Process Filename:
C:\Games\Steam\steamapps\common\Red Dead Redemption 2\RDR2.exe
Window Text:
"Red Dead Redemption 2"
Actions:
Wait - 3500ms
Run Function - "Red Dead 2 - Fullscreen shortcut"
------
Scripted function's info:
Name:
"Red Dead 2 - Fullscreen shortcut"
Description:
"Switch back to Fullscreen with Alt+Enter"
Code:
using System;
using System.Drawing;
// The 'windowHandle' parameter will contain the window handle for the:
// - Active window when run by hotkey
// - Trigger target when run by a Trigger 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)
{
BFS.Input.SendKeys("%({VK_13})");
}
}
------
Here's my issue:
Red Dead 2 does this stupid thing where if you're playing the game in Fullscreen, it switched to Windowed Borderless the moment you tab out of the game. When tabbing back into the game, you have only three options:
1. Play at Windowed Borderless
2. Switch back to Fullscreen through in-game settings
3. Switch back to Fullscreen through the Alt+Enter keyboard shortcut.
I opted to try to automate that third choice with the above Window Focused Trigger combined with the Scripted Function I created. When switching it back to Fullscreen using either method, the game flashes in and out of focus for a brief second while it's fulling taking effect. The problem with that, though, is that this causes DisplayFusion to trigger multiple times in a row. In fact, it basically gets stuck in a loop.
I need help figuring out one of two solutions/bandaids:
1. Is there a way to set a trigger to a specified cooldown? (e.g. cannot be triggered more often than once every [specified] seconds)
2. If that's not possible, is there a way to enable and disable a DisplayFusion Trigger from a Scripted Function? If so, I'm thinking I could work around not having a cooldown by having a scripted function disable the first trigger but then enable a second trigger after waiting a few seconds. And that second trigger would then do the same functionality of the first trigger and then get disabled and then enable the first trigger the next time I tab back into the game.
I'm not sure I'm really making much sense but I'm hoping I can get some help in figuring out a way to easily automate reverting Red Dead 2 to fullscreen.