Text - Format Path

Declaration

<AMTEXT ACTIVITY="path" PATH="text" PATHACTION="text (options)" 
EXTENSION="text" RESULTVARIABLE="text" />

Description: Formats the specified file path to reveal the file name, file extension or directory and populates a variable with the result. Can also modify the extension of a specific file. This activity supports fully qualified and relative paths.

Practical Usage

Used as a text manipulation tool to format specific parts of a file path.

General Parameters

Property

Type

Required

Default

Markup

Description

Path

Text

Yes

(Empty)

PATH="c:\temp\file.txt"

The file path to format. 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 (e.g., %VarName%).

Action

Text (options)

Yes

(Empty)

  1. PATHACTION="file"

  2. PATHACTION="directory"

  3. PATHACTION="extension"

  4. PATHACTION="change_extension"

 

The type of action to perform on the file path. The available options are:

  • Get file name (default) - Format the path to reveal only the file name.

  • Get directory - Format the path to reveal only the directory (without the file name).

  • Get file extension - Format the path to reveal only the file extension.

  • Change file extension to - Changes the current extension of the file.

Extension

Text

Yes if Action is  set to Change extension

(Empty)

EXTENSION=".png"

The file extension to modify. This parameter is available only if the Action parameter is set to Change file extension to.

Populate variable with result

Text

Yes

(Empty)

RESULTVARIABLE="varname"

The name of an existing variable to be populated with the new value.

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: This sample task will format a specific path to reveal only the file name.

<AMVARIABLE NAME="thePath" 
VALUE="C:\temp\sample_images\AM_image.jpg" />
<AMSHOWDIALOG WINDOWTITLE="The path to format">This sample task 
will format the following path to reveal only the file name: 
%thePath%</AMSHOWDIALOG>
<AMTEXT ACTIVITY="path" PATH="%thePath%" RESULTVARIABLE="thePath" />
<AMSHOWDIALOG WINDOWTITLE="The path formatted">The file name:
%thePath%</AMSHOWDIALOG>