A simple new year script, inspired by reading a biography of a 19c figure whose habits included making sure that he read every Shakespeare play once a year.
A secularisation, it seems, of more ancient traditions of reading cycles :-)
A secularisation, it seems, of more ancient traditions of reading cycles :-)
Code:
-- Creates projects, with start and due dates spread through the year, -- for an annual cycle of reading all 40 Shakespeare plays, in a supposed chronological order of writing. property pTitle : "Cycle of Reading" property pVer : "0.4" -- Ver 0.4 Defaults to making reading projects parallel rather than sequential, so that note-taking is 'available' during reading. -- Includes the name of the play in the text of each item -- Ver 0.3 Allows for an OF Context to be specified (pstrContext below) -- Sets repetition to annual -- Sets next review date to year hence -- Shows progress in the Terminal and creates a log file -- OPTIONALLY SPECIFY THE NAME OF A CONTEXT FOR THIS READING -- (if the named context does not yet exist in your OF, the script will create it) property pstrContext : "" property pstrFolderName : "Reading Cycles" property pstrVerb : "Read" & space property pblnAnnualRepeat : true property pstrLogFile : "ReadingScript.txt" property pblnTermLog : true property pblnSequential : false property plstPlays : {¬ {"Henry VI Part I"}, ¬ {"Henry VI, Part II"}, ¬ {"Henry VI, Part III"}, ¬ {"Richard III"}, ¬ {"The Comedy of Errors"}, ¬ {"Titus Andronicus"}, ¬ {"Taming of the Shrew"}, ¬ {"The Two Gentlemen of Verona"}, ¬ {"Love's Labour's Lost"}, ¬ {"Romeo and Juliet"}, ¬ {"Richard II"}, ¬ {"A Midsummer Night's Dream"}, ¬ {"King John"}, ¬ {"Edward III"}, ¬ {"The Merchant of Venice"}, ¬ {"Henry IV, Part I"}, ¬ {"Love's Labour's Won"}, ¬ {"Henry IV, Part II"}, ¬ {"Henry V"}, ¬ {"Julius Caesar"}, ¬ {"Much Ado About Nothing"}, ¬ {"As You Like It"}, ¬ {"The Merry Wives of Windsor"}, ¬ {"Hamlet"}, ¬ {"Twelfth Night"}, ¬ {"Troilus and Cressida"}, ¬ {"All's Well That Ends Well"}, ¬ {"Othello"}, ¬ {"King Lear"}, ¬ {"Macbeth"}, ¬ {"Measure For Measure"}, ¬ {"Antony and Cleopatra"}, ¬ {"Coriolanus"}, ¬ {"Timon of Athens"}, ¬ {"Pericles, Prince of Tyre"}, ¬ {"Cymbeline"}, ¬ {"The Winter's Tale"}, ¬ {"The Tempest"}, ¬ {"Henry VIII"}, ¬ {"The Two Noble Kinsmen"}} property plstStages : {"Choose text / audio / video of ", "Read / listen / watch to end of ", "Write notes of thoughts arising from reading of ", "Archive notes on "} property plngInterval : (365 * days) / (length of plstPlays) on run -- CHOOSE START DATE (THE DEFAULT IS NOW) set strToday to short date string of (current date) set varResponse to display dialog "Enter date for start of reading cycle:" default answer strToday with title pTitle if varResponse is false then return set strStart to text returned of varResponse try set dteStart to date strStart on error display dialog "Invalid Date: " & strStart with title pTitle end try tell application id "com.omnigroup.omnifocus" tell default document -- FIND OR CREATE THE FOLDER FOR READING CYCLES set lstFolders to flattened folders where name = pstrFolderName if length of lstFolders > 0 then set oFolder to first item of lstFolders else set oFolder to make new folder with properties {name:pstrFolderName} end if set oContext to missing value if pstrContext ≠ "" then try set oContext to first flattened context where name = pstrContext on error set oContext to make new context with properties {name:pstrContext} end try end if -- SET ANY REVIEW AND REPETITION INTERVALS set recReview to {fixed:true, steps:1, unit:year} as record if pblnAnnualRepeat then set recRepn to {fixed:true, steps:1, unit:year} as record else set recRepn to missing value end if -- DIVIDE THE YEAR AMONG THE READINGS IN THE LIST set lngPlays to length of plstPlays repeat with i from 1 to lngPlays set strPlay to first item of item i of plstPlays set oProj to make new project at end of projects of oFolder with properties ¬ {name:pstrVerb & (strPlay), start date:dteStart, due date:dteStart + plngInterval, context:oContext, repetition:recRepn, review interval:recReview, sequential:pblnSequential} ¬ set dteStart to dteStart + plngInterval repeat with iTask from 1 to length of plstStages make new task at end of tasks of oProj with properties {name:(item iTask of plstStages) & strPlay} end repeat if pblnTermLog then my TermLog(strPlay) end repeat end tell end tell activate display dialog (lngPlays as string) & " reading projects" & return & return & "written to OmniFocus folder: " & pstrFolderName buttons {"OK"} with title pTitle end run on TermLog(strText) tell application id "com.apple.Terminal" activate set strCmd to "echo " & (quoted form of strText) & " " & (quoted form of ((current date) as string)) & " >> " & pstrLogFile do script strCmd in front window end tell end TermLog
Last edited by RobTrew; 2011-01-06 at 02:29 AM.. Reason: Draft 0.4 (Projects parallel by default, to facilitate note-taking while reading)