Create an auto-updating desktop image

Jul 14, '03 10:21:00AM

Contributed by: charlesb

This hint will make your desktop update automatically with any web image you like; the example uses the latest weather maps.

  1. Create the directory ~/Desktop/Weather.

  2. Open System preferences, select Desktop. Under the collections popup list, navigate to the Weather folder. Select Center for the image position, then set the "Change picture" pop-up to every five minutes.

  3. Create this perl script:
    #!/usr/bin/perl
    while(1){
      # download radar image (this command works for any URL)
      # NOTE: Enter the next three lines as ONE line -- do not
      #       add any spaces when combining the lines (ie no
      #       spaces after the slashes!).
      system ("curl http://weather.noaa.gov/radar/images/
        DS.p19r0/SI.klwx/latest.gif >~/Desktop/Weather/
        latest.gif");
      sleep(300);
    }
    
    Don't forget to use UNIX line breaks and after you save it, open the Terminal, navigate to the directory the script resides in (I used ~/Desktop/Weather), and do chmod +x getweather to make the script executable.

  4. Launch the script by typing ./getweather &
You're done.

The perl script fetches an image from the NOAA doppler radar site (For the Washington, D.C. area in this case, but choose whatever you like). The script then sleeps for 5 minutes (300 seconds) and then fetches the image again, overwriting the original. At the same time, the Desktop sytem preferences updates the desktop every 5 minutes, which will always keep the image current on your screen. You can use other images; try any web cam you like, of course!

Comments (12)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030710221151906