Pad Text Action Icon

Pad Text

Declaration

<AMTEXTPAD ACTION="pad_both" TEXT="text" PADDINGCHAR="text" 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

Adds a single character to the beginning and/or end of the specified text and places the result in a variable.

Practical Usage

Text manipulation.

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Text to pad

Text

Yes

(Empty)

 

TEXT="My Name is Joe"

The target text to be padded.

Pad

Text (options)

No

pad_beginning

ACTION="pad_end"

The location that the padding should be applied. The available options are:

  • Beginning (default): Padding will be applied to the beginning of the text.

  • End: Padding will be applied to the end of the text.

  • Beginning and End: Padding will be applied to the beginning and end of the text.

Character to pad with

Text

Yes

(Empty)

PADDINGCHAR=" "

The character to use as the padding item.  

Padding type

Text (options)

No

length

PADTYPE="amount"

The padding type that should be applied. The available options are:

  • Until text is specific length (default): The padding will be repeated until the text reaches a certain length.

  • A specified number of times: The padding will be repeated x number of times regardless of the text length.

Length of text

Number

Yes if Padding Type is length

(Empty)

LENGTH="10"

The total length of the text in which padding should end. This parameter is available only if the Padding Type parameter is set to Until text is specific length.

Number of times to add

Number

Yes if Padding Type is amount

(Empty)

AMOUNT="5"

The total amount of times that the padding should be repeated. This parameter is available only if the Padding Type parameter is set to A specified number of times.

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.

 

Example 1

 

<AMVARIABLE NAME="varname">hello</AMVARIABLE>

<AMTEXTPAD ACTION="pad_end" TEXT="Hello" PADDINGCHAR="_" LENGTH="10" RESULTVARIABLE="varname" />

<AMMESSAGEBOX>%varname%</AMMESSAGEBOX>

 

 

Example 2

 

<AMMESSAGEBOX>%theNewText%</AMMESSAGEBOX>

<AMVARIABLE NAME="theText">test.txt</AMVARIABLE>

<AMVARIABLE NAME="theNewText"></AMVARIABLE>

<AMREPLACE TEXT="%theText%" FIND=".txt" REPLACE=".done" RESULTVARIABLE="theNewText" />

<AMMESSAGEBOX>%theNewText%</AMMESSAGEBOX>

 

↑ [Top of Page]