On Aug 28, 11:15 am, "Edward K. Ream" <[email protected]> wrote:
> Another idea: integrate Leo, Sikuli and Wink.
Here is my first significant Sikuli script. It opens and closes the
Leo node called @slideshow html/installation.
m = find( [...@slideshow html/installation]] )
m2 = m.left( [[open triangle]] )
try:
obox = m2.find( [[close triangle]] )
except FindFailed:
obox = None
try:
cbox = m2.find( )
except FindFailed:
cbox = None
if obox and cbox:
if obox.score >= cbox.score: box = obox
else: box = cbox
else:
box = cbox or obox
if box:
click(box)
mouseMove(box.left())
Notes:
1. The key "trick" is that one can restrict a search to region "m" by
doing m.find.
2. The stuff enclosed in [[ ]] brackets are really screenshots.
3. It's important to restrict comparisons between screenshots to the
smallest possible units, otherwise
the comparisons between screenshot scores will be unreliable.
In other words, the 'm' area must *not* include the open/close
triangle.
Instead, we use m.left() to define the area to the left of the 'm'
area.
4. This script will only work if Leo is visible on the screen.
Otherwise the first find will fail.
There are ways to bring windows to the front, but I haven't played
with them successfully yet.
5. The mouseMove after the click(box) is necessary. Otherwise the
cursor interferes with
the find of obox or cbox.
6. This is real Jython code. There is a box at the bottom for print
statements. The line::
import sys; print(sys.version)
produces::
2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)]
Sikuli is very cool, but very slow. The script above, simple though
it is, takes several seconds.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.