EDIT: If you are using OS 10.3 or later, you can automatically open the script with Script Editor. Note that you will have to adjust the file paths before the script will operate correctly.
I’ve been using an AppleScript to grab a crossword for me each morning (the LA Times crossword), save it to a puzzles folder, open it up with the free Across Lite crossword puzzle reader, and open up my copy of OmniDictionary (for which I have installed a local dictionary server, to allow for usage without internet access). I used to use PuzzleGetter (shameless plug for myself, there…) but found it was rather inefficient to open up PuzzleGetter daily just to download one crossword. So, I adapted my PuzzleGetter source slightly as seen in the following AppleScript (which you can simply save as an application from the Script Editor application), and used Cronnix to run this AppleScript application each morning.
on run
set today_year to do shell script "date '+%Y'" as string
--> "2004"
set today_month to do shell script "date '+%m'" as string
--> "01"
set today_day to do shell script "date '+%d'" as string
--> "31"
set today_date to today_year & "-" & today_month & "-" & today_day
--Here is a handy list of date command arguments
(*
%a abbreviated weekday name
%A full weekday name
%b abbreviated month name
%B full month name
%c shorthand for %X %x, the locale format for date and time
%d day of the month as a decimal number (01-31)
%e same as %d but does not print the leading 0 for days 1 through 9
%F milliseconds as a decimal number (000-999)
%H hour based on a 24-hour clock as a decimal number (00-23)
%I hour based on a 12-hour clock as a decimal number (01-12)
%j day of the year as a decimal number (001-366)
%m month as a decimal number (01-12)
%M minute as a decimal number (00-59)
%p AM/PM designation for the locale
%S second as a decimal number (00-59)
%w weekday as a decimal number (0-6), where Sunday is 0
%x date using the date representation for the locale
%X time using the time representation for the locale
%y year without century (00-99)
%Y year with century (such as 1990)
%Z time zone name (such as Pacific Daylight Time)
%z time zone offset in hours and minutes from GMT (HHMM)
*)
set the fileName to ("LA_" & (today_date) & ".puz") as string
-- SAMPLE USAGE
set actionURL to "http://www.latimes.com/cgi-bin/litsoft/litsoft.pl/today.puz"
set testFormInfo to ""
set saveFilePath to "Dans HD:Users:dan:Games:acrosslite:puzzles:" & fileName
curlSimpleDownload(actionURL, saveFilePath, testFormInfo)
set openFile to (saveFilePath as alias)
tell application "Finder"
open file saveFilePath
end tell
try
open application "OmniDictionary"
end try
end run
on curlSimpleDownload(downloadURL, destExpected, theFormInfo)
-- version 1.2, Daniel A. Shockley - public domain
-- downloadURL is STRING
-- saves to destExpected (Mac path as STRING, FILE SPEC, or ALIAS), if given
-- if destExpected is "", returns source result directly as string
-- optional form data for POST - use "" for no form data
try
-- basic download to standard output
set curlCode to "curl '" & downloadURL & "'"
if (length of theFormInfo) > 0 then
set curlCode to curlCode & " -d "" & theFormInfo & """
end if
-- now, add on the desired file location, if there is one given
if destExpected is not "" then
set unixDestExpected to quoted form of POSIX path of (destExpected as string)
set curlCode to curlCode & " --output " & unixDestExpected & " --write-out "%{http_code}""
else -- result as string
set curlCode to curlCode & " | vis" -- pipe into vis to strip nonprintable characters
end if
set curlResponse to do shell script curlCode
return curlResponse
(*
curlResponse will be the http success code ("200"), or an error code.
If no destination was given, curlResponse will be the source
returned, and no file will be saved
*)
on error errMsg number errNum
error "curlSimpleDownload FAILED: " & errMsg number errNum
end try
end curlSimpleDownload
I hope somebody finds this useful — it would be really simple to adapt this to do a daily download of whatever sort of frequently updated file you want.