Thursday, 14 June 2018

Story of a tomato seller | How to stay focused on crisis | Motivation


This video shows an interesting story of a tomato seller | How to stay focused on crisis.



A jobless man applied for the position of 'office boy' at Microsoft. The HR manager interviewed him, then gave him a test: clean the floor. The man passed the test with flying colors. "You are hired," HR manager informed the applicant, "give me your e-mail address, and I'll send you the application for employment, as well as the date you should report for work. The man replied " I don't have a computer, or an email!" "I'm sorry," said the HR manager. "If you don't have an email, that means you do not exist. And we cannot hire persons who do not exist." The man was very disappointed. He didn't know what to do. He only had $10 with him. Once that is spent, he won't have any money to buy any food. He went to the supermarket and bought a crate of tomatoes with his $10. He went from door to door and sold the tomatoes in less than two hours. He doubled his money. He repeated the operation three times, and returned home with $60. He realized that he can survive this way. He started to go everyday earlier, and return late. He doubled or tripled his money every day. Soon, he bought a cart, then a truck. In a very short time, he had his own fleet of delivery vehicles. Five years later, the man became one of the biggest food retailers in the U. S. He started to plan his family's future, and decided to have a life insurance. He called an insurance broker, and chose a protection plan. At the end of the conversation, the broker asked him for his email address. The man replied: ' I don't have an email.' The broker was dumbfounded. "You don't have an email, and yet have succeeded in building an empire. Can you imagine what you could have been if you had an email?," he exclaimed. The man thought for a while, and replied, "an office boy at Microsoft!" If you just lost your Job or Just failed an Interview Don't worry be Optimistic..... Good days are on the way and something better is reserved for you. All you have to do is Explore, Innovate and Explore !!!

Wednesday, 16 May 2018

Logic behind Drawing Robot | How to make a robot which draws picture | Robotics Tricks

Hi Guys,

I posted a video before showing how you can use a robot to draw a picture.

The whole purpose that video was just to showcase the power of robotics and how UiPath robot can control the mouse even at pixel level.

The response to that video was really great and lot of people had requested me to explain the logic behind the painter robot.In this post, I wish to show step by step analysis of the drawing robot workflow.

Below video explains the logic in detail:




Let's see how this idea came to my mind.

Even though I'm not an active social media person, I use LinkedIn couple of hours a week to get updated on the technology news. Couple of months back, A LinkedIn post made me surprised. It was the post of Alekh Barli, CEO of INTELLIBOT.IO where he showcased the capability of Intellibot Robot to control the mouse at pixel level by drawing a picture in MS Paint.

https://www.linkedin.com/feed/update/urn:li:activity:6384009728531496960/

His post reminded me what I had done 10 years back when I was exploring VBA in Excel. At that time, I did a fun project to map a picture in Excel by coloring the Excel cells using VBA.

In my Excel image mapping project, I used VBA code to read the XY cordinates and RGB color combination of each pixel of a picture into an array, then I colored each cell in a worksheet using the array as if it is a pixel of a picture. Then if you reduce the zooming of the worksheet to 10%, it will exactly looks like the same picture.

This made me thinking that why can't I upgrade my old project to a robot, so I can showcase the power of robots while I'm presenting to my client or in my training sessions.

In fact, UiPath also uses the Microsoft .NET background, So it should be an easy task to upgrade my VBA project to UiPath.

The I assigned 2 hours to do this task.

But when it comes to reality, there were few constraints:

> I was using Excel, here I need to use Microsoft Paint

> I was reading the actual colors of the picture in my old project and making the same color in Excel cell. Since I'm using MS Paint to draw the picture, there is NO easy shortcut available to change the color of the brush everytime when the color changes. If I use the UI elements in Paint to change the color on each color, my robot will take a day to paint a picture. So I decided to read only the cordinates of the darker shades of the picture and map only those dots in Paint to imitate the picture.

The outcome is not so fantastic like my old project, but still it's enough to showcase the power of the UiPath robot.

Now let us go to the actual logic of the robot workflow.


Before starting, you should know how a computer saves a picture. In a common uncompressed bitmap, the image is stored as a series of dots which is also known as pixels. Each pixel is a very tiny dot or a square and a color is assigned to each pixel. Then the pixels are arranged in a pattern to form an image. You can see the pixels easily by opening a picture in Paintbrush and zoom In. So each pixel has some properties like it's position on the image, it is saved as XY scatter points. Then each pixel will have it's color. In easy way, you can see each color is a combination of Red, Green and Blue which varies from zero to 255.

In short, if you know the XY cordinates of each pixel in an image and also the color of each pixel, you can easily recreate an image.

In our project, you have to write a code to get the cordinates only since we are not going to use the color. Then write a code to mark each cordinate in Paintbrush.

Enough of gyan. Now let us look into the UiPath workflow.


You can download our project workflow from this link http://zipansion.com/hA5S


In first step, I inserted an activity to ask the user to select the picture he wished to sketch. Currently, I put a filter for only J P G files. You can change the filter as you wish. But make sure that the image you select is not a compressed bitmap.
Then the file path is saved to a string variable.

Our next step is to read the cordinates of the selected image. I create a small module for doing this task. I pass the image file path into this module and the module will return a Datatable with the cordinates to be marked.

Now let us look how this module works .

In first, I created a datatable object and created two columns for saving X and Y cordinate values.

Then we create a bitmap object using the image file we selected.

Then we need to find the height and width of the image and saves into variables.

Next, create nested loops to loop through each pixels of the image.

Within the loop, on each pixel, we use Get Pixel method to find the color of that pixel.

The color is assigned to a color variable.

The color variable has the properties to find its RED, Green and Blue of the color.

As we told earlier, RGB varies from zero to 255, we are finding only the darker shades of the picture. So we check if the pixel's Red, Green and Blue are less than 20, which are more darker. Then save the cordinates to a new row in the datatable.

If you want to get more pixel quality to your picture, you can increase the color range from 20, but the robot will take more time to finish the drawing since it will increase the number of pixels to be marked.

When robot finishes the loops, you have a datatable with all the cordinates to be marked.

Now let us go back to the main workflow.

In next step, I used Open application activity to open Paintbrush.

the next step is to change the color of the brush, if you want the robot to sketch the entire picture in a specific color.

In the next step, we have a loop to go through each row in our datatable.

Inside the loop, we use click activity to mark each pixel in paintbrush by changing X and Y values in the cursor position properties.

When the loop finishes, your robot will finish marking of all the pixels of your image.
You can download the workflow from the link below if you wish to refer. But I would suggest you to understand the logic and try it yourself.

Thanks for reading my post how you can use a UiPath robot to draw a picture.

Saturday, 5 May 2018

Trick to stop UiPath Robot while running | Break the robot in middle | shortcut to stop UiPath robot

Hi Guys,

When you are doing the test runs of your robots during development, it's really important to know various methods to stop the robot in middle when you feel like there is something going on wrong.

It helps you to save your testing time and also to stop the robot in making big mistakes which cannot be reverted.

Let's see what all the options UiPath provides to break a running robot.

I explained this topic in short video below.





There are 4 ways to do it.


  • First method is by clicking on the stop button available at the task bar of your desktop which is available when you hover your mouse on the uipath studio. You can also click on the close button of the robot executor which appears next to your Uipath studio.


  • Second method is by pressing F12 from U i Path studio. You have to activate the Uipath studio and press F12 button.You can also click on the stop button available in U i path studio.


The first and second options are provided by U i Path themselves.

Sometimes you work on projects which has lot of activities including clicks or typetext where robot takes the control of your mouse quite often.

On such cases, you would not get enough time to click on the stop button or to activate the uipath studio to press F12.

Then you have to find your own ways to stop the robot.


  • One good trick to stop a robot is by closing the active window on which robot is currently processing. You just need to press ALT + F4 to close the current window.

The robot will stop processing as the robot is not able to find the objects which are used in the current window.

But this method also not so great.

Sometimes your application would not stop by pressing the shortcut, it show another pop ups.

Also, if you are stopping the robot to review the progress which has gained in the current window, you cannot review the application.

So all three tricks which we discussed are not quite successful on various scenarios.

As you might be thinking, it would be great to have a global shortcut which can be used to stop the robot.

I found a trick to get this done.

In this method, we will create a script to stop the robot and assign a shortcut key to run the script 

whenever you want to stop the robot.



You can set up this by doing simple 5 steps.

1. Open Notepad, then enter the script which is shown in the video.

2. Save the notepad file to your drive with an extension .bat

Click here to download the script file if you need

3. Open the folder where you have saved your script file, then create a shortcut to your desktop.

4. Goto desktop, then open properties of your shortcut file

5. Assign a shortcut key and press apply.

Now your hotkey is ready. You can stop your robot by pressing this hotkey.

But remember to assign a shortcut key which is not used regularly in other applications, otherwise your script will not run when your press the hotkey.