Login / Register
▼
Binary Fortress
Binary Fortress Software
CheckCentral
ClipboardFusion
CloudShow
DisplayFusion
FileSeek
HashTools
LogFusion
Notepad Replacer
Online Base64 Decoder
Online Base64 Encoder
Online JSON Formatter
ShellSend
TrayStatus
VoiceBot
WallpaperFusion
Window Inspector
More Apps...
DisplayFusion
CheckCentral
CloudShow
ClipboardFusion
FileSeek
VoiceBot
WallpaperFusion
Home
▼
Download
Download
Change Log
Download Beta
Beta Change Log
License (EULA)
▼
Features
Features
Incredible Desktop Wallpaper
Monitor Configuration
Monitor Splitting
Powerful Functions
Triggers
Multi-Monitor Taskbars
Useful Windows 10 Tweaks
Useful Windows 8 Tweaks
Windows Lock Screen
Multi-Monitor Screen Savers
Monitor Fading
Window Snapping
Window Management
Mouse Management
Alt+Tab Handler
Window Position Profiles
Desktop Icon Profiles
Remote Control
Available in dozens of Languages
Easy Administration
Free vs Pro
Purchase
Screenshots
Languages
▼
Help
Help Guide
FAQ
Discussions
Contact Us
Find My License
Mailing Address
Advanced Settings
Scripted Functions (Macros)
Display
Fusion
WARNING: You currently have Javascript disabled!
This website will not function correctly without Javascript enabled.
Title
Message
OK
Confirm
Yes
No
Automatically load Window Position Profile based on screen width
Return to DisplayFusion Scripted Functions (Macros)
Description
This script will automatically load the profiles specified in the profile1 and profile2 variables based on the screen width specified in the screenWidth1 and screenWidth2 variables.
Language
C# (.Net)
Minimum Version
9.7+
Created By
James K.
Contributors
-
Date Created
Jul 28, 2020
Date Last Modified
Jul 28, 2020
Scripted Function (Macro) Code
Copy
Select All
Toggle Line Wrapping
using System; using System.Drawing; using System.Windows.Forms; using System.Management; using System.Threading; // Automatically changes Window Position Profile, if not loaded previously, // according to screen width. // by Phuein // // The 'windowHandle' parameter will contain the window handle for the: // - Active window when run by hotkey // - Window Location target when run by a Window Location 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 { const int screenWidth1 = 3440; const string profile1 = "3440x1440"; const int screenWidth2 = 1720; const string profile2 = "1720x1440"; public static void Run(IntPtr windowHandle) { string lastProfileLoaded = ""; try { lastProfileLoaded = BFS.ScriptSettings.ReadValue("lastProfileLoaded"); } catch { BFS.ScriptSettings.WriteValue("lastProfileLoaded", ""); lastProfileLoaded = BFS.ScriptSettings.ReadValue("lastProfileLoaded"); } int screenWidth = Screen.PrimaryScreen.Bounds.Width; //BFS.Dialog.ShowMessageInfo(screenWidth.ToString()); //BFS.Dialog.ShowMessageInfo(lastProfileLoaded); // Full screen if (screenWidth == screenWidth1 && lastProfileLoaded != profile1) { BFS.ScriptSettings.WriteValue("lastProfileLoaded", profile1); BFS.DisplayFusion.LoadWindowPositionProfile(profile1); //BFS.Dialog.ShowMessageInfo("Full screen!"); } // Split screen else if (screenWidth == screenWidth2 && lastProfileLoaded != profile2) { BFS.ScriptSettings.WriteValue("lastProfileLoaded", profile2); BFS.DisplayFusion.LoadWindowPositionProfile(profile2); //BFS.Dialog.ShowMessageInfo("Split screen!"); } } }
Copyright © 2007-2021 Binary Fortress Software
•
News
•
Discussions
•
FAQ
•
Support
•
Privacy
•
ToS
•
Get DisplayFusion Merch