What is the Best Way to Reduce Several Plain Spaces

Suppose you have a word file and it is translated to raw an Excel export or Text by a robot system. The file had tabs or indentations and you have put white spaces in those spots.

Now these white spaces need to be reduced into a single space. Here is an example:

From: This…is…a…test.

To: This is a test.

You have a simple way and that is to use Regex.

Here is a Regex operation in the following which eliminates multiple spaces and creates a single space.

<p>myString = Regex.Replace(myString, "\s+", "

How to Compare Date and Time

If you want to compare the Date & Time with Current time while trying to get the record which was opened in the past 24 hours and get the difference is Hrs, you need to do the following:

Convert the 2 dates of each string row to date time format.

Let ‘date1’ & ‘date2’ be the ‘DateTime’ variables for each row activity,

Date1 =Datetime.ParseExact(row(&quot;Date and Time&quot;).ToString.Trim(),&quot;MM/dd/yyyy


Date2=Datetime.ParseExact(row("Updated date and Time").ToString().Trim(),"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture)

Create a variable with ‘Timespan’ type. Let it be ‘TimeDiff’.

Assign TimeDiff=date2- date1

You can get the time difference in days, hours, minutes, seconds… by using TimeDiff.TotalDays, TimeDiff.TotalHours etc.

How to Fetch the Output from Powershell Script and Convert it to String

The issue seems big but the solution is simple. First, when you try to run the script to store it as a string, you get the following error:

‘Check Outlook Failed.’

‘Object reference not set to an instance of an object.’

In order to run the powershell script and bring the output into a string variable, you need to do the following:

 Use “Run power shell script” only and no other PowerShell.

It will work fine with the following script:

$ProcessActive = Get-Process outlook -ErrorAction SilentlyContinue

if ($ProcessActive -eq $null) {

return $a = “False”

} else {

return $a = “True”


How to Fetch Data from the Queue in the ReFramework

When you add data in the Queue and would like to fetch this data in the re-framework, you should do the following:

The process is automatic. The ReFramework gets the data from the Queue. In fact, the Queue is specified in the configuration sheet. The specification is by default in the GetTransactionData.xaml workflow.  

Check in your system to find that a key is used in the dictionary named “OrchestratorQueueName” and you will find the value of that key in the Settings area of the configuration file. This is the file called ReFramework.

How to Read an Attachment in an Email

Reading an attachment in an incoming email needs that you through the UI of the email application. In outlook, go to the email, click the attachment then click open and not save.  If the attachment is in PDF, you can attach the window at the place where PDF opens. Add this filter in the outlook activity: “[Attachment]=’*.pdf’”

To filter the mails with a specific word inside them, you need to search for that word in the attachments one by one. If this is a long and slow process, save the attachments and read the files to find the word.  After this, you can delete them.

How to Select from Strong Array

When you have a String array and you want to select elements till the end and make a returning array or list with those elements, you need to follow the function given below:

You can suppose an array like given here but you want a new array which starts from third element and takes everything:

arrstr = {“1”,“2”,“3”,“4”,“5”,“6”}

arrstr is a array of string variable

arroutput = arrstr.Skip(2)

arroutput is a system.collections.generic.Ienumerable variable

The above process will leave the first two elements from the array and choose all the rest elements.

<Activity mc:Ignorable="sap sap2010 sads" x:Class="Main" mva:VisualBasic.Settings="{x:Null}" sap2010:WorkflowViewState.IdRef="Main_1"
    <sco:Collection x:TypeArguments="x:String">
    <sco:Collection x:TypeArguments="AssemblyReference">
  <Sequence sap2010:WorkflowViewState.IdRef="Sequence_1">
      <Variable x:TypeArguments="s:String[]" Default="[{&quot;one&quot;,&quot;two&quot;,&quot;three&quot;,&quot;four&quot;,&quot;Five&quot;}]" Name="arrOriginal" />
      <Variable x:TypeArguments="s:String[]" Name="arrNew" />
      <Variable x:TypeArguments="x:Int32" Default="2" Name="intStartIndex" />
    <Assign sap2010:WorkflowViewState.IdRef="Assign_2">
        <OutArgument x:TypeArguments="s:String[]">[arrNew]</OutArgument>
        <InArgument x:TypeArguments="s:String[]">[new string(arrOriginal.Length - intStartIndex-1) {}]</InArgument>
    <ui:InvokeCode ContinueOnError="{x:Null}" Code="Array.Copy(arrOriginal,intStartIndex,arrNew, 0,arrOriginal.Length - intStartIndex)" DisplayName="Invoke Code" sap2010:WorkflowViewState.IdRef="InvokeCode_1">
        <InOutArgument x:TypeArguments="s:String[]" x:Key="arrOriginal">[arrOriginal]</InOutArgument>
        <InOutArgument x:TypeArguments="s:String[]" x:Key="arrNew">[arrNew]</InOutArgument>
        <InArgument x:TypeArguments="x:Int32" x:Key="intStartIndex">[intStartIndex]</InArgument>
    <ui:ForEach x:TypeArguments="x:Object" CurrentIndex="{x:Null}" DisplayName="For Each" sap2010:WorkflowViewState.IdRef="ForEach`1_2" Values="[arrNew]">
        <ActivityAction x:TypeArguments="x:Object">
            <DelegateInArgument x:TypeArguments="x:Object" Name="item" />
          <Sequence DisplayName="Body" sap2010:WorkflowViewState.IdRef="Sequence_3">
            <ui:MessageBox Caption="{x:Null}" ChosenButton="{x:Null}" Buttons="Ok" DisplayName="Message Box" sap2010:WorkflowViewState.IdRef="MessageBox_3" Text="[item.ToString]" TopMost="True" />
      <sap2010:ViewStateData Id="Assign_2" sap:VirtualizedContainerService.HintSize="352.666666666667,62" />
      <sap2010:ViewStateData Id="InvokeCode_1" sap:VirtualizedContainerService.HintSize="352.666666666667,164" />
      <sap2010:ViewStateData Id="MessageBox_3" sap:VirtualizedContainerService.HintSize="314,58.6666666666667" />
      <sap2010:ViewStateData Id="Sequence_3" sap:VirtualizedContainerService.HintSize="336,182.666666666667">
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
      <sap2010:ViewStateData Id="ForEach`1_2" sap:VirtualizedContainerService.HintSize="352.666666666667,321.333333333333" />
      <sap2010:ViewStateData Id="Sequence_1" sap:VirtualizedContainerService.HintSize="374.666666666667,751.333333333333">
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
      <sap2010:ViewStateData Id="Main_1" sap:VirtualizedContainerService.HintSize="414.666666666667,831.333333333333" />

How to Add Robot to Trial Version Orchestrator

Have to installed trial version Orchestrator 2018.4.3 for you and tried to add robot option but failed to do so?

In this case, you just do not use the trial version. Better if you use the Community edition. This will allow you to add robot to demo orchestrator in UiPath.4.

The good news is that Orchestrator Community Edition is free of charges and license.  You get the licenses right after you provision your environment.

Use https://platform.uipath.com/ URL and create your work environment. Here you can find the latest version of the orchestrator. Don’t register your device with any enterprise and the edition will work.  

How to Create a Custom Namespace and Import it

If you are a new user of UIPath and face an issue when you try to create a custom namespace and import it, but failing in the process, try the following steps:

Choose c# Class Library

Add references system.activities and system.componentModel

Write the code that you want to execute

Define the input and output parameters

Build your solution

Go to the holding folder and open bin-folder

Open the NuGet explorer and create new library and add the DLL by choosing the add existing option.

Click to write and change the title of the package

Save the file with the desired title and copy the file(.nupckg extension) to the path C:\Users\><user>\AppData\Local\UiPath\app-18.4.0\Packages

Open UiPath and search for the name.

Then, click install. Now, you can execute the code giving the inputs.

How to Download SAP Webservice in UiPath Using SOAP Request Activity

Are you interested to download SAP Webservice in UiPath using SOAP Request activity? Are you are getting the following error?

 “There was an error downloading”

You can try to do the same act with the newest version of the activity package. But, in case here also you face an issue that you are unable to update to version 1.4. and get the following message:

“Unable to resolve dependency ‘Microsoft.CSharp (>=4.3.0)’ “

Add the following feed:

Here it should definitely work but in case (and it is rare) you are still unable to get it, contact the support team here:


How to Save Pages with a Number/Letter from URL

If you are trying to save pages from the link:


And you want to save the filename with the number mentioned in the URL, you can use the following method:

Test (3) (2).xaml (31.7 KB)

For this, if you click the activity and select right side mouse button under input in properties in order to save image, the image is saved as download.jpeg. So, if that makes a perfect saving choice go for it otherwise you can use the above given link: Test (3) (2).xaml (31.7 KB) and it will help you to save the image with the number or letter added in the URL; for example, x.jpeg.