Get Subtext Action Icon

Get Sub Text

Declaration

<AMTEXTGETSUBTEXT TEXT="text" STARTPOSITION="number" LENGTH="number" RESULTVARIABLE="text(variable name)" />

See Also

Convert Case | Find Text | Format Date/Time | Get Subtext | Insert Text | Pad Text | Replace Text | Trim Text

Description

Retrieves a part of the text specified and places the result in a variable.

Practical Usage

Generally used as a text manipulation tool to retrieve specific text from a text value.

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Original Text

Text

Yes

(Empty)

 

TEXT="My name is Joe"

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

Starting Position

Number

Yes

(Empty)

POSITION="24"

The position in the text in which retrieval should begin.

Length of text to get

Number

No

(Empty)

LENGTH="3"

The number of characters to retrieve.

Populate variable with result

Text

Yes

(Empty)

RESULTVARIABLE="varname"

The variable to be populated with the new value.

 

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: This sample task uses a Get Subtext action to get part of the text populated into a variable and displays the retrieved subtext in a message box.

 

<AMVARIABLE NAME="theVar">Hello</AMVARIABLE>

<AMTEXTGETSUBTEXT TEXT="%theVar%" STARTPOSITION="1" LENGTH="2" RESULTVARIABLE="theVar" />

<AMSHOWDIALOG MESSAGE="The sub text retrieved was %theVar%" />

 

↑ [Top of Page]