This video is of a stress test I built for Sikuli, a GUI scripting engine. It uses CV libraries to identify and interact with visual elements on your desktop. I've talked about it, but I haven't shown it, as I haven't had A means to. I'm now running Windows 7 on a fast computer, and I have Microsoft Expression Encoder installed. So, likely I'll have more screenvids in the future.
As you'll see in the code, I'm writing in modules. The first code I show is meant to provide functions for the second code I show.
checking_test
- from sikuli.Sikuli import *
- def clickAllLikeThis( image ):
- for i in findAll(image):
- click(i)
- def checkAll():
- a_unchecked = findAll(unchecked)
- for u in a_unchecked:
- click(u)
- def uncheckAll():
- a_checked = findAll(checked)
- for c in a_checked:
- click(c)
module_test
- # works on all platforms
- import sys
- import os
- # get the directory containing your running .sikuli
- myPath = os.path.dirname(getBundlePath())
- if not myPath in sys.path: sys.path.append(myPath)
- import checking_test
- unchecked = "1295894889335.png"
- checked = "1295894985817.png"
- popup( "Checking all unchecked" )
- checking_test.clickAllLikeThis( unchecked )
- popup("Unchecking all Checked")
- checking_test.clickAllLikeThis( checked )
- #clickAllLikeThis( checkbox )
The PNG strings are converted in the Sikuli editor, which has screengrab capabilities and converts the file name to the image.
I'm very glad that I'm able to separate functions into separate modules. I'm somewhat disturbed that I'm not getting 100% coverage from the elements I'm trying to get clicked. But it's a neat thing nonetheless.
No comments:
Post a Comment