A repository of notes about Performance Testing, Automation, RPA, and Web Design.

  • UiPath

    Show all posts related to UiPath

  • Windows

    Show all posts related to Windows

  • Web Design

    Show all posts related to Web Design

[Windows] How to open multiple apps at once using the run dialog

Basically what I want to do is launch several applications in one command. There are many options to do this. You can create a batch file that opens several applications then run it, or you can simply type a command from the run dialog that launches the apps you want.

I choose to do the latter because it's easier for me.

Here's the syntax. Suppose I want to launch Notepad, Calculator, and Task Manager in one go:


cmd /c start notepad & start calculator & start taskmgr
  • This command basically tells the computer to execute the program followed by the start command. 
  • The & allows you add multiple commands.
  • Remember to use the program's process name in order to launch them properly
Share:

[UIPath] Error: Programmatic access to Visual Basic Project is not trusted

If you encounter this error on UIPath saying "Programmatic access to Visual Basic Project is not trusted", it could mean that your MS Excel's Macro Trust Settings is disabled.


By default, Excel blocks any programmatic access to the application unless the user permits it. You may be invoking an external VBA macro file in your UIPath workflow that's causing this error. To enable trust settings, simply do the following:

  1. Open a blank workbook on MS Excel
  2. Got to File >> Options
  3. Click on Trust Center >> Trust Center Settings


  4. Click on Macro Settings >> Check ‘Trust Access to the VBA project object model’ (under Developer Macro Settings)


  5. Click OK to exit Trust Center window >> Then Click OK again to exit Excel Options window
Let me know if it worked! :)
Share:

[UIPath] Helpful VB expressions for date, string, and array/collection values

Here are my most commonly used VB expressions for handling date, string, and array/collection values. Will add more to these as I go along. UIPath activities essentially use VB.NET expressions so their API browser is extremely helpful in learning functions and syntax. .NET API Browser:
https://docs.microsoft.com/en-us/dotnet/api/?view=netframework-4.7.2

String

How to print new line on Message Box
Use vbCrLf
ie. "Hello" + vbCrLf + "World"

How to concatenate string and variable values
Use + operator
ie. "My name is " + var_name

How to split string value based on delimiter
Use the Split method to split a line of text into array values based on a delimiter
ie. Split("apple~bear~cat~dog","~") will return an array with 4 values.

To access them, you can loop through the array or for smaller and more defined formats you can simply retrieve the value based on its index number.

Split("apple~bear~cat~dog","~")(0) returns "apple"
Split("apple~bear~cat~dog","~")(1) returns "bear"
Split("apple~bear~cat~dog","~")(2) returns "cat"
Split("apple~bear~cat~dog","~")(3) returns "dog"

How to combine all array values into a string
Use the Join method
ie. var stringArray = {"Apple","Bear","Cat"}
String.Join("/",stringArray) will result to "Apple/Bear/Cat"

How to trim leading and trailing spaces from a text
Use the Trim method
ie. Trim("     This is a sentence    with lots of spaces.    ")
Note that Trim() removes only the spaces at the start and end, not the inside of the string.

How to replace certain characters in a string
Use the Replace method
ie. "apple~bear~cat~dog".Replace("~","!")
Replaces all instances of ~ with !, so that leaves me with "apple!bear!cat!dog"

Date/Time

How to format date value
Use ToString method
ie. Now.Date.ToString("MMMM yyyy")
will give to the current date displayed in this format: January 2018

For other custom date and time formats:
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

How to convert string value to DateTime format
Use Convert class
ie. Convert.ToDateTime("January 31, 2019")

For more details about the Convert class:

How to get first day of the month
Use the Date function and just format the day value as 1
ie. Now.Date.ToString("MMMM 1, yyyy")
will get you January 1, 2019

How to get last day of the month
Use AddMonths method to get the first day of the next month, then subtract 1 day using the AddDays method. 
ie. Convert.ToDateTime(Now.Date.ToString("MMMM 1, yyyy")).AddMonths(1).AddDays(-1).ToString("MMMM d, yyyy")
Will give you January 31, 2019 (relative to date today)

Note that you have to convert the first day of the month back to DateTime in order for the AddDays and AddMonths method to work.

Array/Collections

How to get all files in a folder
Use Directory.GetFiles method
ie. Directory.GetFiles("C:\Data\UIPath","*.*",SearchOption.AllDirectories) 
returns a String array of all the files inside the UIPath\ folder, including its subfolders, that matches the search pattern indicated in the 2nd argument.

"*.*" basically takes all types of files. "*.pdf " will get only files with the .pdf extension.
SearchOption.AllDirectories searches even the subdirectories under UIpath\

Because this method returns a String array, use a For loop to run through the collection.

For more info:
Share:

[UIPath] How to use Filter in Get Outlook Mail Messages Activity

The Filter property in Get Outlook Mail Messages allows you to set a filter for the messages to be retrieved from the specified mail folder.


Note that the Filter argument is for STRICT filters only. Meaning, wildcards and regex matches won't work. For example:

This filter retrieves messages received on the current month:
[ReceivedTime] >=' + Now.ToString("MM/01/yyyy") + "' AND [ReceivedTime] < '" + Now.AddMonths(1).ToString("MM/01/yyyy")+ "'"

This filter retrieves messages with the EXACT subject line 'Manila Downtime Advisory'
[Subject]='Manila Downtime Advisory'

Click here for more filter arguments you can use.
Share:

[UIPath] Extract value inside parenthesis using regex patterns

I have a scenario here where I wanted to extract a value inside a parentheses. Using the Matches activity in UIPath, I'm able to do just that. Here's how: Look for Matches activity and drop it on your workspace. I added a Message Box below to see the output.


On the Properties panel, fill in the Input (string) and Pattern (regex). For the Result, create a new variable with data type IEnumerable<Match>. This will hold all the matches found in your string input.


Input: "I want to extract (value) here"
Pattern: "\((.*?)\)"
Result: RegexMatch (var with DataType IEnumerable<Match>)

Since I know I'm only looking for 1 match, I don't need to loop through the result array. I can simply access the first value by checking index 0, hence RegexMatch(0).ToString in the Message Box.

This will output the following:


Knowledge of regular expressions is needed here, thankfully there's Google! If you want to validate your regex before running the activity, you can use this link: http://regexstorm.net/tester
Share:

How to open TCP port 5814 on your server machine

HP software uses port 5814 to access the server machine so in case you're having trouble communicating to your license server, you may need to make this port accessible. To allow inbound access to this port, you need to set up a rule allowing access to it on your Windows Firewall settings.


To do this:
  • Start >> Windows Firewall with Advanced Security - a dialog will open with the list of firewall rules.
  • On the left pane, click on Inbound Rules. Then click on New Rule under the Actions panel. A wizard dialog will appear. 
  • Input the following: 
    • Rule Type - Port
    • Protocol - TCP
    • Specific local ports: 5814
    • Action - Allow the connection
    • Profile - check all (Domain, Private, Public)
    • Name - (any)

After finishing, you'll be able to see the rule on the list.

To check if the port is up and running, you can run telnet on command line on a client machine, here's the syntax:

telnet [IP address or machine name] [port]
Ex: telnet 123.456.7.8 5814


A blank screen will follow if the connection was successful.


If telnet is an unrecognized command, enable it by doing the following:
  • Right-click Start button
  • Open Programs and Features
  • Click Turn Windows features on or off
  • Scroll down and check Telnet Client
Share:

Updating HP UFT for Windows 10

After our machines got updated to Windows 10, we realized that we couldn't connect to our concurrent license server anymore using UFT 11.51. I sought help from Microfocus (who's handling all UFT related issues) and here's what we did to resolve the issue:
1. Install HP UFT 12.51 or above on your Windows 10 machine...

... as these are the versions supported on Windows 10. Assuming you have an existing concurrent license, you can access your software entitlements by logging in on this link.



Once you're in, navigate to your entitlements and download the installer for your desired UFT version. We used 12.51. Don't forget to uninstall any existing old versions of UFT to avoid conflict.

2. Install HPE Autopass License Server on your server machine

For UFT versions 12.50 and beyond, you need to install HPE Autopass License Server. We used to have Sentinel RMS License Manager to host our UFT license, but this only works for older versions of UFT. So yeah, no choice but to install a new server application.

Download the installer from the link below, you may be prompted to create a Micro Focus account:
https://marketplace.microfocus.com/itom/content/autopass-license-server

Once it's installed, it should be up and running on your local services.


Next we need to get a new license key installed on Autopass. Navigate to the Autopass admin portal by opening this link on your browser: https://123.456.7.8:5814/autopass (of course, replace the IP with your server IP or machine name). You'll be required to create new login credentials when it's your first time. I didn't touch anything on the Configuration page hehe. More like I didn't know what to put in there haha.

Go to License Management to retrieve your Lock Code. You need this to request for a new license key.



3. Request for a new license key that's compatible with Autopass

Now that you have your lock code, it's time to request HP support to regenerate a new license key for you. There are 2 ways to do this, and all of them requires reaching out to tech support. You can chat from someone from the support team (they're available 24/7), or you can file a service request from the dashboard.  So yeah, as much as we wanted to keep the issue completely self-solvable (aka Googlable), updating your license really requires working with someone from the inside.

Login to HP Software Support using this link: https://softwaresupport.hp.com/web/softwaresupport/welcome

Navigate to Dashboards >> Service Request >> Click on Submit New. Then it's just a matter of filling out the form to describe your problem. Let them know that you need to regenerate a new license key for HPE Autopass with the following lock code.

I filed the request with the help of their chat support. In less than a day they responded to me with the new license key. So there, once you get your new license file, go back to the Autopass portal and upload the .dat file containing the key.

After this step you can go ahead and try connecting with the concurrent license server. If it doesn't work, try to open TCP port 5814 on your server machine becuase it may be interfering with your server connection.

4. Finally: connect UFT to concurrent license server

Launch UFT and open the License Wizard (On the toolbar: Help >> License Wizard)


Enter the machine name or IP address of your concurrent license server and put 5814 on the port field. Finally, connect and install the license to be able to continue using UFT.

That's it! Big thanks to Microfocus support for responding quickly to our requests!
Share: