Common Dialogs Action

Declaration

<AMCOMMONDIALOG ACTION="text [options]" TITLE="text" RESULTVARIABLE="text" DEFAULTFOLDER="text" FILTER="text">

See Also

Common Dialogs Action-Setting Properties, Choice Action, Input Box Action, Message Box Action,

Description

Displays the standard Windows Open, Save As, or Browse for Folder dialogs. The file or folder selected is stored in a variable for use in subsequent steps.

Practical Usage

Commonly used to allow a user to select a file or folder or save a file to a particular location during task execution.

Parameters

General Tab

Action (dialog type)

Text, required
MARKUP: ACTION="save"

Specifies what type of dialog to display.

The available options are:

 

Title

Text, optional Default (blank)
MARKUP: TITLE="Please Browse for the Target Spreadsheet"

Specifies the title of the common dialog box (i.e. 'Please Browse for the Target Spreadsheet')

 

Populate variable with result

text, Optional - Default (none)
MARKUP: RESULTVARIABLE="varname"

Specifies the name of an already created variable that should be populated with the text that the user has input as a response to the question.

 

Advanced Tab

Filter

Text, optional Default (blank)
MARKUP: FILTER="All files (*.*)|*.*"

Specifies the file filters for the Open File and Save As dialog boxes. Filters represent the masks that are listed in the "File Type" dropdown. For example, to include only text files, enter *.txt).

 

Initial Folder

Text, optional Default (blank)
MARKUP: DEFAULTFOLDER="c:\foldername\"

Specifies the starting folder for the browse or save as dialog (this is not supported in the Folder dialog).

 

On Cancel

Text, required
MARKUP: ONCANCEL="fail"

Specifies how the action will react if the user presses the Cancel button.

The available options are:

 

Notes

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

 

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMVARIABLE NAME="theVar"></AMVARIABLE>

<AMCOMMONDIALOG WINDOWTITLE="Please select file " ONCANCEL="fail" RESULTVARIABLE="theVar" DEFAULTFOLDER="C:\" />

<AMMESSAGEBOX>You selected %theVar%</AMMESSAGEBOX>