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?

Select a Random Wallpaper Profile with Filter

Description
This script lets you specify some text to search for and selects a random Wallpaper Profile from the profiles that match that text.
Language
C#.net
Minimum Version
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Jan 28, 2019
Date Last Modified
Jan 28, 2019

Scripted Function (Macro) Code

using System;
using System.Collections.Generic;
using System.Drawing;

public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
        // Set the text to look for when building the list of Wallpaper Profiles to pick from
        string wallpaperSeason = "Winter";
        
        // Build the list of Wallpaper Profiles that match the text
        List<string> wallpaperProfilePool = new List<string>();
        
		foreach (string profile in BFS.DisplayFusion.GetWallpaperProfiles())
		{
            if (profile.ToLower().Contains(wallpaperSeason.ToLower()))
            {
                wallpaperProfilePool.Add(profile);
            }
		}
		
		// Select a random profile from the list
        Random randomNumber = new Random();
		string selectedRandomWallpaperProfile = wallpaperProfilePool[randomNumber.Next(0,wallpaperProfilePool.Count - 1)];
		BFS.DisplayFusion.LoadWallpaperProfile(selectedRandomWallpaperProfile);
	}
}