<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8893606323430129239</id><updated>2011-11-27T16:32:30.610-07:00</updated><category term='Automator'/><category term='Applescript'/><category term='os x'/><category term='picture'/><category term='desktop'/><category term='Finder'/><category term='wallpaper'/><category term='flickr'/><category term='apple'/><category term='development'/><category term='mac'/><title type='text'>FlickrDesktop</title><subtitle type='html'>This journal is about the development of a desktop picture switcher for the Mac that uses photos from Flickr.  This application does not exist yet, but hopefully it will soon.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://flickrdesktop.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8893606323430129239/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://flickrdesktop.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>smithco</name><uri>http://www.blogger.com/profile/10339199310394349717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://static.flickr.com/50/127531035_840a0df6f6_s.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8893606323430129239.post-7883128678693362901</id><published>2007-03-04T13:08:00.000-07:00</published><updated>2007-03-04T13:58:48.062-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Applescript'/><category scheme='http://www.blogger.com/atom/ns#' term='Finder'/><category scheme='http://www.blogger.com/atom/ns#' term='os x'/><category scheme='http://www.blogger.com/atom/ns#' term='desktop'/><category scheme='http://www.blogger.com/atom/ns#' term='mac'/><category scheme='http://www.blogger.com/atom/ns#' term='picture'/><category scheme='http://www.blogger.com/atom/ns#' term='Automator'/><category scheme='http://www.blogger.com/atom/ns#' term='apple'/><title type='text'>Changing the Picture of the Main Display Using Applescript or Automator</title><content type='html'>It turns out that changing the desktop picture of the main display is very, very simple if using either &lt;span style="font-weight: bold;"&gt;Applescript&lt;/span&gt; or &lt;span style="font-weight: bold;"&gt;Automator&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;The Desktop Preferences&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The first thing I had to figure out was where the preference for the desktop image was stored.  Using Spotlight, I found this quickly.  It's simply an entry in the preferences file &lt;span style="font-family: courier new;"&gt;~/Library/Preferences/com.apple.desktop.plist&lt;/span&gt;.  In that file, there is an entry containing some information for each file, for each display.  The &lt;span style="font-weight: bold;"&gt;Property List Editor&lt;/span&gt; can be used to inspect the contents of this file.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;A Short Wrong Turn&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;I did initially try to write some C code to do this using the Preferences API in the &lt;span style="font-weight: bold;"&gt;Core Foundation Framework&lt;/span&gt;.  It turns out that this does not work.  It's not too difficult to change the image file name in the desktop preferences file, but what is missing in the API is a way to cause an update using the new value.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;The Finder Owns the Desktop&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;After a bit of investigation (mostly thanks to the article listed in the next section), I found out that the desktop is owned by the &lt;span style="font-weight: bold;"&gt;Finder&lt;/span&gt; application.  Therefore changing the desktop image should be done through the &lt;span style="font-weight: bold;"&gt;Finder&lt;/span&gt;'s API.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Th&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;e Automator Solution&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The big clue as to how this all works came from the article &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span id="ppt648091"&gt;&lt;a href="http://www.tuaw.com/2006/07/28/change-desktop-wallpaper-with-an-automator-action/"&gt;&lt;span style="font-style: italic;"&gt;Change desktop wallpaper with an Automator action&lt;/span&gt;&lt;/a&gt;.  This is my first encounter &lt;span style="font-weight: bold;"&gt;Automator&lt;/span&gt;, and it resulted in one of those "Wow, it just works!" moments that are only found in the Apple world.  In the &lt;span style="font-weight: bold;"&gt;Finder&lt;/span&gt; library, there is the action &lt;span style="font-weight: bold;"&gt;Set the Desktop Picture&lt;/span&gt; that takes a file name as input.  To build a trivial example, the file name can be supplied by the &lt;span style="font-weight: bold;"&gt;Ask for Finder Items&lt;/span&gt; action.  When this is run, we have an application that asks for an image filename and sets the desktop image to it.  It is really that simple, and works very reliably.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;The AppleScript Solution&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The exact same thing can be done using &lt;span style="font-weight: bold;"&gt;AppleScript&lt;/span&gt;.  All that has to be done is to send a message to the &lt;span style="font-weight: bold;"&gt;Finder&lt;/span&gt; application.  After a bit of searching and tinkering, I came up with&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;tell application "Finder"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    set pFile to file "Macintosh HD:Users:colin:Pictures:2007_02_23:IMG_7119.JPG" as string&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    set desktop picture to file pFile&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;end tell&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Just like the &lt;span style="font-weight: bold;"&gt;Automator&lt;/span&gt; example, this works reliably and is conveniently simple.&lt;br /&gt;&lt;br /&gt;So, I now have to easy ways to change the desktop of the main display to a specific image.  This is one piece of the project in place.  However, these examples only change the picture for the main display.  I still need to find out how to change pictures of the other displays.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8893606323430129239-7883128678693362901?l=flickrdesktop.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flickrdesktop.blogspot.com/feeds/7883128678693362901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8893606323430129239&amp;postID=7883128678693362901' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8893606323430129239/posts/default/7883128678693362901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8893606323430129239/posts/default/7883128678693362901'/><link rel='alternate' type='text/html' href='http://flickrdesktop.blogspot.com/2007/03/changing-picture-of-main-display-using.html' title='Changing the Picture of the Main Display Using Applescript or Automator'/><author><name>smithco</name><uri>http://www.blogger.com/profile/10339199310394349717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://static.flickr.com/50/127531035_840a0df6f6_s.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8893606323430129239.post-7715429868973932449</id><published>2007-03-03T17:46:00.000-07:00</published><updated>2007-03-03T17:51:56.919-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flickr'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='os x'/><category scheme='http://www.blogger.com/atom/ns#' term='wallpaper'/><category scheme='http://www.blogger.com/atom/ns#' term='desktop'/><category scheme='http://www.blogger.com/atom/ns#' term='mac'/><category scheme='http://www.blogger.com/atom/ns#' term='picture'/><category scheme='http://www.blogger.com/atom/ns#' term='apple'/><title type='text'>FlickrDesktop</title><content type='html'>Hello!  you've found the journal for my latest project.&lt;br /&gt;&lt;br /&gt;I've decided to develop a Mac application to change the desktop picture using photos from Flickr.  For some reason, a good one just doesn't seem to exist yet, so the only good solution is to write my own.&lt;br /&gt;&lt;br /&gt;As this is my first real foray into development specifically for the Mac and for web services, there's likely to be a lot of experiments and lessons to keep track of.  This journal is all about that.  This journal is not yet about an existing application.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8893606323430129239-7715429868973932449?l=flickrdesktop.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flickrdesktop.blogspot.com/feeds/7715429868973932449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8893606323430129239&amp;postID=7715429868973932449' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8893606323430129239/posts/default/7715429868973932449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8893606323430129239/posts/default/7715429868973932449'/><link rel='alternate' type='text/html' href='http://flickrdesktop.blogspot.com/2007/03/flickrdesktop.html' title='FlickrDesktop'/><author><name>smithco</name><uri>http://www.blogger.com/profile/10339199310394349717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://static.flickr.com/50/127531035_840a0df6f6_s.jpg'/></author><thr:total>0</thr:total></entry></feed>
