@due

Script key

Posted by @nahumck

Install

Details

Label @due
Voice Over
Script
// Insert @due tag for use with taskpaper
// If no text is selected, inserts the "@due()" tag
// with the cursor moved inbetween the parentheses.
// If text is selected, inserts the "@due()" tag
// with the selected text inbeween the parentheses.

var sel = getSelectedText();
var selRange = getSelectedRange();

if (!sel || sel.length == 0) {
  setSelectedText("@due()");
  setSelectedRange(selRange[0]+5,0);
}
else {
  setSelectedText("@due("+sel+")");
  setSelectedRange(selRange[0]+selRange[1]-1,0);
}

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus