Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Trigger refresh after changing wallpaper when called from scheduled task

by silent11 (Vicar)
on Mar 27, 2015 at 16:47 UTC ( [id://1121527]=note: print w/replies, xml ) Need Help??


in reply to Trigger refresh after changing wallpaper when called from scheduled task

I had the below code running daily with no issues. I'm not sure what "refresh" you're referring to, or why you have to play with the registry. I ran this from a scheduled task or by hand and the background would refresh instantly

Usage:
perl wallpaper.pl bg.jpg
wallpaper.pl:
use Win32::API; use constant SPI_SETDESKWALLPAPER => 20; use constant SPIF_UPDATEANDSENDINI => 3; use constant NULL => 0; my $syspinf = Win32::API->new('user32','SystemParametersInfo', [I,I,P, +I], I) or die "Could not import function.\n"; $syspinf->Call(SPI_SETDESKWALLPAPER, 0, $ARGV[0], SPIF_UPDATEANDSENDIN +I);
This script was part of a larger series of scripts that would pull down RSS data, pull the next 2 days of meetings from outlook, then overlay it at specific coordinates (with GD) on top of my background image... then I'd run the following where bg.jpg was the dynamically generated image.

Update: As for suppressing the cmd window... my script ran at 5am so I never saw it, but the .bat that the scripts are wrapped in begins with @echo off. Also, I thought there was an option in windows task scheduler to run as "Hidden".

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1121527]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 09:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found