Extracting availability from calendar image

Asked by tomdkd

Hi,

I'm trying to understand how to leverage Sikulix to extract calendar's availability from an app (no API, so trying to be creative).

Here is an example of the app with the calendar view: https://sites.google.com/site/opendentalproject/_/rsrc/1379313660454/module/appointments/1.png.1379313660364.png

I understand to how to open the App, click around and do click operation but how do I use OCR to find the available spots on this calendar view.

Any pointers would be appreciated.

Thanks in Advance

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Mike (maestro+++) said :
#1

SikuliX looks for images which could be anywhere. You are not really looking for images but rather the absence of something ie text and coloured backgrounds.

Your application looks entirely fixed so you could navigate it purely by location. It won't be trivial because you have a lot of fields/regions that are in play.

It seems to me that the critical feature is the background colour of the slot you are navigating. You are trying to identify which slots are white (free) rather than coloured (not free).

Unfortunately SikuliX doesn't seem to have an ability to report a location's RGB numbers.

You might want to look at pyautogui. It is somewhat like SikuliX except it can only handle pixel-perfect 100% image matches, but it does let you pick up the colour so you could then deduce which slots were booked and which were free.

Revision history for this message
RaiMan (raimund-hocke) said :
#2

@Mike
There is indeed a color pick feature:
Location::getColor()

which returns a Java Color object you can play with and create your own suitable functions.

example for IDE:
color = selectRegion().getCenter().getColor()
print color
print color.getRed(), color.getGreen(), color.getBlue()

lets you select a point on the screen and report the RGB color values.

Revision history for this message
Mike (maestro+++) said :
#3

@ RaiMan

Just checked that and - yes - it gives you numbers for a location. What more could you wish for?

I suggest it would be good to add that to the documentation. And the IDE does not currently colour the method names in the way it normally does.

The ability to capture the colour of a location is handy for running scripts which are location-driven. A lot of automation cases involve screens that can be assumed to be static/entirely predictable. You can therefore build a map of where every field of interest is and move directly to wherever you need to go, rather than try to match images. In such situations you can just plough on regardless and wait for a crash, or you can have some sort of checking regime. You could write some sort of validation program that compares images with map locations every morning or whatever but an economic alternative is to check the colour of a click point before you click it.

So I think this is a very useful SikuliX feature.

As for the original question, I would suggest tomdkd builds a map of all the 'slots' like 9:20, Dr Miller etc and then runs through them in sequence noting where the white slots start and where they finish, indicating the periods that are free for appointments. I notice one of the blocks as a sort of X through it so maybe things are more complicated. Maybe this is a case of you can automate anything with SikuliiX but it may take an awful lot of work.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

@Mike
--- The ability to capture the colour of a location is handy ...
I agree.
I will add it to the docs.
About method name colouring: there are indeed some more methods to add ;-)

Revision history for this message
RaiMan (raimund-hocke) said :
#5

from Mike:

As for the original question, I would suggest tomdkd builds a map of all the 'slots' like 9:20, Dr Miller etc and then runs through them in sequence noting where the white slots start and where they finish, indicating the periods that are free for appointments. I notice one of the blocks as a sort of X through it so maybe things are more complicated. Maybe this is a case of you can automate anything with SikuliiX but it may take an awful lot of work.

... a realistic insight

Can you help with this problem?

Provide an answer of your own, or ask tomdkd for more information if necessary.

To post a message you must log in.