• 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
Previous APOD Page
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Previous APOD Page


  • Subject: Previous APOD Page
  • From: Christopher Stone <email@hidden>
  • Date: Mon, 27 Aug 2012 20:06:57 -0500

Hey Folks,

Like many people I enjoy the APOD, and also like many people I often forget to visit it daily.

Enter Applescript.

This script will jump backwards one day from the currently viewed APOD page, so you can quickly review what you missed.

I run mine via a keyboard shortcut with FastScripts.

--
Best Regards,
Chris

------------------------------------------------------------------------------------------------
# Safari
# Go to previous APOD page
# APOD: http://apod.nasa.gov/apod/
------------------------------------------------------------------------------------------------
try

  tell application "Safari"
    tell front document
      set pageURL to quoted form of (get URL)
      set urlPath to do shell script "sed -E 's|[^/]+$||' <<< " & pageURL
      set src to quoted form of (do shell script "tr '\\r' '\\n' <<< " & (quoted form of (get source)) without altering line endings)
      set previousApodURL to urlPath & (do shell script "echo " & src & " | sed -n '/>&lt/p' | sed -E 's/[^\"]+\"([^\"]+).+/\\1/'")
      set URL to previousApodURL
    end tell
  end tell

on error eMsg number eNum
  set {c, s} to {return, "------------------------------------------"}
  set e to s & c & "Error: " & eMsg & c & s & c & "Error Number: " & eNum & c & s
  beep
  set dDlg to display dialog e buttons {"Cancel", "Copy", "OK"} default button "OK"
  if button returned of dDlg = "Copy" then
    set the clipboard to e
  end if
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:
    • Re: Previous APOD Page
      • From: Deivy Petrescu <email@hidden>
    • Re: Previous APOD Page
      • From: Christopher Stone <email@hidden>
    • Re: Previous APOD Page
      • From: Jon Pugh <email@hidden>
    • Re: Previous APOD Page
      • From: Robert Poland <email@hidden>
  • Prev by Date: Re: InDesign CS6 Document Preferences
  • Next by Date: Re: Previous APOD Page
  • Previous by thread: RE: InDesign CS6 Document Preferences
  • Next by thread: Re: Previous APOD Page
  • Index(es):
    • Date
    • Thread