lineCode / libsikuli

c++ library for Sikuli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dependencies
------------

 * opencv2.1

      A computer vision library the Sikuli's visual technology is
      based upon.

Build and install Sikuli Python module
--------------------------------------

Download the source from github

$ git clone git://github.com/doubleshow/libsikuli.git

Run the Python setup script

$ cd sikuli
$ python setup.rb install

Test if it's working by running an example script

$ cd examples/python
$ python mute.rb

You can also try some basic Sikuli commands from Python's interactive shell

$ python
Python 2.7 (r27:82508, Jul  3 2010, 21:12:11) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sikuli import *
>>> click("http://www.sikuli.org/images/apple.png")



Running a script created by the Sikuli IDE
------------------------------------------

1. Use Sikuli-IDE to create a simple script to click on something.

click(IMAGE)

2. Save the script as click.sikuli

When saving the script, the Sikuli IDE will create a new directory
called click.sikuli under the directory you choose to save the
script. Using the console, you can examine the content of the
click.sikuli directory as follows:

$ cd click.sikuli
$ ls

  1281093568271.png  click.html  click.py

click.py is the python script with the one line of code you just
wrote. click.html is a web page letting you visualize the
script. 1281093568271.png is the image you captured and assigned to
the click command as the target. This image's filename is a random
number generated by the IDE and does not have any special
meaning. Don't be surprised if you see a different filename for this
image on your system.

3. To run click.py as a pure Python script. We need to explicitly
import the sikuli module in the script using an import statement. To
do so, open click.py in a text editor and add the following line in
the beginning of the file:

from sikuli import *

Note that when running the script, Sikuli IDE automatically adds the
import statement to the script and that's why we don't need to bother
adding the import statement.

After adding the import statement, the modified script should look
like:

from sikuli import * 
click("1281093568271.png")

4. In the console, run the script as follows:

$ python click.py



About

c++ library for Sikuli


Languages

Language:C++ 80.6%Language:Java 7.6%Language:C 7.0%Language:JavaScript 2.8%Language:Python 1.4%Language:HTML 0.5%Language:CMake 0.1%Language:Shell 0.0%Language:CSS 0.0%Language:Ruby 0.0%