0

Calendar Image]

I was trying to grab a website calendar from UiPath. But when I use the Find OCR Text Position or Click OCR text activity in the UiPath Software, it will not give me the exact date that I want to select.

I want to do one thing only: I need to determine today's date, select the date, and press OK.

Calendar with Date Selected

I figured out how to calculate today's date:

Date/Time Selector

But now I only have to do, is selecting numbers, Please help me to figure this out. Thanks in advance.

Wolfgang Radl
  • 2,319
  • 2
  • 17
  • 22
  • 1
    Welcome to StackOverflow - for guidance on asking questions please click here - https://stackoverflow.com/help/how-to-ask. I think you should clarify you question some more because it's hard to understand what you are asking right now. – tremor Mar 18 '19 at 16:32
  • Please include more information on what tool you are using (and include the steps you have taken) and present your current source code (if there is any) in order for the community to help you. – Miyuru Sagarage Mar 18 '19 at 17:51

2 Answers2

1

Since we don't know much about the front-end framework you're planning to use, here's a generic approach using a relative selector. Note that I hard-coded the day (15), and I didn't check whether the correct month or year is displayed, but this should at least get you started.

My approach uses a simple click activity with the variable day being part of the selector. There's another click activity associated with opening the picker in the first place, but as said - this is just related to the front-end framework.

enter image description here

Wolfgang Radl
  • 2,319
  • 2
  • 17
  • 22
0

It looks like DateTime_Today is a DateTime type variable in your screenshot, which has a very useful ToString method see documentation on it here: https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tostring?view=netframework-4.7.2 which will allow you to extract the number that you are looking for.

You would need to create a string variable and assign the value to DateTime_Today.ToString("dd") to get only the day of the month.

The issue with this approach, however, is then creating the image for the OCR to look for in the calendar. I think a more reliable way of approaching this issue would be to determine what date is selected by default when clicked and then sending some combination of hotkeys such as tab and the directional keys to get to the date which is required for the automation. A get text or get attribute activity might also help determine what date is currently selected, so you would then know how many boxes will need to be traversed to get the required selection.

If you are still having issues please provide a link to the page which you are trying to automate as well as some (sanitized) code snippets containing what you have already tried and we will be able to assist you further. Cheers!