Dialog - Open file |
Declaration
<AMSHOWDIALOG ACTIVITY="open" WINDOWTITLE="text" RESULTVARIABLE="text" FILTER="text" DEFAULTFOLDER="text" ONCANCEL="text (options)" /> |
Description
Displays a common dialog box that allows a user to specify a file name to open. The file selected is stored in a variable for use in subsequent steps. Execution is paused while the user makes a selection.
Practical Usage
Commonly used to allow a user to manually select a file to open during task execution.
Parameters
General
Property |
Type |
Required |
Default |
Markup |
Description |
Title of the message box |
Text |
No |
(Empty) |
TITLE="Browse for file" |
The title that the dialog box should display. This should provide the user proper information as to what file to open (i.e. "Please Browse for the target spreadsheet"). |
Populate variable with result |
Text |
Yes |
(Empty) |
RESULTVARIABLE="varname" |
The name of an existing variable that should be populated with the file or folder selected by the user. |
Advanced
Property |
Type |
Required |
Default |
Markup |
Description |
Filter |
Text (options) |
No |
All files (*.*)|*.* |
FILTER="All files (*.*)|*.*" |
The file filters for the dialog box that appears. Filters represent the masks that are listed in the File Type drop-down. For example, to include only text files, enter *.txt. |
Initial Folder |
Text |
No |
(Empty) |
DEFAULTFOLDER="c:\foldername\" |
The starting folder that the user sees when the dialog box appears. |
On Cancel |
Text |
No |
Stop |
ONCANCEL="fail" |
Specifies how this action will react if the user presses the Cancel button. The available options are:
|
Example
- The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
- Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.
Description
This sample task demonstrates use of the Open File activity (step 2) by prompting the user to select a file to open. A separate Message Box appears in step 3 displaying the path and file name of the file selected.
<AMVARIABLE NAME="theFile"></AMVARIABLE>
<AMSHOWDIALOG ACTIVITY="open" WINDOWTITLE="Please select file to open" RESULTVARIABLE="theFile" DEFAULTFOLDER="C:\" />
<AMSHOWDIALOG WINDOWTITLE="SELECTED FILE" MODAL="NO">The file selected is %theFile%</AMSHOWDIALOG>