Scripts – Advanced Script Settings (Text)

Advanced Script Settings are established in the Advanced tab of the script editor. These allow for precise control over the files to be processed and the program options functions in effect during the script. File selection for the script is determined first by the path and file mask fields in the Script Editor and then by the boolean Expression Evaluator in the “Process File When Expression is Non-Zero” field (also see below).

Advanced Script Settings also allow you to supply comment text to help you keep track of your scripts.

Note: Advanced Script Settings are intended for scripts run via batch files using command line switches. They are designed to be used with replacement prompting turned off. Please see Advanced Expressions and Replacement Operations for information about the behavior of replacement prompts when a complex expression is in effect and advice on debugging your expressions.

Details on the Advanced Script Settings Fields:

Script Description: A descriptive comment of your choice may be entered here.

Process File When Expression is Non-Zero: This field is the boolean “Expression Evaluator” which is used to determine which files among those that meet the path, file mask, and filter criteria are actually processed by your script. The variables in this field are labeled E1, E2 … En, where n is the number of search/replace strings in your script. Under the default OR expression (e.g., E1 OR E2) all files that meet the path, file mask, and filter criteria are processed. Other combinations of operators and variables in the expression allows you to process only certain files within the domain of possible files according to your path and file mask criteria. When the result of the expression is non-zero, a file will be processed.

The field may contain: a) the AND OR NOT < > <= >+ = != + – * / operators, b) E1, E2, E3,… En to denote the search & replace string pairs in the script, c) numeric values denoting the number of replacement opportunities for a variable (e.g., E2 >= 1), d) comparisons of the numeric values of the number of replacement opportunities (e.g., E1 AND (E2 != (E3))), and, e) arithmetic expressions on the values of the En variables (e.g., (E1 + E2) = (+5)).

Important Note: When making replacements the ‘Process File When Expression is Non-Zero’ comes into play after all search hits have been accumulated. When making replacements you will receive replace confirmations (if confirmations are enabled) for all places where a search hit exists for a given search expression even though the ‘Process File When Expression is Non-Zero’ field may rule out that replace once all the search hits are collected. Do not be alarmed! This is for debugging your search terms. When you are satisfied that your search terms are finding what they should find you must answer ‘Replace This’ or ‘Replace All’ to replacement prompts in order for ‘Process File When Expression is Non-Zero’ to be applied properly. The expression is based on ‘replacement opportunities’. If you rule out a replacement opportunity by answering ‘No’ to a replace confirmation you may affect the final assessment by the ‘Process File When Expression is Non-Zero’ file. Please see Expression Evaluator and Replacement Prompts for more detail. Also see Expression Evaluator for details.

Options Button: Opens an abbreviated Options Dialog you can use to specify settings for the script. The Options-General tab is not available here because those settings are not needed during scripted operations.

Use Program Options Checkbox: When checked, the script uses the Options in effect for Search & Replace. When unchecked, the script overrides the Options settings and uses changes you make via the Options Button to the left of this field. To remove all options from a script and use the current program settings instead, check this field.

Repeat Script: This is the Script Loop operator. This setting affects the entire script. The default value is 1. To repeat the entire script more than once, select a new value.

Search Subdirectories Checkbox: By default, scripts follow the “Search Subdirectories” settings on the Main Window. Check this box if you want your script to search subdirectories regardless of the setting in the Main Window. This field is dim if “Use Program Options” is checked.

Save As button: Click to save the created/modified script to disk.

Load button: Click to load a script from disk for editing or using Search, Search and Replace, Touch or File Find.

Use Script button: Click to use the script for Search, Search and Replace, Touch or File Find. You can override several of the script settings in the main window (see Scripts for details).

Cancel button: Exits the dialog without using the script settings. If you made changes to a script, you are asked whether you want to save the information. The ESC key also cancels.

Help Button: Activates F1 Help.

Scripts – Advanced Script Settings (Text)