Skip navigation.

Harold's Home The moving finger writes...

Proudly associated with: Virtual Pet Rock
   Home > Personal > Downloads > APOD to desktop
  
PHP Scripts

Index
CLI fun
Mail on 404
HB-NS (NewsScript)

Downloads

Applescripts
Desktop goodies
APOD to Desktop
Dreamweaver Extensions

Stuff

Links
Writings
Other stuff
Central Grinder

OOOk Default:

VJ stuff
VJ Tools
Bananas
Strippers
Sample Movies
Virtual Pet Rock

Astronomy Picture Of the Day to Desktop

Today's Astronomy picture

Two scripts that work together to download the astronomy picture of the day (also know as APOD) and set it as the current desktop backgrond in Mac OS X.

HOW IT WORKS
The scripts work by downloading an HTML file, extracting the location of the big version of the daily picture from that and downloading that. That downloaded picture will then be set as the current desktop background using OSAscript, a commandline version of Applescript. After the image file has been set as the current desktop background it will be deleted.

REQUIRES
Mac OS X
Perl and curl (should be installed already (possibly by developerstools?))

INSTALLING
Download the stuffed archive using the link at the bottom of this page. Unstuff this and place both apod.pl and apod.osa.sh in your personal "bin" directory and make them executable, see OSX FAQ for more information about PATH and your personal "bin" directory
To make the scripts executable type this in the Terminal:
cd ~/bin; chmod 755 apod.osa.sh apod.pl
Make a cron entry to execute this script every day at a time when you're sure your machine is on, recommended way: Cronnix.
I entered the following:
exec "/Users/harold/bin/apod.pl" >& /dev/null
this executes the script and pipes all output to dev/null which means we won't see any messages from the script.

cronnix entry for apod to desktop

A NOTE ABOUT RESTARTING
After a restart your desktop picture will be reset to Apple's default. This is because the downloaded picture is removed from the tmp directory after a restart. We could change the location of the downloaded picture to somewhere in your home directory but this could mean that your disk would fill up unnoticed. Mac OS X does WEIRD things when a disk is full so by putting the pictures in a directory that gets trimmed every once in a while (either by a restart or by a system cleanup script that runs every day) we prevent all kinds of trouble. This of course means that we'll have to download the picture again after a restart. The safest and most fool-proof way is to just run a small applescript application on login. This application is provided, just put it into your utilities folder and add it to your login items.

cronnix entry for apod to desktop

COPYRIGHT
These files are completely free and you may modify them as needed.
Please note that the astronomy pictures of the day that will be downloaded are probably copyrighted.
Please read the section "About image permissions" on http://antwrp.gsfc.nasa.gov/apod/lib/about_apod.html.

FINAL DISCLAIMERS
These scripts were made by Harold Bakker as an exercise in using Perl and OSAscript to do something fun in OS X, no infringement of copyright is intended. I make no claims this software will work on your particular configuration. You agree not to hold me responsible for any failings in the workings of this software, whether implied or stated.

Download (32 k). Downloads so far:

XML version of this site

Latest News:

Library on iPhone, pt. 2
As I mentioned in a comment to my previous post I...
read more >>>
Library on iPhone
As I mentioned a while ago one of my thoughts when...
read more >>>
???
I think someone is trying to tell me something,...
read more >>>
Human Vision
As I said in my previous post that the iPhone only...
read more >>>
Back, sorta
A busy year for music. I've just returned from the...
read more >>>

Latest Comments:

Still having problems with landscape and portrait...
Harold Bakker on Library on iPhone
Looks good, very good actually.
You should...
Jurjan on Library on iPhone
looks good... but since when is Movies a dutch...
Joke on Library on iPhone
hehehehe was surprised to hear that you were going...
ernst on Back, sorta
About, copyright, privacy and accessibility | Mail