06 October, 2011

SNOOZE an email...

GMAIL STUFF


SNOOZE an email...
This is pretty easy to do... The article only misses on step... 
Delete this (default text) from the 'Script Editor' when it comes up:
==============
function myFunction() {

}
==============
http://gmailblog.blogspot.com/2011/07/gmail-snooze-with-apps-script.html

There is a video as well but here are the steps...

How to set it up Even if you don't know how to write a script, it's pretty simple.

1) Go to Google Docs and create a new spreadsheet,
2) then choose "Script Editor" from the "Tools" menu...

3) delete the existing text in the code editor, and paste in this code:


var MARK_UNREAD = false;

var ADD_UNSNOOZED_LABEL = false;

 

function getLabelName(i) {

  return "Snooze/Snooze " + i + " days";

}

 

function setup() {

  // Create the labels we'll need for snoozing

  GmailApp.createLabel("Snooze");

  for (var i = 1; i <= 7; ++i) {

    GmailApp.createLabel(getLabelName(i));

  }

  if (ADD_UNSNOOZED_LABEL) {

    GmailApp.createLabel("Unsnoozed");

  }

}

 

function moveSnoozes() {

  var oldLabel, newLabel, page;

  for (var i = 1; i <= 7; ++i) {

    newLabel = oldLabel;

    oldLabel = GmailApp.getUserLabelByName(getLabelName(i));

    page = null;

    // Get threads in "pages" of 100 at a time

    while(!page || page.length == 100) {

      page = oldLabel.getThreads(0, 100);

      if (page.length > 0) {

        if (newLabel) {

          // Move the threads into "today's" label

          newLabel.addToThreads(page);

        } else {

          // Unless it's time to unsnooze it

          GmailApp.moveThreadsToInbox(page);

          if (MARK_UNREAD) {

            GmailApp.markThreadsUnread(page);

          }

          if (ADD_UNSNOOZED_LABEL) {

            GmailApp.getUserLabelByName("Unsnoozed")

              .addToThreads(page);

          }         

        }    

        // Move the threads out of "yesterday's" label

        oldLabel.removeFromThreads(page);

      } 

    }

  }

}



(These steps are a little different in the new version of Google Docs)


4) Then click the "Save" button and give it a name. 


5) In the dropdown labeled "Select a function to run," choose "setup" and click the blue run arrow to the left of it. 

5a) This will ask you to authorize the script, and will create the necessary labels in your Gmail. Just follow the prompts and allow / authorize accordingly

6) Then go to the "Triggers" menu and choose "current script's triggers." 
~ 6a) Click the link to set up a new trigger, 
~~ 6a1) choosing the "moveSnoozes" function, 
~~ 6a2) a "time-driven" event, 
~~ 6a3) "day timer," 
~~ 6a4) and then "midnight to 1am."

LAST Click SAVE and you're done.





No comments:

Post a Comment