MQL Script: Keep multiple quoted texts and paste them with correct link format to md and rtf automatically

What the script does: the user can copy and add multiple selected texts to an MQL list for citation links during a literature review. The text and links will be paste in the correct link format to markdown and rich text notes automatically. I wrote this script to work with the StackV5 and TaggerV5.

The major features of this version:

  • Add any number of the selected texts to an MQL list and paste those texts as citation links in markdown and rich text notes at any time.
  • The script will detect the file format of markdown and rich text files and paste the correct link format automatically.
  • User can change the style of the citation link to be pasted even after the text is copied and added into the MQL list.
  • Preferences are set in a single dialog box and no change to the script is required.
  • One global preference for all databases.


  1. Paste link as a quotation ( paste a text+back link) or bookmark (past a backlnk only).
  2. The maximum number of selected texts the user wants to keep in the MQL list.
  3. Some older journal articles have " - " or other symbols as line returns, the user can trim those symbols from the selected text. This feature works well when the OCR quality of the pdf file is good.
  4. There are three choices for the link text of the back link: a fixed name, the name of the source document, or 5. A value that is stored in a user-defined cmd of the source document.


Each time the user invokes the script, the selected text in a document will be marked and added to an MQL list (the texts are saved in a plist file). User can continue to select-and-add texts into the MQL list.

When the user is working on a markdown or rich text note (or other editable files) and no text is selected, an MQL list will be shown when the script is invoked. The script will paste a quotation link with the correct format at the editing cursor of the note when the user double click or select the item in the list and click OK.

  • The MQL list in this example has 10 items, showing the page/paragraph number and the first 10 words of those selected texts.
  • When the maximum numbers of saved texts are reached, the list will be updated on a FIFO basis.

The script will detect markdown and rich text file formats and choose which link format to use automatically. For other editable file formats, the script will paste a markdown-style link.

Note: The action of MQL script is contextual.

  • If a group, a tag, or no item is selected, or when no text is selected in a pdf document, the script assumes that the user wants to change the preference.
  • If some texts are selected in a document, the script assumes that the user wants to add the selected text into the MQL list. I have only tested the MQL script for pdf, markdown, and rich text files. However, the script should be able add selected text from most of the other document types.
  • If the user is at a markdown or rtf/rtfd note and no text is selected, the script assumes that the user wants to paste a quotation link from the MQL list.

The requirements to run the script

  1. You need to download Dialog Toolkit Plus from the Late Night Software website and save it under “/Library/Script Libraries”.

The script
Enjoy. (59.2 KB)

v1b3 to eliminate the click-and-paste step if the preference is “Keep the last 1 quotations”. (59.6 KB)

1 Like

An updated v1b3 is in post#1.

If the “Keep the last N quotations” in the preference is set to 1, the script won’t show the MQL list and will paste the last selected text as quotation link into the note directly.

A more exiting new version (for me) is MQNL that allows a more uninterrupted highlight-and-comment workflow.