If Text Contains

Executes the steps immediately following this step if the specified text is (or is not) contained within the target text. Otherwise, step execution follows the next Else step, or End If step. Commonly used to check the contents of a piece of text and perform conditional actions depending on whether it is found.

Declaration

<AMIFCONTAINS ACTION="text [options]" TEXT="text" SUBSTRING="text" USERE="YES" USECASE="YES" FOUNDTEXTVARIABLE="text [variable]" INDEXVAR="text [variable]">

See Also: If, If Compare Files, If Folder Exists, If Last Step, If Pixel Exists, If Process Running, If Windows Exists, End If, End Select/Case, Goto, Label, Select/Case, Else

General Tab

Property

Type

Required

Default

Markup

Description

If

Text (Options)

Yes

Text Contains

ACTION="not_contain"

Specifies whether the condition should check for the characters to be contained or not contained within the text. The available options are:

  • Text contains: The IF block will be executed if the characters are contained in the text.

  • Text does not contain: The IF block will be executed if the characters are not contained in the text.

Target text

Text

Yes

(Empty)

TEXT="The target text"

The text to search from. As with every text parameter, if the data you want to write is contained in a variable, enter the variable name surrounded by percentage signs to resolve it to it's contents at runtime (i.e. %VarName%).

Text to look for

Text

Yes

(Empty)

SUBSTRING="target"

The text to search for inside the target text. As with every text parameter, if the data you want to write is contained in a variable, enter the variable name surrounded by percentage signs to resolve it to it's contents at runtime (i.e. %VarName%).

Case Sensitive

Yes/No

No

No

USECASE="YES"

Specifies whether the search performed should be case sensitive. If set to YES, case sensitivity is turned on. If set to NO (default) case sensitivity is turned off.

Regular Expression

Yes/No

No

No

USERE="YES"

If set to YES, specifies whether the data entered in the Text to look for parameter is a regular expression. If set to NO (default), Text to look for parameter contains literal text.

Advanced Tab

Property

Type

Required

Default

Markup

Description

Place matched text into variable

Text

No

(Empty)

FOUNDTEXTVARIABLE="varname"

Specifies the variable to receive the text that was found. This parameter is useful if a regular expression was used for the find text.

Index of matched text into variable

Text

No

(Empty)

INDEXVAR="varname"

Specifies the variable to receive the index position of the text that was found.