I just received a bit of feedback on my APOD to Desktop
script for OS X. I thought it might be interesting for all OS X users interested in the script so to prevent myself from typing it all up again I'll just paste the e-mail and edit a few words here and there.
-- begin --
> your apod to desktop script is cool. However, when I log out and then log back
> in the desktop picture is gone. What do I need to do at login to get the
> picture on the desktop?
If I log out and back in again the picture is still there. I assume you mean restart. The downloaded pictures are stored in the (otherwise invisible) folder /tmp/. If you open up the Terminal and enter the following commands:
cd /tmp/; open ./;
you will open up this folder in a finder window. You can then see what's stored there. After a restart this folder will likely be empty.
This is due to the following reason:
The Unix underpinnings of Mac OS X store temporary files in that location. As Unix systems are rarely shut down this folder could become stuffed with old files were it not for the fact that Unix runs some maintenance scripts once in a while to trim the folder. After a restart this folder is also emptied. I have decided to put the downloaded pictures in /tmp/ as this will limit the amount of disk-space used and prevent the disk from filling up unnoticed (OS X does weird things when your hard-disk is full, trust me).
So there's a problem: if you shut down your machine the picture of the day is lost.
I have thought long and hard about it but the best way to circumvent this behaviour is creating a small applescript application that runs as a login item. Drop it into your utilities folder and add it to your login items.
I have updated the APOD to Desktop page on my site and added the script to the regular distribution, the source for the applescript is included if you want to take a look before installing it.
-- end --
By utilizing the
do shell script
command in a small applescript application I've effectively removed one of the biggest problems with the current scripts, namely the fact that most macs aren't running 24/7. Also, running the script as a login item (via a small applescript wrapper) means that there's really no need anymore to set up a CRON job.
Of course if your machine is
on 24/7 you'll still want to do that.
So head on over to the APOD to Desktop
page and get downloading.
Mark Brethen has provided a much more elegant applescript to set the picture at login. Both the applet and the source are included in the new download.]