GMail TODO Script

After reading GMail Snooze with Apps Script I thought "Gosh, that's almost what I need to make GMail my go-to TODO list platform." Well, I finally sat down and closed the gap.

var MARK_UNREAD = true;
var MARK_IMPORTANT = true;
var ADD_TODO_LABEL = true;

function setup() {

function reviveTODOs() {
  var todayString = Utilities.formatDate(new Date(),
     TIMEZONE, "yyyy/MM/dd");
  var todaysLabel = 
  var page = null;

  // Get threads in "pages" of 100 at a time
      && (!page || page.length == 100)) {
    page = todaysLabel.getThreads(0, 100);

    if (page.length > 0) {
      if (MARK_UNREAD) {

      if (MARK_IMPORTANT) {
      if (ADD_TODO_LABEL) {

Instead of using "Snooze x Days" labels, I use date labels like "2011/08/11" to remind myself to follow up on bills, respond to emails, etc. With this modified version of Corey Goldfeder's script, I don't have to remember to check those labels, they just pop back into my inbox automatically. I had a little problem with the markThreadsImportant call not seeming to work. Don't know what's up with that. But otherwise, it has performed well so far in testing.

Update: Be sure to set the timezone that the script will run in and the timezone used to format date labels to the same timezone. See Using Time-Driven Triggers.

Like this script? Have your own variation? Please share!

No comments:

Post a Comment