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 (for example, %VarName%).
Action Text (options) Yes (Empty)
  • PATHACTION="file"
  • PATHACTION="directory"
  • PATHACTION="extension"
  • 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).
  • Change file extension to - Changes the current extension of the file.
  • Get file extension - Format the path to reveal only the file extension.
Extension Text Yes, if Action is  set to Change file extension to (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:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

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

Copy
<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>