-
-
Save alistaircom/1e3b92b8695e39beb661ceea257ea1d3 to your computer and use it in GitHub Desktop.
Read upcoming Apple Reminders and sort them into an HTML table for use in Panic's Status Board
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Reminders" | |
set output to "" | |
set hasOne to false | |
repeat with i from 1 to (count of (reminders whose completed is false)) | |
set theReminder to reminder i of (reminders whose completed is false) | |
set reminderName to name of theReminder | |
set theList to name of container of theReminder | |
if due date of theReminder exists then | |
set dueDate to due date of theReminder | |
set timeStr to time string of dueDate | |
set dateStr to date string of dueDate | |
set dayInt to text -2 thru -1 of ("00" & day of dueDate) | |
set monthInt to text -2 thru -1 of ("00" & ((month of dueDate) as integer)) | |
set yearInt to year of dueDate | |
set output to output & yearInt & monthInt & dayInt & tab & theList & tab & reminderName & linefeed | |
end if | |
end repeat | |
end tell | |
set sortedValues to do shell script "echo " & quoted form of output & " | sort -n -k1" | |
set tid to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to ASCII character 10 | |
set AppleScript's text item delimiters to tid | |
set theData to paragraphs of sortedValues | |
set theBigList to {} | |
set text item delimiters to tab | |
repeat with i from 1 to count of theData | |
set theLine to text items of item i of theData | |
copy theLine to the end of theBigList | |
end repeat | |
set text item delimiters to "" | |
if hasOne is false then | |
set theDate to "" | |
set theTask to "" | |
set theCon to "" | |
set hasOne to true | |
set htmlOutput to "" | |
repeat with i from 2 to count of theBigList | |
set theD to text 7 thru 8 of item 1 of item i of theBigList | |
set theM to text 5 thru 6 of item 1 of item i of theBigList | |
set theTask to item 3 of item i of theBigList | |
set theCon to item 2 of item i of theBigList | |
set htmlOutput to htmlOutput & "<tr>" & return & "<td class=\"projectIcon\"><img src=\"http://www.clker.com/cliparts/T/c/V/a/h/H/checkbox-checked-gray-md.png\" /></td>" & return & "<td class=\"Last Modified\" style=\"width: 153px\">" & theM & "-" & theD & "</td>" & return & "<td class=\"projectName\" style=\"width: 228px\">" & theCon & "</td>" & return & "<td class=\"projectTask\" style=\"width: 480px\">" & theTask & "</td>" & "</tr>" & return | |
end repeat | |
end if | |
set preamble to "<table id=\"projects\">" & return & "<table style= font-size:0.8em>" | |
set outro to "</table>" | |
-- change the next line to point to a folder within your Dropbox | |
do shell script "echo " & quoted form of preamble & quoted form of htmlOutput & quoted form of outro & " > /Users/Uermane/Dropbox/StatusBoard/StatusMinders" & ".html" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment