How to click on current date using sikuli?

Asked by Kirankumar deshpande on 2020-02-18

I have to install daily build and would like to click on current date using Sikuli?

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
2020-02-25
Last query:
2020-02-25
Last reply:
2020-02-18
Best Manfred Hampl (m-hampl) said : #1

I see two possibilities:

1. If the position of the current date is always the same on the screen (e.g. 150 pixels from the top, 30 pixels from the left), then you use that position as your click target.
https://sikulix-2014.readthedocs.io/en/latest/region.html#Region.click
click(Location(x,y))
(replace x and y by the desired coordinates)

2. If you know the date format that is used to indicate the current date on the screen, then you can construct a string of today's date in this format and try to find it on the screen.
https://sikulix-2014.readthedocs.io/en/latest/region.html#Region.find
find(time.strftime(%m/%d/%Y))
(adapt the format string as applicable; "import time" probably required at the beginning of the script)

Thanks Manfred Hampl, that solved my question.