Sikulix Automation is a simple RPA (robotic process automation) program which interacts with UI by clicking at specified elements on a screen and typing texts.
This program is written in Java and is using SikuliX library.
Program is reading configuration from config.json
file by default.
You may specify alternate configuration file as first argument.
java -jar sikulix-automation.jar config.json
Create JSON file config.json
and execute program with java -jar
command.
Scenario section defines base path for image files and array of steps to take.
{
"verbose": "true",
"scenario": {
"name": "Hello",
"steps": [
{
"print": "Hello, World!"
},
{
"wait": "3",
"print": "Goodbye, cruel world."
},
{
"wait": "3"
}
]
}
}
Above example will simply print text with little delay.
Playing scenario Hello
Hello, World!
Goodbye, cruel world.
More complex example is on the way.
{
"verbose": "true",
"scenario": {
"path": "C:/EXAMPLE/Scenario/",
"steps": [
{
"click": "windows_11_start.png"
},
{
"mouse": "RIGHT"
},
{
"wait": "1.5"
},
{
"click": "windows_11_type_search.png"
},
{
"wait": "1.5"
},
{
"type": "notepad"
},
{
"wait": "1.5"
},
{
"click": "search_notepad.png"
},
{
"wait": "1.5"
},
{
"message": "Hello, World"
},
{}
]
}
}
Alternatively scenario file can be defined in separate scenario.json
file.
{
"play": "scenario.json"
}
{
"scenario": {
"steps": [
{
"print": "Hello, World."
}
]
}
}
The same scenario can be written in script file.
PRINT Hello, World.
Scenario file can be set without file extension, program will try to find valid json or script file.
{
"play": "scenario"
}
Images used to recognize UI elements to click in should be located in current working directory or specified by path
in scenario
section.
Every step may contain one or more elements from the list below.
- label
- path
- delay
- wait
- similarity
- mouse
- find
- click
- popup
- type
- message
- execute
- when
- then
- jump
- pause
Mark location with name.
{
"label": "1000"
}
Set path for images.
{
"path": "images"
}
Set delay for each step.
{
"delay": "3.0"
}
Set wait time when finding images.
{
"wait": "1.5"
}
Set minimum similarity level.
{
"similarity": "0.7"
}
Click inside UI element specified by image.
{
"click": "windows_start.png"
}
Perform right click on UI element specified by image.
{
"popup": "tray_battery.png"
}
Wait for specified time in seconds.
{
"wait": "1.5"
}
Type text.
{
"text": "notepad"
}
Click down and up mouse button. Possible values are: "LEFT", "RIGHT", "MIDDLE".
{
"mouse": "RIGHT"
}
Display message dialog.
{
"message": "Hello, World."
}
Print text to standard output.
{
"print": "Hello, World."
}
Instead of using scenario in JSON it is possible to create script file and point to it ore more than one in config.json
.
{
"play": "scenario"
}
DELAY 0.5
LABEL 10
PATH C:/EXAMPLE/Scenario/
CLICK windows_11_start.png
MOUSE RIGHT
WAIT 0.5
MOUSE UP
WAIT 1.5
CLICK windows_11_type_search.png
WAIT 1.5
TYPE notepad
WAIT 1.5
CLICK search_notepad.png
WAIT 1.5
MESSAGE "Hello, World"
JUMP 10
Use Apache Maven to build project.
mvn -T 1C package