HTML todo-list

This script builds a daily todo-list to stay productive. Basically, it takes a few parameters (like number of tasks, a background pic, etc.) and creates a html page accordingly. Once the page is generated point your web browser to it to check the list. I use it as my browser’s starting page (the url is something like file:///Users/username/Documents/todo-list/html_holder/TODO.html). To update the list store this script as an automator service and bind the automator service to a hotkey. After that, just clickety clickety and your todo-list will change.

NOTE: Keep the TODO.html in a special directory that doesn’t have any other files since the script deletes everything in the containing folder. You’ll also need to change the parameters at the beginning of the script and if you know HTML/CSS you should write your own page formatting

P.S. using techniques like this make it easy to use AppleScript as an HTML generator ;D

tell application "Finder"
	beep
	--location for the TODO.html file:
	set buildFolder to "Untitled:Users:username:Sites:todo-list:html_holder:" as alias
	delete every item in buildFolder
	set buildFile to make new file at buildFolder with properties {name:"TODO.html"}
	set buildFile to buildFile as text
	--default pic:
	set my_pic to "../background_pic.jpg"
	--silly video/webpage to visit to celebrate finishing your TODO list!
	set my_celebration to "https://www.youtube.com/watch?v=MW1gHwiZJFg"
	
	(* Obviously edit my_pic to point to the relative path to your background pic and build folder to where you'll store the TODO list html file.  Entering it manually saves from having to annoyingly change the pic each time the script runs.  
*)
	
	--set the number of todo items
	set taskNum_query to (display dialog "How many things need to get done?" default answer "" & "4")
	set list_count to the text returned of taskNum_query as Unicode text
	set todo_items to {} --array for holding the todo items
	repeat (list_count) times
		set todo_query to (display dialog "Add todo items here:" default answer "")
		set todo_response to text returned of todo_query & "@" --used as delimiter
		copy todo_response to end of todo_items
	end repeat
	
	--this next section will extract the todo items and inject them into html
	set html_array to {}
	set oldTID to AppleScript's text item delimiters
	set AppleScript's text item delimiters to "@"
	set all_items to every text item of todo_items
	set AppleScript's text item delimiters to oldTID
	repeat with oneItem in all_items
		--use the offset to get rid of the @ delimiter at the end
		set oneItem to text 1 thru ((offset of "@" in oneItem) - 1) of oneItem
		set line_entry to "<tr><td><label><input type='checkbox'>" & oneItem & "</label></td></tr>"
		copy line_entry to end of html_array
	end repeat
	
	--Now that we have the TODO list written in HTML, we'll store the rest of the HTML/CSS code in a variable.  Edit the HTML/CSS code to your preference I guess.
	
	set html_page to "<!Doctype html>
<html>
<head>
<title>Daily TODO List</title>
<style>

table {
font-size: 20px;
font-family: Comic Sans MS;
	position: fixed;
	top: 20%;
	left: 15%;
	color: white;
	 -webkit-border-radius: 10px;
	border-radius: 10px; 
	padding-left: 1%;
	padding-right: 1%;
	}
	
	td {
	padding-left: 15px;
	}
a {
color: rgba(255,255,255,1);
text-decoration: none;
background-color: rgba(219,87,5,1);
font-family: 'Yanone Kaffeesatz';
font-weight: 700;
display: block;
padding: 4px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: 0px 9px 0px rgba(219,31,5,1), 0px 9px 25px rgba(0,0,0,.7);
-moz-box-shadow: 0px 9px 0px rgba(219,31,5,1), 0px 9px 25px rgba(0,0,0,.7);
box-shadow: 0px 9px 0px rgba(219,31,5,1), 0px 9px 25px rgba(0,0,0,.7);
width: 160px;
text-align: center;
-webkit-transition: all .1s ease 0s;
-moz-transition: all .1s ease 0s;
-ms-transition: all .1s ease 0s;
-o-transition: all .1s ease 0s;
transition: all .1s ease 0s;
}

a:active {
-webkit-box-shadow: 0px 3px 0px rgba(219,31,5,1), 0px 3px 6px rgba(0,0,0,.9);
-moz-box-shadow: 0px 3px 0px rgba(219,31,5,1), 0px 3px 6px rgba(0,0,0,.9);
box-shadow: 0px 3px 0px rgba(219,31,5,1), 0px 3px 6px rgba(0,0,0,.9);
position: relative;
top: 6px;
}
	section {
	column-count: 1;
	}

	body {
	background: url(" & my_pic & ") no-repeat center center fixed;
	-webkit-background-size: cover;
  	-moz-background-size: cover;
  	-o-background-size: cover;
  	background-size: cover;
	}
section {
position: absolute;
top: 80%;
left: 15%;
}

</style>
</head>
<body>
<table>
" & html_array & "
</table>
<section>
<a href='" & my_celebration & "'>I Finished!!</a>
</section>
</body>
</html>"
end tell

-------------------------------------------------------------------
--Ok, now we've got the html file so we'll write it to an actual file here

set the open_buildFile to open for access file buildFile with write permission
write html_page to open_buildFile
close access the open_buildFile

tell application "Finder"
	beep
	display dialog "Ok, all done." & return & return & "Now stop looking at news and get to work."
end tell