← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #248709]: Need help to manipulate Date picker

 

Question #248709 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/248709

RaiMan proposed the following answer:
something like that

head = find("1400150215933.png")
picker = head.below(135) # height of picker area
# correction to get the correct picker area, if dimension of head image does not fit correctly
picker.x -= 1
picker.w += 2
picker.y += 0

picker.highlight(1)
prh = int(picker.h / 5) # row height
pcw = int(picker.w / 7) # colomn width

def pickerSlot(n): # get the slot in sequence 1 to 5*7 = 35
    if n < 1: n = 0
    if n > 35: n = 35
    row = int((n -1) / 7)
    col = (n-1) % 7
    return Region(picker.x + col * pcw, picker.y + row * prh, pcw, prh)

pickerSlot(1).highlight(1)
pickerSlot(7).highlight(1)
pickerSlot(8).highlight(1)
pickerSlot(17).highlight(1)
pickerSlot(35).highlight(1)

def pickerDay(n, off = 0): # get the day 1 to 31, off is the number of days of last month in 1st week
    if off < 0: off = 0
    if off > 7: off = 7
    return pickerSlot(n + off)

# Picker for May 2014 has 4 days of April in 1st week 
pickerDay(15, 4).highlight(1)
pickerDay(31, 4).highlight(1)

here you can download a zip of the real script:
https://dl.dropboxusercontent.com/u/42895525/datepicker.sikuli.zip

To get something like the weekday of some date, we have the respective
modules in Python (see
https://docs.python.org/2.6/library/datatypes.html)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.