Journalx

Script key

Posted by @nahumck

Install

Details

Label Journalx
Voice Over
Script
//Script Key to insert the heading of a journal entry with
//a range of dates from Monday to Sunday of a given week

var nowdate = new Date();
var yyyy = nowdate.getFullYear();
var mm = nowdate.getMonth()+1;
var dd = nowdate.getDate();
var future = dd+6;

if(dd < 10) {
    dd = '0' + dd;
} 

if(mm < 10) {
    mm = '0' + mm;
}

var today = yyyy+'-'+mm+'-'+dd+'';
var sunday = yyyy+'-'+mm+'-'+future+'';
var start = "journalx";
var complete = start+' '+today+' to '+sunday+'';
var selRange = getSelectedRange();
setSelectedText(complete);
setSelectedRange(selRange[0]+complete.length,0);

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus