sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #43553
Re: [Question #656054]: 2 dimensional virtual slider
Question #656054 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/656054
Status: Open => Answered
Manfred Hampl proposed the following answer:
Developing such program without having access to the real system is almost impossible.
I am trying to outline the skeleton, but cannot provide a final solution.
You need:
a screenshot of the target marker ("marker,png")
the x-y-position of the center of the crosshair
the x-y-positions of the (center of the) up / down / right / left arrow buttons, eventually also the position of the button to switch from large to small movement.
the coordinates of the region with the crosshair.
the (average) amount of changing the x- respectively y-coordinates with one click on the arrow buttons in large and small movement
Now two proposals:
(eventually: switch to large step movement)
Search for the marker in the region of the crosshair
(if not found - abort processing)
calculate the difference in x coordinates between the center of the crosshair and the center of the marker position identified in the previous step
divide by the average distance of a large step
if positive:
loop this many times to press the right button, (probably needing wait statements between)
else if negative:
loop this many times to press the left button, (probably needing wait statements between)
(eventually: switch to small step and repeat from "search the marker" with small steps)
Do more or less the same in the y-direction
++++++++
Or another possibility with permanent observation of the marker
movement:
Search for the marker in the region of the crosshair
(if not found - abort processing)
calculate the difference in x coordinates between the center of the crosshair and the center of the marker position identified in the previous step
switch to large step
loop until absolute value of difference between marker's x-position and center of crosshair is smaller than tolerance
if difference >= average large step
press left
else if difference >= average small step
switch to small step
press left
else if difference <= -(average small step)
press right
else if difference <= -(average small step)
switch to small step
press right
search for marker again
calculate the difference in x coordinates between the center of the crosshair and the center of the new marker position
calculate the difference in y coordinates between the center of the crosshair and the center of the latest marker position
switch to large step
do the loop as above for the alignment action in the other direction
Remark: the tolerance for the loop criterion should not be smaller than
about two thirds of a small movement. Otherwise the result might be an
oscillation between two positions slightly off the center.
Also here you might need to add wait statements after the button presses
to ensure that the alignment action has already been completed.
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.