Action

Accordance

Last update about 5 years ago

Still rough (I’ll be updating), but it will grab either Scripture references or complex Accordance searches and create a link. It drops the link into the next line of your draft, copies it to your clipboard, and opens the search in Accordance. For your Accordance search query, it can be highlighted or if it’s alone on a new line it will grab the entire line.
I used #a for a search, #o for and #r for [range] and it will take it from there.

Steps

  • script

    var sel = editor.getSelectedText();
    // if there was no selection get the whole line
    if (!sel || sel.length == 0) {
    let [st, len] = editor.getSelectedLineRange();
    var text = editor.getTextInRange(st, len);
    }
    else {
    var text = sel
    } 
    // and if there's nothing on the line, get the clipboard
    if (text.length == 0) {
    var text = app.getClipboard();
    }
    else {
    } 
    // editor.setTextInRange(st, len, "");
    
    
    //choose your accordance shortcut symbol
    var symbol = "#"
    
    //accordance specific search terms
    
    var text = text.replace(/#a/g, '<and>');
    var text = text.replace(/#o/g, '<or>');
    var text = text.replace(/#n/g, '<not>');
    var text = text.replace(/#r/g, '[range ');
    var text = text.replace(/#/g, "] ");
    
    //gets rid of spaces
    var text = text.replace(/ /g, "_");
    
    //adds URL header
    //text = "accord://search/ESVS?" + text;
    draft.setTemplateTag("link", text);
    //editor.setSelectedText(text);
    
    
    
    //var regex = new RegExp("ReGeX" + testVar + "ReGeX");
    //string.replace(regex, "replacement");
  • url

    template
    accord://search/ESVS?[[link]]
    useSafari
    false
    encodeTags
    true
  • script

    text = "accord://search/ESVS?" + text;
    app.setClipboard(text);
    text = '\n' + text;
    editor.setSelectedText(text);
    

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.