User Tools

Site Tools


change_wallpaper

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);
change_wallpaper.txt · Last modified: 2017/01/01 20:05 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki