"SelectFile" activity

Created by akaBot Support, Modified on Wed, 25 Dec, 2024 at 4:51 PM by akaBot Support

This activity displays a File Selection Dialog Box and retrieves the file path selected by the user.


TABLE OF CONTENTS

  1. Activity program name
  2. Description
  3. Properties
  4. How to use


1. Activity program name

RCA.Activities.Core.SelectFile

2. Description

File Selection Activity

  • Studio Version ~2.0.2.0
    Quick Access: Toolbox > Core > File Selection

  • Studio Version 2.0.3.0~
    Quick Access: Toolbox > Core > Dialog > File Selection

This activity displays the File Selection dialog box and retrieves the path of the selected file.
If no file is selected and the Cancel button is clicked, or the dialog box is closed using the × button, a System.OperationCanceledException will be thrown.

Notes:

  • Verified on Cobot Studio version: 2.2.0.5
  • Terminology and behavior may vary slightly depending on the version.


3. Properties


Property itemProperty nameInput field
Description
Misc


Public
Checkbox

Variables and arguments within the activity are written to the log file and pushed to the Center. (For more details, refer to "About the 'Public' Property").

Display name
AnyString

Reflected in the activity name in the Designer Panel.

Output
Selected file
Enter value (String Type)

Stores the full path of the selected file.

Input
Filter
Enter value (String Type)

Filters the files displayed in the dialog box. Refer to "About Filters" for more details.


4. How to use

Drag and drop the "File Selection" activity from Toolbox > Core into the Designer panel.


This setting defines the files displayed in the dialog box. Since we want to display all files, use the default filter "All Files (*.*)|*.*" in the Properties Panel under Input > Filter.

For more details on the filter property, refer to "About Filters".



Specify a variable to store the selected file path. In the Properties Panel, under Output > Selected File, assign a String variable (in this case, "filePath").

If the variable hasn't been created yet, create a String variable and assign it. You can create a variable by using "Create from Property", which will create the variable as a String type.

For more details on creating variables, refer to "Creating Variables".



To display the selected file path, drag and drop the "Message Box" activity from Toolbox > Core into the Designer panel.

In the Message Box activity, set the Text property to "filePath" to display the selected file path.



Click "Home > Run" or press the F5 key to execute the workflow.


Execution Result:

1. The "File Selection" dialog box is displayed.



2. Select a file.


3. The selected file path is displayed in the message box.



About Filters
By setting a filter, you can filter the dialog box by file type.



The syntax is [File Description]|[File Type (Extension)]. Let's see how the default filter "All Files (.)|." is reflected in the dialog box.

All Files (.)|.
It will be displayed in the "File Type" section of the dialog box.



All Files (.)|.
Files in the dialog box will be filtered and displayed. "*.*" means "All Files."



Here is an example of a filter. It includes the filter and the corresponding dialog box display.
Note: The folder used in the "All Files" example is filtered and displayed in the dialog box.

Filtering Excel Files
Set the file type to "*.xlsx" and specify a description indicating Excel files.

Excel Workbook (.xlsx)|.xlsx


Filtering Multiple File Types
Specify multiple file types by separating them with a semicolon (;).

Image Files (.png, .jpg, .bmp, .gif)|.png;.jpg;.bmp;.gif


To Display Multiple File Types in the File Type Dropdown List Box
Use a pipeline (|) to separate multiple file type entries. For example, if you want to include "PDF Files" and "All Files" as options:

Adobe PDF Files (.pdf)|.pdf|All Files (.)|.

  • Screenshot of the dialog box display when opened:
    (Add the corresponding screenshot or illustration showing the dropdown options).



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article