Skip to content

A simple component that helps shuffle a list of related objects like a playlist.

Notifications You must be signed in to change notification settings

sangafabrice/shuffler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

The shuffler component

Author: Fabrice Sanga


The component is mainly built around the RandomSelect() function that selects an element from a list of objects randomly, as its name suggests. The selection proceeds similarly to a media player in shuffle mode. It avoids selecting an item that it had already picked til every item in the list is marked. Then the process restarts.

It works on any type of list, but for illustration purposes, it is restricted to Photos App Tiles, Desktop and Lockscreen Backgrounds, and the default Logon Picture.

An example of use:

With CreateObject("CustomUI.Shuffler")
    .WorkDir = "\Path\to\Example"           '(1)
    .Shuffle "DesktopBG"                    '(2)
    .Shuffle "LockScreenBG"                 
    .Shuffle "LogonPicture"                 
    .Shuffle "PhotosTile"                   
    .RefreshStartMenu                       '(3)
End With

(1) WorkDir is the root directory

(2) Shuffle is a sub that shuffles the items of the DesktopBG subfolder of the root

(3) RefreshStartMenu is a feature sub that makes the change available immediately and is needed for LogonPicture and PhotosTile

The filesystem:

    Example
        |--DesktopBG
        |--LockScreenBG
        |--LogonPicture
        |--PhotosTile

DesktopBG, LockScreenBG, PhotosTile contain image objects. PhotosTile contain subfolders of square images of 32px, 40px, 48px, 192px and 448px size. They are different sized-images of the same picture. The figure shows an example of those images.