Automator (or Applescript) to set desktop background for specific screen?

The action *Set the Desktop Picture* is not configurable, It setst the main screen desktop only.
Any way to select which screen it affects?

This -> http://www.entourage.mvps.org/downloads/other.html
downloads the National Geographic pix of the the day and sets it as the background.
I have found another script -> http://www.dc-studios.net/blog/?p=98
which sets the NASA pix of the day.

I want to set on for mymian screen and the other for my sencond screen, however, I have not found anything to set it to a specific screen.
Any ideas?

iMac G5 (Rev B) ALS - 2 GB RAM, Mac OS X (10.5.7), silver mini, blue mini, silver shuffle

Posted on Jul 19, 2009 11:27 AM

Reply
3 replies

Jul 19, 2009 12:09 PM in response to Chris CA

see this link on how to apple script desktop background
http://www.macosxautomation.com/applescript/features/system-prefs.html
if you have more than one display the model script in that link has to be amended slightly. instead of "current desktop" use 'desktop 1" for the primary screen and "desktop 2" for the secondary one. so the example for the secondary screen will look like this

<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
tell application "System Events"
-- RANDOM ROTATION OF A FOLDER OF IMAGES
tell desktop 2
set picture rotation to 1 -- (0=off, 1=interval, 2=login, 3=sleep)
set random order to true
set pictures folder to file "Mac OS X:Library:Desktop Pictures:Plants:"
set change interval to 5.0 -- seconds
end tell
end tell</pre>

a script like that can be embedded into an automator workflow if necessary although it's probably easier to do the whole thing inside apple script. specifically, for using national geographic pic of the day I was helping someone recently here:
http://discussions.apple.com/message.jspa?messageID=9828948#9828948
you can modify the script from that thread using the example above.

Jul 19, 2009 1:56 PM in response to Chris CA

Here's what I figured out.

If you can get an image from the method provided, pass it to an Applescript than looks like this:
on run {input, parameters}

tell application "System Events"
set picture of desktop 2 to item 1 of input
end tell
end run


Instead of using their shell script and curl, you can do it all in automator:
1) Get Specified URLs: remove the default and add a new one. Change the path to http://antwrp.gsfc.nasa.gov/apod/
2) Get Image URLs from Webpage: Change it to linked from these webpages.
3) Download URLs: Change where to a folder you want to store the images.
4) Run Applescript. Paste the above applescript into this action.
Change the desktop number in the script for the appropriate display, 1, 2, 3, etc.

Now, you will amass lots of large images. You can thin that as you see fit, or just keep them so you can eventually just use your own collection as a random, rotating image.

Another cleanup method would be to set a special folder as the download location. You could create a folder action that would then set the desktop to any new image file added to the folder, and delete the old files. That sounds like something someone might have already done.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Automator (or Applescript) to set desktop background for specific screen?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.