Opening an Application in UiPath

Automating an application that does not have any particular activity or packages to open an application. For example, there is an N number of Microsoft applications that do not have any kind of packages are available. Let us see how to automate this kind of application.

There is a package called UiPath.Core.Activities.OpenApplication which contains some activities such as:

  • Open Application
  • Close Application
  • Start-Process
  • Get-Process
  • Kill Process
  • Process End Trigger
  • Process Start Trigger

The Properties of UiPath.Core.Activities.OpenApplication is as follow:

Input
  • Selector : Text property used to find a particular UI element when the activity is executed. It is an XML fragment specifying attributes of the GUI element you are looking for and some of its parents.
  • Filename : The full file path where you can find the executable file of the application you want to open. For example, if you're going to open an Excel, the path should look like C:Program FilesMicrosoft Office ootOffice16EXCEL.EXE.
  • Arguments : The parameters that can be passed to the application at startup. You can use this property to open a specific file with the application you want to open. For example, if you're going to open a specific Excel workbook, you can add its full path in this property field. The path should look like C:UserscurrentuserDocumentsSample.xlsx
If the file you want to open contains spaces in its name, you have to write the path between two sets of quotation marks. For example, if the file is named Sample file.xlsx, the path should look like "C:Userscurrent userDocumentsSample file.xlsx."
Common
  • DisplayName : The display name of the activity.
  • TimeoutMS : Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown. The default value is 30000 milliseconds (30 seconds).
  • ContinueOnError : Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (True, False). The default value is False. As a result, if the field is blank, and an error is thrown, the execution of the project stops. If the value is set to True, the execution of the project continues regardless of any error.
If this activity is included in Try Catch and the value of the ContinueOnError property is True, no error is caught when the project is executed.
Output
  • ApplicationWindow : The found active window. This field supports only Window variables.
Options
  • WorkingDirectory : Path of the current working directory. This field accepts only string variables.
Misc
  • Private : If selected, the values of variables and arguments are no longer logged at the Verbose level.

Example.1:

The following example demonstrates the open application automation

Create anew process called Application_Automation_Example

application-automation-process-rpa-uipath

Once the process opened in the UiPath Studio, search for application under activities pane, you will find some of the activities related to the application.

  • Add Sequence inside the Designer pane
  • Add Open application activity inside the Sequence, and Open application will ask you to indicate the application on the screen. Click on Indicate window on the screen, Here I want to open the publisher, open the publisher on your system window, and then indicate it to the UiPath.
    open-publisher-application-rpa-ipath
  • So you want to open an application 'MSPUB.EXE publisher'
  • Next, add Click activity inside the Sequence, click on the Indicate element inside the window (Here I want to open the already prepared document which is samplepub_document.pub) and then select the samplepub_document.pub file to open.
  • Next, add one more click activity inside the Sequence and select the content inside the samplepubdocument.pub. For that, I have an option called F2 pause , or else you can open the Samplepubdocument.pub file and then indicate element inside the window.
    sequence-publisher-rpa-auipath
  • Next, I want to click on File in the samplepubdocument.pub, add Click activity inside the Sequence, and indicate element on the window.
    click-on-file-on-sample-file-rpa-uipath
  • Add Click Activity inside the Sequence and then indicate Save as an element on the window.
    indicate-save-as-rpa-uipath
  • Add Click Activity and then indicate Documents(Folder where you are going to dave the file)element on the window.
    indicate-documents-rpa-uipath
  • As soon as you select the Documents folder, Save as wizard will occur on the window, place the cursor on Save as Type.
    save-as-drop-down-rpa-uipath
  • In the UiPath, add one more Click Activity and then indicate the Save as type as Publisher File(*.pub) from the Save as a wizard.
    indicate-publisher-file-rpa-uipath
  • Place the cursor on Publish Files on the Save as a wizard and then press Ctrl+F2Click on Publish Files in the pause time and select PDF from the drop-down list.
    select-pdf-from-drop-down-rpa-uipath
  • Add Click Activity in the Sequence and then indicate PDF on the window
    indicate-pdf-element-rpa-uipath
  • Place the cursor on the Save button on the Save As wizard and then add Click Activity in the Sequence and then show Save element on a window.
    save-button-on-save-as-wizard-rpa-uipath
    save-button-on-uipath-rpa

Now save and run the Sequence. The Samplepubdocument.pub will be extracted to PDF format.
the-output-pdf-file-rpa-uipath

RPA UiPath Studio User Interface

Close Application in UiPath

The Close Application closes the application corresponding to a specified UI element.
The Properties of close application are:

Input
  • Target.Selector : Text property used to find a particular UI element when the activity is executed. It is an XML fragment specifying attributes of the GUI element you are looking for and of some of its parents.
  • Target.TimeoutMS : Specifies the amount of time (in milliseconds) to wait for the activity to run before the SelectorNotFoundException error is thrown. The default value is 30000 milliseconds (30 seconds).
Target.WaitForReady

Before performing the actions, wait for the target to become ready. The following options are available:

  • None : Does not wait for anything except the target UI element to exist before executing the action. For example, you can use this option if you want to retrieve just text from a web page or click an appropriate button, without having to wait for all UI elements to load. Note that this may have unwanted consequences if the button relies on elements that are not yet loaded, such as scripts.
  • Interactive/Complete : Waits for all of the UI elements in the target app to exist before actually executing the action.

To assess if an application is in the Interactive or Complete state, the following tags are verified :

  • Desktop applications : A wm_null message is sent to check the existence of the <wnd>, <ctrl>, <java>, or <uia> tags. If they exist, the activity is executed.
  • Web applications: a. Internet Explorer: The <webctrl> tag is used to check if the Ready state of the HTML document is set to Complete. Additionally, the Busy state has to be set to "False." b. Others: The <webctrl> tag is used to check if the Ready state of the HTML document is Complete.
  • SAP applications : First, the presence of the <wnd> tag verified, after which an SAP specific API is used to detect if the session is busy or not.
  • Target.Element : Use the UiElement variable returned by another activity. This property cannot be used alongside the Selector property. This field supports only UiElement variables.
  • Target.ClippingRegion : Defines the clipping rectangle, in pixels, relative to the UiElement, in the following directions: left, top, right, bottom. It supports both positive and negative numbers.
Common properties
  • DisplayName : The display name of the activity.
  • ContinueOnError : Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (True, False). The default value is False. As a result, if the field is blank, and an error is thrown, the execution of the project stops. If the value is set to True, the execution of the project continues regardless of any error.

If this activity is included in Try Catch and the value of the ContinueOnError property is True, no error is caught when the project is executed.

Example.1:

The following example demonstrates the Close application

Open the Application_Automation_Example and add the close application activity inside the Sequence, as shown below. Here we want to close the publisher application, which was opened.

Open the publisher's application, and in the UiPath, click on the indicated element on the window and then indicate the close button on the window.
add-close-application-activity-into-sequence-rpa-uipath

Get-Process, Kill Process, and Start Process activities in UiPath

Get-Process activity :

Gets the list of all the running processes on the current machine.

The properties of Get-Process are as follow :

Process : A collection of Process objects representing the running processes on the current machine.

  • DisplayName : The display name of the activity.
  • ContinueOnError : Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (True, False).
    The default value is False. As a result, if the field is blank, and an error is thrown, the execution of the project stops. If the value is set to True, the execution of the project continues regardless of any error.
  • Private: If selected, the values of variables and arguments are no longer logged at the Verbose level.

Kill Process activity:

The kill process activity terminates the specified process.

The properties of the Kill Process activity are :

Target:
  • ProcessName : The name of the process to be closed, written in the following format: "process". This field supports strings and string variables.
  • Process : A Process type object describing the process to be closed.
  • ContinueOnError: Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (True, False).
    The default value is False. As a result, if the field is blank, and an error is thrown, the execution of the project stops. If the value is set to True, the execution of the project continues regardless of any error.
  • Private : If selected, the values of variables and arguments are no longer logged at the Verbose level.

Start-Process activity:

Launches a specified application and can optionally pass a list of arguments to it.

The properties of Start-Process activity are :

Input:
  • Filename : The full file path where you can find the executable file of the application to be opened.
  • Arguments : The parameters that can be passed to the application at startup.
  • WorkingDirectory : Path of the current working directory. This field accepts only string variables.
Example.1:

The following example demonstrates the Get-Process and Start Process.

Create a new sequence called Application_Activities_Example


application-activities-example-sequence-rpa-uipat

Add Get-Process activity inside the Sequence and then create a new variable called Process_List_Variable as it contains a list of strings in the processes under the Output property in the property pane.
create-process-list-varibale-rpa-uipath

To display a list of string, I am using For Each activity, add the For each activity inside the Sequence and write the condition for the same.
add-for-each-activity-rpa-uipath

Next, add Write Line activity inside the Sequence and write the text as an item.ToString
item-string-rpa-uipath

Now, save and run the Sequence; in the output pane, you will find all the running process list.

output-of-get-process-rpa-uipath

Go back to the Sequence and then add Start-Process activity inside the Sequence and then click on the three horizontal dots beside the box and then select the path of the program which you want to start. Here I want to open a notepad application.
select-note-application-to-start-rpa-uipath

Now, save and run the Sequence, the notepad application will open.
out-put-of-start-process-rpa-uipath

0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions