Change Wallpaper

# Changes the wallpaper to a randomly selected file.
# Version 1.0
# Last updated 2011-02-18
 
use strict;
use warnings;
use Win32::API;
 
use constant SPI_SETDESKWALLPAPER  => 20;
use constant SPIF_UPDATEANDSENDINI => 3;
use constant NULL                  => 0;
 
my @files = <"C:/11000 x 7703 (Raw)/Wallpaper/*.bmp">;
 
my @file = $files[int(rand(@files))];
 
print "@file\n";
 
my $syspinf = Win32::API->new('user32','SystemParametersInfo', 'IIPI', 'I')
  or die "Could not import function.\n";
 
$syspinf->Call(SPI_SETDESKWALLPAPER, NULL, @file, SPIF_UPDATEANDSENDINI);