Set APOD and AAPOD as your Desktop Pictures

November 10, 2009 19:36 by scibuff

Download my APOD AAPOD Desktop application.

Some time ago I wrote a little batch script that downloads the most recent Astronomy Picture Of Day (APOD) and sets it as your desktop wallpaper (on a Windows system). This time, I’ve improved on it a bit. First of all, it’s a for OSX (tested on OSX 10.5.8). But the major improvement is that apart from an APOD image, it also downloads the Amateur Astronomy Picture Of Day (AAPOD) which it then sets as the Desktop Picture on my second screen.

Unlike for the Windows app, there is no need for any additional libraries (such as wget, grep, etc for win32) as a typical OSX installation has all necessary tools (curl and perl are required, but should be installed under the majority of installation settings). The main script,, that does all the hard work is written in Perl using its powerful text processing capabilities. The other core file, named, is just a simple applescript (executed via shell) that sets the Desktop Pictures for my two screens.

The is based on Harold Bakker’s APOD script. I have added some command line options and the bits to get the AAPOD image. By default, all images, both APOD and AAPOD, will be stored within the images directory (although this can be disabled via a command line option). When you unpack the application archive there will be two items. One is the containing the necessary files and the other is the install.command*.

The install.command is a simple shell script that sets everything up. It unpacks the contents of the into the /Applications/APOD_AAPOD/ directory (which it creates if the directory doesn’t exists). During the installation the application is created (by compiling plain AppleScript using osacompile). Finally, the script will add the newly created application to your Login Items so that your desktop pictures are updated every time you log in.

In the default setting, the application is meant to work with two monitors system. The APOD image will be set as the desktop picture on the main screen and the AAPOD will be set as the desktop picture on the second screen. To modify this behavior is fairly easy:

  1. Simply navigate to /Applications/APOD_AAPOD_Desktop/ directory and open the file.
  2. Scroll all the way down pass the comments to the last line that reads: perl -s -m 0 -n 2
  3. Read more about the available flags and what they affect in the few lines above (in the end of the comments under “Usage”):
    • – to reverse the APOD and AAPOD screens, i.e have the AAPOD image be set as the desktop picture on your main monitor, just add the ‘-r’ option, so that the line reads perl -s -m 0 -n 2 -r
    • – to prevent the application from storing the downloaded images, simply remove the ‘-s’ option
    • – If you have only a SINGLE monitor, you should change the value following the ‘-n’ option to ‘1’.
    • – If would like to only download the APOD or only the AAPOS image, change the value after ‘-m’ to 1 or 2, respectively.

To apply the changes, either wait until the next time you log, or run the “APOD_AAPOD” application.

* Note: The only reason is has the .command extension instead of the typical .sh is that so it can be executed by double-clicking on the file. If you prefer to run in via terminal, simply rename it to and run it via sh

Be Sociable, Share!



AppleScript: Change the Desktop Picture (Wallpaper) of Two (or More) Screens

[…] have run into some difficulties with changing the system Desktop Picture (wallpaper), in my most recent application that downloads the Astronomy and Amateur Astronomy Picture of the Day and sets them as the Desktop […]

Leave your comment:
XHTML:You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> . * required