Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

Load Next Wallpaper Profile

Description
This script will switch to the next wallpaper profile when run.
Language
C#.net
Minimum Version
Created By
Baldy12329
Contributors
-
Date Created
3d ago
Date Last Modified
3d ago

Scripted Function (Macro) Code

using System;
using System.Linq;

public class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        string currentProfile = BFS.DisplayFusion.GetCurrentWallpaperProfile();
        string[] profiles = BFS.DisplayFusion.GetWallpaperProfiles();

        if (profiles == null || profiles.Length == 0)
            return;

        // Find current profile index
        int currentIndex = Array.FindIndex(
            profiles,
            p => string.Equals(p, currentProfile, StringComparison.OrdinalIgnoreCase)
        );

        // If not found, just load the first profile
        if (currentIndex < 0)
        {
            BFS.DisplayFusion.LoadWallpaperProfile(profiles[0]);
            return;
        }

        // Move to next profile, wrapping around
        int nextIndex = (currentIndex + 1) % profiles.Length;

        // If next is the same as current (only one profile exists), do nothing
        if (nextIndex == currentIndex)
            return;

        BFS.DisplayFusion.LoadWallpaperProfile(profiles[nextIndex]);
    }
}