Text - Format path

Declaration

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

Related Topics   

Description

Formats the specified file path in order 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.

Parameters

General

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 (i.e. %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

Error Causes

On Error

Example

NOTE: 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>