Skip to content

Instantly share code, notes, and snippets.

@shotarok
Created January 22, 2017 08:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shotarok/992405d46002d345f15eaeb6d9584a39 to your computer and use it in GitHub Desktop.
Save shotarok/992405d46002d345f15eaeb6d9584a39 to your computer and use it in GitHub Desktop.
講師名も含んだカレンダーイベントを作成するスクリプト
function DMMEnglish() {
var criteria = "from:info@mail.dmm.com レッスン予約完了";
eachUnreadMessage(criteria, function (message) {
var body = message.getBody();
var [matched, year, month, day] = /ご予約日:(\d+)年(\d\d)月(\d\d)日/.exec(body);
var [matched, sh, sm] = /開始時間:(\d\d)時(\d\d)分/.exec(body);
var [matched, teacher] = /講師名:([^\n]+)/.exec(body);
var sdate = new Date(year, month-1, day, sh, sm);
var edate = new Date(sdate.getTime() + 30 * 60000);
createEvent("DMM英会話 " + teacher + "先生", sdate, edate);
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment