I'm an astronomer, and I constantly (read: several times per day) check the same website to view the clear sky chart for my observatory. Specifically, the chart found on this webpage:
http://www.cleardarksky.com/c/YerkesObILkey.html
It would be incredibly handy if I were able to automatically set this image to be my laptop's desktop. I know I could set it manually each morning, but that is a hassle (and isn't as nerdy).
Unfortunately, I am not as versed in C and the command line as I perhaps should be. Is there any way to alter my bash profile to automatically download an image from a website and then set that image as my desktop, say, at midnight every 2 days? Barring obvious issues of image resolution and internet connection. A task like this is well out of my skill-set.
Even if this isn't possible/practical, I would be interested to know why not, just as a matter of curiosity.
If it matters, I'm running 10.13.1 High Sierra on a MacBook Pro.
Best Answer
You have a couple of options to tackle this: AppleScript and a Bash (Terminal) script. Since this needs to happen once per day (meaning scheduled) and you want to guarantee that the file gets downloaded the moment you're logged in so it can be there when you start and then once again every night at midnight, I would do this in Bash.
Create the Script
The script is going to do two things:
The script is fairly simple. It takes two arguments - URL and the location to save the file. It will then download it to that folder location:
Save it in a convenient location; give it an obvious name like
getSkyForecast.sh
. Make sure to make the script executable -chmod +x getSkyForecast.sh
If you don't do this, the script won't run.Schedule the Script
The following is a bit more complex, because it will run upon login and every 24 hours.
Next, the script needs to be kicked off with
launchd
. To do this, you need aplist
(XML file that describes the job)Save this file as
com.user.SkyForecast
and copy it to the~/Library/LaunchAgents
directory.Load it with the command:
Set the background image
The easiest thing to do is just go into System Preferences and set the Background image to this file (run the script manually first so it creates the file). When the script runs, it will change the file, not the name so the desktop image will change automatically.