Created
January 22, 2017 08:07
-
-
Save shotarok/992405d46002d345f15eaeb6d9584a39 to your computer and use it in GitHub Desktop.
講師名も含んだカレンダーイベントを作成するスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function DMMEnglish() { | |
var criteria = "from:[email protected] レッスン予約完了"; | |
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