Use the Script Editor

When writing a computation script, there are several tools you can use to make the process easier.

To use the script editor

  1. Edit the script or expression.
  2. At the Script or Expression field, complete any of the following tasks:
To Do This
Have HotDocs automatically complete keywords, component names, and Multiple Choice options as you type Place your cursor in the Script field and press Ctrl+Spacebar. HotDocs displays a list of instruction and expression keywords, constant values (such as month abbreviations), and components. Type a portion of the keyword, component name, or Multiple Choice option for which you are searching. As you type, HotDocs filters the list to show only those keywords that contain the text you have typed. Once selected, press Enter to merge it into your script.

To keep seldom-used keywords out of the auto-complete list, click the Options button and clear Include seldom-used keywords in auto-complete list.

Access just a list of components Press the F5 key, select the component, and press Enter.
Access just a list of keywords Press Shift+F5, select the keyword, and press Enter.
Display a syntactical hint of how an instruction or expression should be used Place your cursor inside the keyword and press the F7 key. HotDocs displays a small ToolTip that shows the entire model as well as the type of value it produces, if it's an expression.
Indent matching pairs of IF and REPEAT instructions based on the level of their insertion Click the Auto Format button.
Undo (or cancel) an action you just performed Click the Undo button. HotDocs reverses the change you made.
Redo (or re-implement) an action you just performed Click the Redo button. HotDocs reapplies the change you made.
Cut or copy and paste a selected portion of the script Select the portion of the script you want to cut or copy, and then click the Cut button or the Copy button. The script is copied to the Clipboard. To paste the script in a new location, insert your cursor at that location and click the Paste button.
Find a specific string of text in the script Click the Find button and enter your search text in the Find what field. To find the next instance of the text, click the Find Next button.

To find only those instances of text that are complete words, select Find whole words only. To find only those instances that have the same capitalization as the text for which you are searching, select Match case.

Find a specific string of text in the script and replace it with another string of text Click the Find and Replace button. Enter the search text for which you are searching in the Find what field, and then enter the replacement text in the Replace with field. Once you have entered the required text, click Replace, Replace All, or Find Next.

To find and replace script text in a specific block of script, select the block of script first and then click the Find and Replace button. At the Find and Replace dialog box, select Replace only in selected text.

Move your cursor to a specific location in the script Click the Go To button. This displays the Go To dialog box, where you can enter the line number or character position of where you want your cursor to move.
Indent or outdent a block of the script Select the portion of the script you want to indent or outdent and click the Indent button or the Outdent button. (Click repeatedly to increase or decrease the indent.)
Cause HotDocs to ignore a section of the script when it processes it, or insert a comment in the script Highlight the block of the script you want to comment and click the Comment Block button. This puts two forward slashes in front of each line of the script, which instructs HotDocs to ignore this section. To uncomment it, highlight the text and click the Uncomment Block button.
Match an IF or REPEAT instruction with its END IF or END REPEAT instruction (or vice versa) Place your cursor inside the instruction, right-click, and select Match IF/REPEAT from the shortcut menu. (You can also press Ctrl+M.)
Highlight an entire IF or REPEAT instruction block (meaning everything between a beginning and ending IF/REPEAT instruction) Place your cursor inside the instruction, right-click, and select Select IF/REPEAT from the shortcut menu. (You can also press Ctrl+Shift+M.)
View helpful information while using the script editor, including accessing help topics for the different instructions and expressions you can use in your script Click the HotDocs Help button.
Customize the way the script editor works Click the Options button and make your changes. (See Change Script Editing Options.)
Insert line breaks and tab characters in a script See Use Line Breaks, Paragraph Ends, and Tabs in Computation Scripts.
Assign formatting characteristics to literal text strings in a script Insert the corresponding dot code. See one of the following topics for details:

To access the script editor toolbar using the keyboard, press F10.

To access help for each instruction or expression, first select the model in one of the lists and then press Ctrl+F1.

For an explanation of the HotDocs scripting language, see Understand the HotDocs Scripting Language. For details on creating a Computation variable, see Customize a Computation Variable. For a list of instruction and expression models, see Introduction: Instruction and Expression Models.