Create a Custom Scripture Check in the Paratext Menu


Learn about how to write "regular expressions" to match patterns in the text. 

Create the expression(s) you want to search for and test them with the regex: prefix in the search dialog.  When you have your expression working, you can follow the steps below to create your entry in the Custom Tools menu.

Create the Files

  1. Make copies of the Image SampleCheck and Image SampleCheck files.
  2. Rename them both to reflect the check you will be doing.

Set up the CMS file


This is followed by a space and the name of the check.  This check will be featured in the project menu of Paratext under Tools -> Custom tools


The description will show in the dialog that pops up when selecting the check from the menu:

Paratext Script Dialog 


Optionally include an rtf file here.  This will place a help button on the dialog box that opens the rtf file. (Not sure if it needs to be RTF -- what about html? Someone try it and update the instructions)


You can create a new submenu for your scripts or include them in one of the existing submenus just by naming it here.  Many scripts are listed in the Unsupported menu, but we are not a fan of unsupported products.  If your script is designed to help people, wouldn't you want to follow through?


This must point to the name of the python file that you will be editing in the next step.


This determines where your plugin shows in the list.  Rank 1 is near the top.  If only Google made it this easy...


Edit the Python File

The Python file contains a number of options that can be configured, and the more you know about Python, the more these will make sense to you. For the most basic RegEx check, you can just comment out this line by typing # in front of it:

Copy to clipboard
# patterns.addPattern(r"\bhad had\b")

Then add your regular expression in the next session that contains the bad pattern you are looking for.


Copy to clipboard
patterns.addPattern(r"\\v[0-9]", "Missing space after \\v")

Testing your Check

If you run the check and it fails, you may need to use a Python debugger to troubleshoot. You can download the free ActivePython development envirnonment from ActiveState.com.  Then you can step through the check in the Python debugger by opening the file tmp.py from the My Paratext Projects\cms directory.


This reference contains all of the commands that are found in the existing cms file.  Because the documentation is sparse, we will add a description as we learn what they do.


Places the Book selector on the dialog:

Book Selector 


The name of the check.  This check will be featured in the project menu of Paratext under Tools -> Custom tools


The description will show in the dialog that pops up when selecting the check from the menu:


Adding an RTF file will add a help button to the dialog which will open the RTF file


No idea 


Which setting should this option default to?


Describe the purpose of this option


No idea


?Select box to select a project from all installed projects


?Provide options in an additional language.  Don't know how this works.


This is the name which the user will see


This is the name by which the option will be know to the python program. It must begin with a letter and not include anything except letters and numbers.


The project to send the results to.


Request user input as a text variable.


Request user input as a text variable


Usually Python


The order this will show in the Paratext menu


The name of the Python script to run


The submenu you want this script listed under


No idea


Send output to html


Send output to the Paratext list


Send output to a text file


Send output in utf8 (probably not needed anymore)


No idea


Contributors to this page: dhigby .
Page last modified on Monday December 13, 2021 12:41:36 GMT-0000 by dhigby.


Creative Commons License
All content on this LingTranSoft wiki are by SIL International are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.