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".


In reply to Re: Trigger refresh after changing wallpaper when called from scheduled task by silent11
in thread Trigger refresh after changing wallpaper when called from scheduled task by ice94

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.