Dialog - Open File

Declaration

<AMSHOWDIALOG ACTIVITY="open" WINDOWTITLE="text" RESULTVARIABLE="text" FILTER="text" DEFAULTFOLDER="text" ONCANCEL="text (options)" />

See Also

Dialog - Browse for Folder | Dialog - Input Box | Dialog - Message Box | Dialog - Open File |  Dialog - Save File | Dialog - Selection Box | Close Window | Focus Window | Hide Window | Maximize Window | Minimize Window | Move Window | Resize Window | Restore Window | Unhide Window

Description

Displays a standard Windows Explorer dialog box allowing the user to select a specific file. 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 Properties

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 (i.e. "Please Browse for the target spreadsheet").

Populate variable with result

Text

Yes

(Empty)

RESULTVARIABLE="varname"

The name of an already created variable that should be populated with the file or folder selected by the user.

Advanced Properties

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

(Empty)

ONCANCEL="fail"

Specifies how this action will react if the user presses the Cancel button. The available options are:

  • Continue - The task will continue to the next step.

  • Stop - The task will stop. No error is generated.

  • Fail - The task fail with an error.  

 

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

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

 

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>

 

↑ [Return to Top]