USE: io.directories.search : my-pictures ( -- seq ) home "\\My Documents\\My Pictures" append { ".jpg" ".png" ".bmp" ".tiff" } find-by-extensions ; : circular-item ( seq n -- item ) [ dup length ] dip swap mod 1 - swap nth ; LIBRARY: winapi FUNCTION: bool SystemParametersInfo ( UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni ) ; : change-wallpaper ( imagepath -- ) [ SPI_SETDESKWALLPAPER 0 ] dip 0 SystemParametersInfo ; : next-picture ( seq -- pic ) counter get circular-item ; : switch-wallpaper-every ( duration -- ) [ my-pictures '[ _ [ next-picture change-wallpaper [ 1 + ] change-counter ] unless-empty ] ] dip every drop ; : run-me ( -- ) 5 seconds switch-wallpaper-every ; ! 10 minutes