Scripts - Expression Evaluator

Described below is a general introduction about the Expression Evaluator, some specific notes, and some basic examples.

Introduction:

Expression Evaluator Field
image\s_edit5.gif

The "Expression Evaluator" is the "Process file when expression is non-zero" field in the Advanced Script Settings dialog. The expression in this field determines which files among those meeting the file mask, path, and filter criteria are ultimately processed by your script. If the result of the expression is 1 for a file, that file will be processed further. Under the default OR expression, all files meeting the file mask, path, and filter criteria are processed because the value of the expression would be 1 for each file - If a search string makes a hit, that search (or replace) will occur. Other combinations of operators and variables in the expression would allow you to process only certain files within the domain of possible files according to your file masks, path, & filters.

The variables E1, E2, ... En reference the search/replace string pairs in the script. A script with 3 strings would have E1, E2, & E3 available.

The valid operators are: AND OR NOT < > <= >= >+ = != + - * /

The default expression is an OR statement, e.g., E1 OR E2 OR E3

Numeric values may be used in conjunction with variables to denote the number of replacement opportunities in a file. For example, the expression

E1 AND (E2 = 4)

would process only those files where the first search & replace pair could occur one (or more) times and the second search & replace pair could occur exactly 4 times.

Notes on the Expression Evaluator:

Some Basic Expression Evaluator Examples:

Note: These examples assume that Replacement Prompts are disabled OR no "Skip" replacements are allowed if Replace Prompts are turned on. See Advanced Expressions and Replacement Operations for more information about the possible influence of "Skip(s)" on expressions involving numeric values.

FILE CONTENTS

File 1

File 2

File 3

JILL
JACK
JOHN

JACK
CAROL

JILL
JACK
JOHN

Script Search Strings:

E1 = JILL
E2 = JACK
E3 = JOHN
E4 = CAROL

Expression Evaluator: E2 AND E4

Files That Would Be Processed: FILE 2

 

FILE CONTENTS

File 1

File 2

File 3

JILL
JACK
JOHN

JACK
CAROL

JILL
JACK
JOHN

Script Search Strings:

E1 = JILL
E2 = JACK
E3 = JOHN
E4 = CAROL

Expression Evaluator: E1 AND E4

Files That Would Be Processed: None

 

FILE CONTENTS

File 1

File 2

File 3

12/18/94
Page 95
www.funduc.com

12/01/95
12/15/95

12/19/95
www.funduc.com

Script Search Strings:  (Note: E2 is a Regular Expression)

E1 = 12
E2 = /*[0-9]/
E3 = 95
E4 = www.funduc.com

Expression Evaluator: E1 AND E2 AND ((E3 >= 2 OR E4)

Files That Would Be Processed: FILE2 FILE3