Skip to main content

Browse For File

AutomatR.DefaultActivities.FileAndFolder.BrowseForFile

The "Browse For File" activity in AutomatR facilitates opening a dialog box at runtime, allowing users to browse and select a file for use within the project. This activity is particularly useful when you need user input to dynamically determine the file path during workflow execution.

Properties

NameDescription
Input
FilterEnter the filter based on which file selection will be done. For example, you can use filters like "*.*", "*.png", "*.txt", "*.docx", "XAML - *.xaml", etc. This property allows users to narrow down the file types visible in the dialog.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variable or argument containing the desired display name.
Optional
DelaySpecifies the amount of time (in seconds) to wait before executing the "Browse For File" activity. This can be useful for handling synchronization issues. Integer variable or argument containing the delay duration. Example: If the amount of time is 1000 milliseconds or 1 sec, i.e., 1.
Output
Select FileOutputs the full path of the selected file. String variable or argument to store the selected file path. If no file is selected or the dialog is canceled, an empty string is returned.

How to use:

  1. Drag and drop the "Browse For File" activity onto the workflow.
  2. Optionally, configure the delay and customize the display name.
  3. Specify the filter to narrow down the types of files visible in the dialog.
  4. Execute the workflow, and during runtime, the dialog will appear for the user to browse and select a file.

Example: Consider an example where the "Browse For File" activity is used to allow the user to select a CSV file with a specific filter:

Browse For File:
Display Name: "Select CSV File"
Filter: "CSV Files (*.csv)|*.csv|All files (*.*)|*.*"
Select File: selectedFilePath

In this example, the activity opens a dialog box with the specified filter, allowing the user to select a CSV file. The selected file path is stored in the string variable "selectedFilePath" for further use in the workflow. If the user cancels the dialog, the output variable will contain an empty string.