Insert Text Action Icon

Insert Text

Declaration

<AMTEXTINSERT ACTION="text(options)" INSERTTEXT="text" TARGETTEXT="text" RESULTVARIABLE="text(variable name)" />

See Also

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

Description

Inserts characters into the specified text and places the result in a variable.

Practical Usage

Mainly used as a text manipulation tool to insert new text into an already existing text value.

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Text to insert into

Text

Yes

(Empty)

 

TEXT="My name is Joe"

The target text to insert the new text into. As with every text parameter, if the data you wish to write 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%).

Action to Take

Text (options)

No

insert_beginning

ACTION="insert_end"

Indicates the location in the target text in which characters should be inserted into. The available options are:

  • Insert at beginning: The text is inserted at the beginning of the target text.

  • Insert at end: The text is inserted at the end of the target text.

  • Insert at position: The text is inserted at a specific position of the target text.

Position to insert text

Number

No

(Empty)

LENGTH="3"

The position in the text to perform the insert. This parameter is available only if the Action to take parameter is set to Insert at position.

Characters to be inserted

Text

Yes

(Empty)

INSERTTEXT="Hello"

The characters that should be inserted.

Populate Variable with Result

Text

Yes

(Empty)

RESULTVARIABLE="varname"

The name of the variable to receive the new value after character insertion is performed.

 

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 displays a message box showing the value of a variable before and after an Insert Text action is used.

 

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

<AMSHOWDIALOG MESSAGE="The value before character insertion is '%theTargetText%'." />

<AMTEXTINSERT ACTION="insert_end" INSERTTEXT=" World" TARGETTEXT="%theTargetText%" RESULTVARIABLE="theTargetText" />

<AMSHOWDIALOG MESSAGE="The new value after character insertion is '%theTargetText%'." />

 

↑ [Top of Page]