Put Internet Images on Your Desktop With Automator

  Wayne Linder       March 25, 2007      Tutorials Mac Developer


Do you ever get tired of the same old Desktop image? Do you like cool images of space? Have you always wanted to play around with Apple’s Automator? Did you ever wonder if your dentist was the one out of four who didn’t recommend Trident to their patients who chew gum? Well, this article can’t help you with the last item, but if the others intrigued you, read on!

In this article, you will learn how to change your Desktop background every day with an image downloaded from NASA’s Cool Astronomy Picture of the Day. Sounds like a lot of labor, doesn’t it? True, there is a bit of clicking and dragging, but once you’re done, Automator will repeat the process every day.

If you haven’t played with Automator yet, you’re missing out on some serious power – made simple! In the past, writing AppleScripts meant just that – writing. With AppleScript, you had to learn Apple’s syntax to make applications do what you wanted them to. Things started looking a lot like this:

try    
	tell application "Finder"      
		delete (every file of folder "DeleteMe" of desktop)    
	end tell 
end try 

try    
	tell application "Finder"      
		activate      
		empty    
	end tell 
end try

This script would move anything in the DeleteMe folder to the trash and empty it. The syntax is kind of strange, and if you had a parentheses or a quote out of place, the script wouldn’t work.

When Apple released Mac OS 10.4, they included a little utility called Automator. Automator replaces all of that tiresome typing with the beauty of drag and drop. You simply drag actions in the order you want them performed. It is simple and very powerful. So, let’s play around with it.

To make your Desktop-changing script, fire up the Automator application. You will find it in your Applications folder. When the program first opens, you will see two lists to your left – the Library list and the Actions list. The Library list contains applications that have built-in scripting ability. The Action list shows what those abilities are. Here is what it looks like:

Nasa desktop image

Alright. Now it’s time to get down to business:

  1. Start by selecting Safari from the Library list. In the Actions list, select Get Specified URLs and drag it over to the area to the right.
  2. Launch Safari and go to this address: http://antwrp.gsfc.nasa.gov/apod/. Go back to Automator and click the Current Safari page button on your Get Specified URLs action. You will see the webpage entered above the Apple.com URL. For now, uncheck the Apple.com URL, as we won’t need it for this script.
  3. The next thing we want to do is to grab the image from the webpage. Click on the Get Image URLs from Webpage action and drag it under the top action. Ensure the popup is set to get the URL of images on the webpage rather than ones linked from it.
  4. Next, we want to download the image. Select the Download URLs action and drag it under the previous action. In this action’s popup menu, you can choose where to download the image to. I choose the Pictures folder since, well… they’re pictures.
  5. The last step is to click on Finder in the Library list. From the Action list, choose Set the Desktop Picture and drag it to the bottom of the list. When you’re done, your window should look something like this:

Using Automator to create desktop image

Congratulations! You’re almost done. Now all you have to do is save it and, umm, it… won’t do anything, actually. This problem stumped me. How do you automate Automator? Try as you might, you won’t find any actions that say, “At this time, do this thing.” So how do you do it? Read on.

One of the nice things about Apple is the way their software works seamlessly together to do things you couldn’t do separately – the way iTunes interacts with iPhoto, the way Mail works with Address Book – incredible interaction! Automator can also interact, and Apple has it built in. Go to the File menu and select Save As Plug-in. Change the pop-up menu to iCal Alarm and name the script, like this:

Using Automator to create desktop image

Click Save and iCal will launch. Now you can change when the action will be triggered, like this:

Using Automator to create desktop image

Select a time interval from the Repeat pop-up menu and that’s it! Your computer will now automatically download a new image every day and make that image your Desktop background. You didn’t even type a single line of code! Once you see just how easy Automator is to use and just how powerful it can be, you will start using it in many of your daily tasks.

Subscribe to our email newsletter

Sign up and get Macinstruct's tutorials delivered to your inbox. No spam, promise!


© 2021. A Matt Cone project. CC BY-NC-SA 4.0. Made with 🌶️ in New Mexico.