• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Previous APOD Page
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Previous APOD Page


  • Subject: Re: Previous APOD Page
  • From: Christopher Stone <email@hidden>
  • Date: Tue, 28 Aug 2012 01:54:18 -0500

On Aug 27, 2012, at 21:07, Robert Poland <email@hidden> wrote:
I run this script every morning via launched;
______________________________________________________________________

Hey Bob,

My somewhat more modest effort to download today's APOD.

--
Best Regards,
Chris

------------------------------------------------------------------------------------------------
#       Author: Christopher Stone <email@hidden>
#      Created: 2012-08-27 : 08:27
#     Modified: 2012-08-27 : 09:02
#  Application: The Shell, Egrep, Curl, Sed
#      Purpose: Download Today's APOD.
------------------------------------------------------------------------------------------------
try

  

  set apodPicFldr to do shell script "echo ~/Pictures/APOD_ƒ/"
  set apodRoot to "http://apod.nasa.gov/apod/"
  try
    alias POSIX file apodPicFldr
  on error
    do shell script "mkdir " & apodPicFldr
  end try
  set apodImg to do shell script "curl -Ls --user-agent 'Opera/9.70 (Linux ppc64 ; U; en) Presto/2.2.1' \"" & apodRoot & "\" | egrep -i \"href="" | sed -E 's/[^\"]+\"([^\"]+)\".*/\\1/'"
  paragraphs of apodImg
  if length of result = 1 then
    set apodImgName to do shell script "echo `date \"+%y%m%d\"`-`sed -E 's|.+/(.+)$|\\1|' <<< " & quoted form of apodImg & "`"
    set apodImgDldPath to "\"" & apodPicFldr & apodImgName & "\""
    set apodImgURL to "\"" & apodRoot & apodImg & "\""
    do shell script "curl -L --user-agent 'Opera/9.70 (Linux ppc64 ; U; en) Presto/2.2.1' --url " & apodImgURL & " -o " & apodImgDldPath
  else
    # BAIL!
  end if

  

on error eMsg number eNum
  tell me to display dialog eMsg & return & return & eNum
end try
------------------------------------------------------------------------------------------------

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Resize APOD Page
      • From: Robert Poland <email@hidden>
References: 
 >Previous APOD Page (From: Christopher Stone <email@hidden>)
 >Re: Previous APOD Page (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Previous APOD Page
  • Next by Date: Re: Previous APOD Page
  • Previous by thread: Re: Previous APOD Page
  • Next by thread: Resize APOD Page
  • Index(es):
    • Date
    • Thread