#!/usr/bin/perl # # # ## # ## This script will download the astronomy picture of the day # ## and set it as the current desktop background # ## original made by Harold Bakker, harold@haroldbakker.com # ## http://www.haroldbakker.com/ # ## and Wen Zhang (http://zhangw.com) made small changes # ## Please CHANGE /Path/To/YourFolder to the path where you want to save the pictures # # # #chdir "/tmp"; # # # #my $logfile = "astropix.html"; # #if (!$logfile) # #{ # #print "Temporary file not specified.n"; # #exit(1); # #} # # # ## # ## get the html file with a link to the new picture of the day # ## # # # #`curl -O "http://antwrp.gsfc.nasa.gov/apod/astropix.html"`; # # # ## # open the html file and look for the link to the big version # ## # # # #PrivoxyWindowOpen(LOG, "< $logfile") || die "Can't read $logfile"; # #@logfile = ; # #foreach $line(@logfile) # #{ # #$_ = "$line"; # #if (/href="image/([^/]+)/(.*?)" mce_href="image/([^/]+)/(.*?)"/) # #{ # ## download the new picture # #`curl -O "http://antwrp.gsfc.nasa.gov/apod/image/$1/$2"`; # get this version # #$myFile = "/tmp/$2"; # #} # #else # #{ # ## do nothing # #} # #} # # # ## change the desktop picture # ##print "Setting the new desktop picturen"; #`~/bin/apodosa.sh "$myFile"`; # #`cp "$myFile" /Path/To/YourFolder`; # ##`rm "$myFile"`; # # # ## clean up # #close(LOG); # #`rm $logfile`; # #`rm $myFile`; # #__END__