← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #198111]: Is it possible to call a Windows DLL from an extension?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- My goal is to add commands available to a Sikuli script 
Sikuli does not have "commands". This is only a trick: the Screen and Region methods are inserted into the global names, so that the methods like click(), find() and others are redirected to the constant object reference SCREEN, which is initialized as Screen(0).
So behind the curtain a click(some_image) is really a SCREEN.click(some_image).

So if you want to add something to Sikuli, either on the Python/Jython
or Java level, you just have to set up the respective modules/classes
and make them available in sys.path (Python) or class path (Jython
and/or Java) and they are useable in Sikuli scripts.

The magic with "Sikuli extensions" only is, that if you set up a .jar
file with the documented structure (Jython wrapper for Java stuff), you
can store the .jar in the extensions folder and use the load() method to
activate it, so you can use import.

In all these cases, the user has to say (on the Jython Sikuli script
level):

from the_other_stuff import *
w = Wrapper(init1, init2, ...)
x = w.method1(parm1, parm2, parm10 = "whatever")

In this case a module named the_other_stuff.py (or
the_other_stuff.sikuli) must be found using sys.path

Or if you want to have "commands" like these from Sikuli, you have to
put the same "magic" as Sikuli into the __init__.py for your
the_other_stuff.

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