Paste: untested

Author: rand
Mode: factor
Date: Thu, 7 Jan 2010 13:35:11
Plain Text |
USE: io.directories.search 
<PRIVATE
SYMBOL: counter
counter 0 swap set
PRIVATE>

: 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

Annotation: addition

Author: rand
Mode: factor
Date: Thu, 7 Jan 2010 13:50:44
Plain Text |
CONSTANT: SPI_SETDESKWALLPAPER 20

New Annotation

Summary:
Author:
Mode:
Body: