When you start a new project in Studio, a folder is created with your custom name to the selected location. Projects are saved in the
%USERPROFILE%\Documents\UiPath directory by default.
This folder includes:
Main.xamlfile is automatically created, which should hold your main workflow.
- all other automation .xaml files included in the project. Please note that these files have to be linked to the
Main.xamlthrough the Invoke Workflow File activity, because only the
Main.xamlfile is executed when you run a job.
.screenshotsfolder, if you are dealing with UI automation.
project.jsonfile that contains information about your automation project.
To create a basic project that asks for a user's name and then displays it on the screen, do the following:
- On the Start tab, click Process. The New Process window is displayed.
- In the Name field, leave the default project name or type a new one, such as Hello, and click Create. The Name and Location fields must be validated. A new project is saved with the chosen name on the hard drive.
- From the Activities panel, drag a Flowchart activity to the Designer panel.
- Add an Input Dialog activity from under System > Dialog.
When adding an activity in an empty project, Studio automatically adds a parent sequence containing the activity.
- Right-click the activity and click Set as Start Node. The activity is connected to the Start node.
- In the Workflow Designer tab, select Create Variable > Generic Value to create a variable in which to store the user’s name, called
name, for example.
- On the Properties panel, under the Input section, add a Label for the activity, such as "Type your name," and a Title, such as "Hello, world!."
In Studio, all strings have to be placed between quotation marks.
- Under the Output section, in the Result field, add the variable created at step 6.
- Add a Message Box activity to the Designer panel and connect it to the existing Input Dialog activity.
- Make sure that the Message Box activity is selected. The Properties panel is updated accordingly.
- Under the Input section, add a Caption such as "Hello," and in the Text field add a string and the previously created variable, such as “Hello” +
- The project should look as in the screenshot below.
- Click Run on the Design tab or press F5. The project is executed. The Hello World window is displayed, prompting you to input your name.
- Type your name in the field and press OK. The Hello window with the previously added name is displayed.
However, this project has a small flaw because, when prompted to add your name, you can leave the field blank. This also causes the Hello window to be empty.
To fix this problem and other similar ones, it is good practice to validate fields. You can do this with the Flow Decision or If activities that enable you to verify if a certain condition was met.
To solve the issue in the example project above, do the following:
- Select the arrow between the Input Dialog and the Message Box activities and press Delete. The arrow is deleted.
- Add a Flow Decision activity between the Input Dialog and the Message Box activities.
- Select the Flow Decision activity and, in the Properties panel, add a Condition to check if the variable name is empty, such as
name = "".
- Connect the Input Dialog activity to the Flow Decision. This means that after the user is prompted to add his or her name, the condition added at step 3 is going to be checked.
- Connect the True branch of the Flow Decision activity to the Input Dialog. This means that if the name field is empty, the user is going to be prompted to type his name in the Hello World window until the field is filled in. You just created your first loop. For more information, see the Control Flow chapter.
- Connect the Message Box activity to the False branch of the Flow Decision. This means that if the name field is not empty, the Hello window can be displayed with the string added by the user.
The final project should look as in the following screenshot.