Board Thread:The Scriptorium/@comment-31617265-20170328080020

Anyone else out there annoyed^ by the fact that you cannot schedule to-do's? As in; create a to-do that doesn't show up in your checklist until a scheduled time^^? An example is to check your bank account next week to verify if company x has paid you back yet. Or maybe you're too busy to get your girlfriend a birthday gift right now, but you want a reminder to do it in the weekend.

The lack of this feature has been bugging me for a while now, so I decided to invest an hour and hack together a little Google script that converts Google calendar entries to to-do's every day.

Just in case anyone else out there is interested, here's a little four step guide to getting it up and running:

1) Create a new calendar in your personal Google Calendar name HabiticaReminders.

2) Go to script.google.com, this will automatically create a new Google script for you and open an editor for it.

3) Paste the code snippet below into the editor, replacing the spaces marked  and  with your own ID and token (leave the quotes!). These can be found under the API tab in your Habitica settings.

```

function scheduleToDos {

var habId = "";

var habToken = "<HabiticaAPIToken";

var now = new Date;

var events = CalendarApp.getCalendarsByName("HabiticaReminders")[0].getEventsForDay(now);

var paramsTemplate = {

"method" : "post",

"headers" : {

"x-api-user" : habId,

"x-api-key" : habToken

}

}

for (i = 0; i < events.length; i++) {

var params = paramsTemplate;

params["payload"] = {

"text" : events[i].getTitle,

"type" : "todo",

"priority" : "1.5"

}

UrlFetchApp.fetch("https://habitica.com/api/v3/tasks/user", params)

}

}

```

4) Under Edit, select Current project's triggers. Then add a trigger that runs scheduleToDos Time-driven on a Day timer. I have it run between 3-4am.

Save and you're done! The script will now run every night, harvest all the events in HabiticaReminders scheduled for that day, and add them to Habitica as medium priority to-dos. To schedule a future task, simply select the correct day in gcal and add an event with the to-do text as a title. Make sure you add it to HabiticaReminders and not your default calendar. I personally hide the calendar the rest of the time, so it doesn't even clutter my calendar interface.

Let me know if you're into the feature; if there's enough enthusiasm from the community I might take a look at building this into Habitica natively.

^ Obviously my annoyance is not intended to reflect badly on our glorious blacksmiths in any way. They're busy as hell and I honestly have no idea if anyone else is in any way interested in this feature becoming reality.

^^ Please note that this is something completely different from due dates: the point is not that the task has an end date, but rather that is has a start date. 