Thursday, February 1, 2018

How to work with java cells and tables---UiPath(RPA)

Starting with version 8, UiPath can work with Java tables in depth, scrapping data from rows or individual cells, iterating on columns and datatypes.

Task

For our example, we will use the table from Configure Java -> Java tab -> View as you can find that with a common "Windows address" (selector) on every machine running Java.
2015-07-14_1915.png

Steps to automate

  1. Open Configure Java;  go to Java tab; click View button
  2. You will see the list of installed java versions. You're free to add a new row for testing
  3. The robot will read the list of java versions existing, from the first column of the table
  4. This could be used for compatibility checks (of course, it's not the only way to check java versions)

Solution

  1. In the Activities panel, search for Find Children and drag it to the workflow / sequence
  2. Indicate which Java table you want to get information from. In our case it is the table of java versions from the settings. You can use UI Explorer or even easier, the Indicate on Screen button, to select the whole table element
  3. In the Properties view of the activity, add a filter to specify which column you are intersted in. In this case it is the Platformcolumn
     4. In the same Properties panel, set the output to be saved as a variable.

2015-07-15_1919.png
       5. In the Activities panel, find the For Each element and drag in the workflow / sequence
       6. Set the variable created at number 4. in the second field so you can cycle on it
       7. In the Activities panel, find the Get Text element and drag in the workflow / sequence
       8. In the properties view, set the Element as item and the Output -> Value as itemValue. This way you will extract the value from the UI cell.


You can view the example Java_tables workflow file 

How to work with Windows Credentials---UiPath(RPA)

In Windows, you can view and manage your network-based logon credentials (i.e., usernames and passwords) using Credential Manager. 

With UiPath, you can automate the process of creating, querying and deleting the credentials through some dedicated activities.

The atached workflow shows a basic example of how to create a credential, get its details and delete it. Below is a short description of the workflow logic and the activities used.

Workflow steps

 WindowsCredential_Logic
1. Using the Add Credential activity, we'll add a new Generic type credential - (we called it "CredentialTest"). Then we will set itsUsername and Password.

If we pause the workflow at this point and take a look into theWindows Credential manager, we'll see the credential we have just created.
2. Back to our workflow. We'll now get the credential's details - using Get Credential activity. We'll save the Username and Password in 2 diferent String variables (user and pass). 

We'll save the Result (which is Boolean type) in a variable (IsValidCredential) so we can use it later to check if the credential is valid or not.
3. If the credential is valid (IsValidCredential=True), we'll show its details in a Message box. Otherwise - an error message ("Credential not found!") will pop up.
WindowsCredentials_checkValidity
4. Finally, we delete the credential we added in the first step - using the Delete Credential activity
Note: The workflow is created with UiPath Studio 8.
Attachments:

How to work with a dynamic array---UiPath(RPA)

If you want to work with a collection that doesn't have a fixed number of elements, you can use a list instead of an array.

A List expands as you add new items to it. You can add new items to a list using the Add To Collection activity (you will find it under Programming->Collection category).

The attached ListExample workflow shows you how to declare, init, add and display items from a list.

Workflow Steps

DynamicArray_List_logic.png
1. Initializing the list:

items=new List(of string)

2. Get the input for the list, using an  InputDialog activity.

3. The new element (name) is added to the items collection (with Add To Collection activity).
DynamicArray_AddToCollection.png

4. The robot asks if you want to continue adding new elements (using Message Box activity). The response is saved in the answer variable.

5. A decision is taken (using a Flow Decision activity): if the answer to the previous step was Yes, the workflow will return to step 2. A No answer will move the workflow to the next sequence (step 6).
DynamicArray_Decision.png
6. The sequence will go through each item in the list.  It will pop up a window with the inputName of each element.

DynamicArray_DisplayData.png
Note: This workflow was created & tested with UiPath Studio 8.

Attachments:

UiPath Offline Activation(RPA)

This tutorial applies to versions 8 and 8.1. We strongly recommend updating to the latest stable version of UiPath Studio
In order to install UiPath on a machine where your network security software or a firewall prevents the access to our license validation website please follow the steps below.

Offline activation


Offline Activation for Studio Trial

1) When you first open UiPath Studio 8 there is a dialog asking if you want to Enter a key or Continue your trial
ContinueTrial
2) If you choose the second option, a registration dialog will open. Fill in your email and check Trial mode. 
Note: when activating the trial, no code should be used-the code field must be empty.
3) Click on the Offline button.
Offlineact
4) In the new dialog, save the generated data (Save to file button) to a txt file.
copyserverresponse
5) Send the file attached to email to another machine with no firewall/system security software that prevents the access to our online validation server. On the same machine, click on this Offline activation URL and copy the generated data from the txt file to the empty field in the page and click on Activate
activationcertificate
New data - the response from server - will be generated. Copy and save the generated response from server to a txt file and copy/send it via email back to the machine with the firewall restriction.
6) In the UiPath offline activation window click on Load from file button (please see the image at point 4 above), locate and open the file with the online generated response from server and click on the Activate button
Your 60-day trial should now be activated.

Offline Activation - Paid License

1) In the same dialog mentioned at point 1) above click on Enter key.
Alternatively double click on Activate.exe in C:\Program Files (x86)\UiPath Studio\v8\UiPath.
2) In the registration dialog fill in your email and copy the license code.
3) Further click on the Offline button
4) Follow the same indications described at steps 4 to 6 above to complete the offline activation process.

Publish and run a project package---UiPath(RPA)

There are four ways how you can run a process in UiPath Studio 8
  1. From UiPath Studio
  2. From UiPath Robot Agent
  3. From command line
  4. Through a REST command

UiPath 8 comes with a revamped deployment story that allows you to easily share your work with project mates by publishing them to a network drive. Robots see them, dependencies are resolved and starting them is no fuss.

In order to pack and publish a project follow the steps below

  1. Open UiPath 8
  2. Open the project that you want to share
  3. Go to the Setup tab and click Publish
4. You will see a message box with some information about your package. 

publish-project-uipath.png
5. All packages are stored locally in  %ProgramData%UiPath\Packages 
  
After publishing the package, you can run it on any computer that has UiPath 8. Just copy the package to the same location, %ProgramData%UiPath\Packages, on the target computer

How to run a project package

The execution is done through our agent software that tracks all available and running processes.
In order to have UiRobot Agent icon in the tray bar, when you install UiPathStudio.msi, you have to select the Automatically start client option.

1. Right click on UiRobot Agent icon

2. Go to Start and click on the package you want to execute.
publish-project-uipath-2.png

3. If the package doesn`t appear, go to Advanced and click Refresh packages (1).
4. To stop a running process, select the RUNNING tab (4) select the process that you want to stop and click on the red square. You will be prompted to confirm the cancelation.

Start Process From Command Line--UiPath(RPA)

There are four ways how you can run a process in UiPath Studio 8
  1. From UiPath Studio
  2. From UiPath Robot Agent
  3. From command line
  4. Through a REST command
 This article's scope is to define and exemplify how you can start a process from command line in UiPath Studio 8 or higher. If you are still working with UiPath Studio 7.5 and upgrading is not an option you can check this article or this one.
UiPath Studio 8 comes bundled with UiRobot.exe application that allows you to execute processes without requiring UiStudio.exe.
This is very useful when you want to start a process from command line, a shortcut, a schedule or from your own application.
Syntax
"C:\Program Files (x86)\UiPath Studio\UiRobot.exe" /file:"full path of your workflow"
By default the location of UiRobot is: C:\Program Files (x86)\UiPath Studio\UiRobot.exe
Example:
Without arguments:
"C:\Program Files (x86)\UiPath Studio\UiRobot.exe"
/file:"C:\Users\Iordache Razvan\Documents\UiPath\OpenExcelApp\Main.xaml"
With arguments:
"C:\Program Files (x86)\UiPath Studio\UiRobot.exe"
/file:"C:\Users\Iordache Razvan\Documents\UiPath\StartFromCmd\Main.xaml"
/input:"{'arg1':'hello'}"

Command line arguments 

/f: /file:  Mandatory      Absolute path to xaml file that defines the process you want to startRemarks     Make sure to quote the path if it contains spaces
/i: /input
     A dictionary of input parameters to the workflow, keyed by argument name
Remarks     The dictionary must be in JSON format and should contain only standard types
/executor
     If passed, the process will be executed in an interactive Windows session
Remarks
    This or /process argument must be specified.
     The Windows session in which the process will be executed is defined by the credential specified through /target argument. If /target is not passed then the process will execute in the current user session
/process
      If passed, the process will be executed in Windows session 0
Remarks
     This or /executor argument must be specified.
      This should be used only when starting a process from Windows Task Scheduler or if /target argument is passed. The user account that hosts the process must have Log on as batch job permission
 /target
      The name of the credential stored in Windows Credential Store
Remarks      In order to start a project in Windows Session 0 a username and its password are required. 
To avoid passing them directly into command line, you can store them in Windows Credential Store and pass only the credential name. If /executor is specified, then UiPath automatically logs in a Windows session for the user if one doesn't exists

/monitored
      If passed, UiPath monitors the user's interactive session
Remarks      Now processes can run even when the desktop is locked. To achieve this, UiPath must be instructed to monitor the Windows session in order to automatically unlock the screen and keep executing the process. Ex: Human user can start a lengthy process then lock the desktop and go to lunch.

How to: Schedule a Task----UiPath(RPA)

Note: This feature is deprecated. 
*this feature is not compatible with UiPath 8.0 or lower version 
*this feature is not compatible with the Community Edition

Schedule Task

Schedule Task is a feature in UiPath Studio that provides the ability to schedule a process to be executed at predefined time or after specified time intervals for current user. Check this article to schedule a task for a different user manually.

Where do I find Schedule Task?

In UiPath Studio, go to Setup tab and click Schedule Task.
After you click on Schedule Task the following window will be displayed.
  • In UiPath Schedule Task window we can schedule a task only using the default trigger: On a schedule (Time-based triggers include starting a task at a specific time of day or starting a task multiple times on a daily, weekly, or monthly schedule).
  • You can choose from the available settings: One time, Daily, Weekly or Monthly (Start date and hour)
  • Advanced settings

Now let's go over the available options in the next dialog:

  • Name: the name of the scheduled task (in our case the default is the Project / Process name). To schedule the same process more than once you have to change the name (e.g. "UiPath Task Scheduler" and "UiPath Task Scheduler 2").
  • Location: is the local folder in Windows Task Scheduler (e.g. C:\Windows\System32\Tasks\UiPath each task created with UiPath are saved in this folder)
  • Run only when user is logged on: the task will be executed in the Windows session of the currently logged on user.
  • Run whether user is logged on or not:  if the account is not logged on when the corresponding task is triggered, the service will use the saved credentials to run as the specified account in Windows session 0. You may be prompted to supply the credentials of the account when saving the task. UiPath doesn't store your username and password when are requested to create a new task. All these information are stored in Windows Credential Store. Make sure the Logon as batch job policy is set for the user.

Session 0 Isolation Explained

Each user that logs on to Windows is placed in a separate session. During startup, Session 0 is created and additional sessions are created as needed. Services always run in Session 0. For more details about this please check the following link.
Session 0 doesn't have a graphic interface
The easiest way to make your task interact with the UI is to split your project / process into small workflows. 
Workflows that interact with UI must be started from the main workflow through Launch Workflow Interactive activity (this activity automatically logs in an interactive Windows session if necessary)
Eg. 
The third activity will execute but you won't be able to see the message box. This is why it should be added into StartMsgBoxInt workflow.
As a backup solution you could change the commands line arguments of UiRobot. To do this go to Windows Task Scheduler -> UiPath Folder->Right click on your task and then select Properties -> Actions -> Edit . In Edit window change the word "process" with "executor".
 Now your task will be executed in the user account specified when prompted for credentials.
 NOTE: If you are scheduling the task in a Virtual Machine, make sure to add "/cc /preferConsole" parameters manually in the action.