Modules in Sikuli

Sikuli Modules

While Sikuli by itself is capable of great automation, using modules can make it ten times more resourceful. Modules are python packages can be utilized in Sikuli due to the fact that Sikuli is a python interpreter capable of using imported functions in the code editor. Most of the popular python modules used are pandas, numpy, xlrd, and xlwt. While Sikuli has built-in functions to recognize images on the screen, these other modules can be used in another way. Pandas, for example, can be used to manipulate data from multiple sources such as databases, excel files, and websites. The advantage of having modules in our code is speed and reliability. While Sikuli’s click() and type() commands can also do this, there is always a need for improvement in processes.

If you have Sikuli installed, there are several modules that come preinstalled that can be used in Sikuli. They are located in the AppData folder.

sikuli modules

All the modules listed above can be imported in your Sikuli script. The great thing about SikuliX is that modules can easily be imported in Sikuli using the import function.

For example, if we wanted to read excel in a snap of a second, then we go use the “xlrd” module.

To import the xlrd module in Sikuli, we have to put this line of code at the top of the script:

import xlrd

import xlwt

Now, we can use the functions built into xlrd such as the read() function. XLWT is used to write into excel in the background.

You might ask what the cons are for reading data using the xlrd module. XLRD reads an excel file and stores into memory, so if you have low RAM, this will result in either memory overload or the script crashing due to the fact that there is too much data being loaded with too little storage space.

Install Modules in Sikuli

There are popular python modules or packages that do not come preinstalled with SikuliX. In general, pip install can be used to install modules in the Python folder. These modules can then be copied over into the SikuliX Lib folder where it can then be imported into Sikuli to use.

If you receiving java errors when importing Sikuli modules that are moved into the Sikuli folder, try referencing the folder path then the actual package name after.

From FolderName Import ModuleName

It is very easy to install and import modules into the Sikuli client. Think about all the different modules that can be used for automation, visualization, and machine learning in the Digital Finance field. There is no limit to what you can create when working with the vast number of manual processes that exist in companies today.

 

Related Articles