Normally such a feat requires running a series of commands and then somehow attaching them together so that a command is aware of the output of the previous command and whether it completed successfully or not. Obviously you have to be well versed with the command line and/or a scripting language to write an efficient script easily.
Sikuli takes all the pain and learning away from creating an automation script. If you can take screenshots, then you can script with Sikuli as well.
First off let’s head over and download Sikuli. Sikuli runs on the Java VM, so it is available for Windows, Mac and Linux. An installer and a portable version are available for Windows. Once downloaded fire up the executable and you are greeted by what is called the Sikuli IDE. This is where you will create your scripts. Allow me to demonstrate with the help of an example:
Lets say you want to switch on your Internet connection at a said time. Here is the Sikuli script you will write for such an action:
Now that is not as complicated as it seems. You just have to tell Sikuli where to click and what and where to type.
To let Sikuli know that you want to click you write “click” and enclose a screenshot of where you want to click within a pair of braces. You don’t even have to crop and position the screenshot, Sikuli does that for you. Just type “click(” and then press SHIFT + ALT + 2 and Sikuli lets you capture a screenshot. Be concise, while including a bit of context within your screenshot. Position the crosshair roughly where you want to click and make sure that your screenshot is fairly unambiguous.
When you are done, Sikuli will place the screenshot in the IDE and you can close off the brace, getting something like the following:
That’s it, you are done. Repeat the same for the other steps you wish to execute using Sikuli. Use the type command to let Sikuli know what you wish to type. A complete list of such commands is available here.
Here is a video demo to further help you along in creating your first Sikuli automation script.
So far so good, we have seen how easy it is to create automation scripts using Sikuli. We have achieved fairly straightforward tasks in the example above but what if you want to do a bit more? For the programmer folks out there (or if you know the basics at least) Sikuli has much more to offer. You can use the screenshots as variables within programming constructs like loops, conditional statements and the likes.
The syntax resembles closely with Python (not a surprise since Sikuli was written in Jython) and with a little effort you can actually do fairly complicated tasks in a snap. The Sikuli site hosts a number of such clever tutorials. There are scripts that can check if a particular friend has posted a status update on Facebook and others that can star all mail conversations in Gmail. Definitely worth a look for learning some clever tricks that you can use with Sikuli.
All in all, Sikuli takes a revolutionary approach to automation scripting and is excellent if you want to get started with scripting and automating tasks on your computer. That said, there are one or two issues that you have to keep in mind while scripting with Sikuli. Since most of the work is being done via image recognition, anything that changes the appearance of the areas you included in the screenshot is bound to break down your script. These would include things like changes in themes, icons and the likes.
Have you tried anything as amazing as Sikuli? Let us know about your experience in the comments.
More articles about: