Introduction: Your Friendly Reminder

Your Friendly Reminder is a friendly, more gentle approach to calendar reminders. It was custom-developed for a user who suffers daily from cognitive overload in the afternoon as a result of a previous stroke. Rather than sending individual template alerts to the user to remind him of upcoming events, Your Friendly Reminder connects with Google Calendar to aggregate all of the user’s events that occur in the afternoon. In order to minimize unwanted distractions, it personalizes each daily email reminder to the user’s color preferences, and presents all of his events in a clear format that is simple and pleasing to the eye.

Step 1: Create New Google App Script Project

Go to script.google.com and if prompted click on Start Scripting.

Once on logged into Google App Script, a pop-up window will appear. Select "Black Project".

Step 2: Copy Code Into Your New Project

  1. Go to http://bit.ly/1Ixmq1S
  2. To the left of the page, there are two files: "Demo.gs", and "DemoReply.gs". While your file names do not have to be the same, each one's content will have to be in it's own separate file.
  3. To create a new file, go to the menu at the top select "File"->"New"->"Script File". You can name this file whatever you want.
  4. Now, simply copy and paste all of the code from "Demo.gs" and "DemoReply.gs" into your two separate files.

Step 3: Updating "Demo.gs"

Now, the files have some variables that need to be changed in order to work for your personal use.

With in the "Demo.gs" file there is a section where you can tweak some of the variables to your liking.

Update the variables with in the "CHANGE THESE" section (circled in red) in order for the script to work. Where name is the name you want the reminders to refer to and e-mail address is the email you wish for the daily reminders to be sent.

The other variables don't have to be changed in order for the script to work, but can be modified to tweak the look and some functionality of the script.

These include:

  1. startHour: The start time that your daily events are gathered from (24 hr format, eg. 13 for 1pm)
    • Example: Change to 12 if you don't want the system to add events in the email occurring before noon
  2. endHour: The end time that your daily events are gathered until (24 hr format, eg. 13 for 1pm)
    • Example: Change to 17 if you don't want the system to add events in email occurring after 5pm
  3. backgroundColor: The background color of the email
  4. evenRowColor: Color of even rows in the table of events sent in the email
  5. oddRowColor: Color of odd rows in the table of events sent in the email
  6. adorablePictures: List of pictures randomly selected form and send in the email.

Step 4: Testing Functionality of "Demo.gs"

To assure that you have completed all the previous steps successfully, it is time to test out the functionality of the "Demo.gs" script.

In order to do this:

  1. Go to the "Select Function" drop-down at the top of the script editor (highlighted in red)
  2. Select the "sendDailyReminder" function
  3. Press the "Run" button (highlighted in blue).
  4. Click accept whenever prompted for permissions.

If everything worked correctly, you should receive an email to the one you specified in the previous step with your events for the day.

If no events come up, make sure that your events are set in the default calendar and that the Google account you are running the script on has events in its calendar.

Step 5: Updating "DemoReply.gs"

Just like in the previous step, there are some variables that need to be changed in order for the script to function properly.

In this case, there is a document keeping track of when the script has successfully replied to a message once you have replied to a daily reminder thread.

To set up the document keeping track of these replies:

  1. Go to docs.google.com and create a new document.
  2. Once you created your document, get the id of that document
    1. To get id, look at the address bar whenever viewing the document, should be something along the lines of

      https://docs.google.com/document/d/YOUR DOCUMENT ID/edit

    2. Copy the alphanumeric code where the "Your document id" is
  3. Within the script, replace the "PUT YOUR DOCUMENT ID HERE" (highlighted in red) with the document id gathered from the previous step

The next modifiable variable "startHours" simply tells the script when it should start running and verifying your daily reminder threads.

Step 6: Testing "DemoReply.gs"

Now, we need to make sure that the "DemoReply.gs" script is working correctly.

To do this:

  1. Send yourself a daily reminder (see Step 4 on how to do this)
  2. Reply to the daily reminder email with the keyword given in the email
    1. The reply has to be within the same email thread and the first word has to be the keyword in the reminder email
  3. Select "checkTodaysThread" function from the "Select function" dropdown (highlighted in red)
  4. Click "Run" to run the script (highlighted in blue)

Once you've done this, an email should automatically be sent to the same thread notifying you that the message has been received.

You can also check to see if the document you have set to receive the replies has today's date on it. If not, make sure that you have set the correct document id in the previous step.

Step 7: Automating the Scripts

Congratulations, you now have all of the functionality to automate the scripts to run automatically.

To do this:

  1. Click on the "Current Project Triggers" button (the clock in the top tool bar, highlighted in blue) to set the automatic triggers that run your script
  2. Add the first trigger to run "sendDailyReminder" as a "Time-driven" "Day timer" and set the times the reminder will run between.
    • Scripts are guaranteed to run any time between the selected time, but not at a specific time to assure message is sent on time, assign it an hour before you want the email to be sent
  3. Next, "Add a new trigger" to run "checkTodaysThread" as a as a "Time-driven" "Minute timer" and set it to run "Every minute"
    • Can also be set to run "Every five minutes", automated replies from the script might just take a bit longer at that point
  4. Once that is done, click "Save" and you are done.
  5. Enjoy!

Comments

author
ringai (author)2014-12-10

This is one of the best tools I've seen on instructables. You've done some innovative work with this script. Thank you so much for writing it.

author
JanR1 (author)ringai2014-12-10

Thanks!