Action

Thesaurus

Posted by @Joel_Arnold, Last update over 3 years ago

Grabs text and looks up on Thesaurus.com. The text chosen is in this priority order:
1) Selected text. If there is nothing selected…
2) The last word before the cursor on the same line. If the cursor is on an empty line…
3) The clipboard

Steps

  • script

    var sel = editor.getSelectedText();
    // if there was no selection get the whole line
    if (!sel) {
    let [st, len] = editor.getSelectedLineRange();
    var line = editor.getTextInRange(st, len);
    var word = line.split(" ");
    var text = word.slice(-1)[0]
    }
    else {
    var text = sel
    } 
    // and if there's nothing on the line, get the clipboard
    if (!text) {
    var text = app.getClipboard();
    }
    else {
    } 
    draft.setTemplateTag("link", text);
  • url

    template
    https://www.thesaurus.com/browse/[[link]]?s=t
    useSafari
    false
    encodeTags
    true

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.