Set Desktop to NASA Astronomy Picture of the Day

There’s no doubt that viewing NASA’s Astronomy Picture of the Day webpage can expand your understanding of our planet, solar system, and the universe. Every day this webpage displays an interesting image related to science and space exploration. Wouldn’t it be cool to be able to quickly set your desktop image to this special photo?

Fortunately for everyone, NASA provides instant browser-free access their library of APOD images via an RSS feed that is updated daily. And fortunately for Automator users, the default Automator library includes a set of actions for parsing and interacting with RSS feeds.

The following article details how to create a workflow for parsing the NASA RSS feed, and downloading and setting the APOD photo as your desktop picture.

The OS X desktop displaying the NASA Astronomy Picture of the Day

(⬆ see above ) Pressure ridges on the sea ice near Scott Base in Antartica. (www.nasa.gov)

Building the Workflow

For this tutorial, you will create and install an Automator workflow file that will be accessed via the system-wide Script Menu.

DO THIS ►Since no selection input will be required by this workflow, launch Automator and create a new blank standard workflow file.

Add the Source RSS Feed

The first step in constructing this automation tool is to add the NASA APOD RSS feed to the workflow. This can accomplished by either adding the Get Specified URLs action to the workflow and entering the RSS URL to the action’s URL list; or by dragging the RSS link into the Automator workflow window.

DO THIS ►Click, hold, and then drag this link to the NASA APOD RSS feed (http://apod.nasa.gov/apod.rss) into a new empty Automator workflow window.

Upon release of the drag cursor, a new Get Specified URL action  1  containing the dragged link URL  1  will be automatically added to the workflow  (⬇ see below ) 

When this workflow is executed, the Get Specified URLs action will pass the RSS feed link to the next action in the workflow.

finished-workflow-window

Filter the RSS Feed Articles

By default, the NASA RSS feed will return articles containing information and links for the last ten or so APODs. The next task for the workflow is to filter the articles returned by the RSS feed, to identify the article about today’s picture. The Filter Articles action will accomplish this task.

DO THIS ►In the Automator library, locate, select, and drag the Filter Articles action of the Internet category, to the end of the workflow, and release the drag cursor. The action will be added to the workflow  2   (⬆ see above ) 

Set these action parameter controls in the action view:  (⬆ see above ) 

 2  Set the value of the Filter Condition popup menu, to the Any menu option.

 3  From the Feed Properties popup menu, select the URL property.

 4  From the Property Values popup menu, select the contains menu option.

 5  In the text input field enter “astropix” as the value. The current APOD image is the only one in the feed to have its host webpage named using this term.

When the workflow is executed, this action will filter the RSS feed URLs passed to it, to return only those feeds published on the day the workflow is run. Typically, NASA updates this feed with a new APOD image every week day, Monday through Friday.

Extract the Link to the APOD Webpage

Now that the article for the APOD has been retrieved, the next step is to extract the link to the webpage containing the APOD image.

DO THIS ►In the Automator library, locate, select, and drag the Get Link URLs from Articles action of the Internet category, to the end of the workflow, and release the drag cursor. The action will be added to the workflow  3   (⬆ see above ) 

Set these action parameter controls in the action view:  (⬆ see above ) 

 6  Select the checkbox to indicate that you only want to get a link from this website and not other websites.

Extract the Link to the APOD Image

The result of the Filter Articles action will be a single RSS article describing and linking to today’s APOD. The next step in creating this workflow, is to add an action for extracting the link URL for the APOD image file.

DO THIS ►In the Automator library, locate, select, and drag the Get Image URLs from Articles action of the Internet category, to the end of the workflow, and release the drag cursor. The action will be added to the workflow  4   (⬆ see above ) 

Set this action parameter control in the action view:  (⬆ see above ) 

 7  Set the value of the Link Source popup menu, to the linked from the articles menu option.

When the workflow is executed, this action will extract and pass on the URL to the APOD file located on NASA’s server.

Download the APOD Image File

The next step in the workflow is to download the APOD file.

DO THIS ►In the Automator library, locate, select, and drag the Download URLs action of the Internet category, to the end of the workflow, and release the drag cursor. The action will be added to the workflow  5   (⬆ see above ) 

Set this action parameter control in the action view:  (⬆ see above ) 

 8  Select the Pictures folder as the destination directory for the downloaded image file.

When the workflow is executed, this action will download the APOD image file to the Pictures folder in your Home directory.

Set the Desktop Picture to the APOD Image

The final step in the workflow is to set the downloaded image as the desktop picture.

DO THIS ►In the Automator library, locate, select, and drag the Set the Desktop Picture action of the Files & Folders category, to the end of the workflow, and release the drag cursor. The action will be added to the workflow  6   (⬆ see above ) 

The workflow is now complete and is ready to be saved and run.

Save and Run the Workflow

The created workflow is designed to be executed from the system-wide Script Menu utility.

DO THIS ►If you haven’t already, activate the Script Menu utility. (instructions here)

DO THIS ►Save the workflow file in the Finder folder located within the Applications folder within the Scripts folder in your home Library folder. Keep in mind that the title you use as the workflow file name will be displayed as the menu item in the Script Menu.

Once the workflow file has been saved into the indicated folder, it will appear as a menu option in the Script Menu when the Finder is the frontmost application:

script-menu-selection

DO THIS ►Select the menu option and watch as your desktop picture changes!

TOP