Re: Previous APOD Page
Re: Previous APOD Page
- Subject: Re: Previous APOD Page
- From: Deivy Petrescu <email@hidden>
- Date: Thu, 30 Aug 2012 21:42:19 -0400
On Aug 27, 2012, at 21:06 , Christopher Stone <email@hidden> wrote:
> 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 '/></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
> ------------------------------------------------------------------------------------------------
To anyone who might be interested.
I like the APOD site so I wrote a stay open app to everyday check for the picture (might be a movie) and download it to my computer and set it as my desktop picture.
If you have Growl, it will also display the explanation from the web site.
I believe that if you don't have growl it will display the text as a dialog.
The app I have is for the English version of APOD (it has versions I many languages).
I do have a Dutch version, and was going to write to other languages that I have some understanding.
It has been a while but I believe I can implement this very fast.
If anyone is interested…. http://www.dicas.com/Miscellaneous.html
The name is APODdesktop.
Deivy Petrescu
email@hidden
_______________________________________________
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