Your first script
This guide walks you through the canonical OculiX workflow: see → match → act. By the end, you’ll have a script that finds a button on your screen by its image and clicks it.
1. Capture what you want to click
Section titled “1. Capture what you want to click”- Launch the OculiX IDE.
- Click New Script (or File → New). The IDE creates a
.sikulibundle — a folder that holds your script and its images. - Position your target on screen — for this example, open your file manager and pick any button visible (e.g. the Save button in a text editor).
- In the IDE toolbar, click the Take Screenshot camera icon. The screen freezes, your cursor turns into crosshairs.
- Drag a tight rectangle around your target. Release.
OculiX inserts the captured image into the script as a clickable thumbnail:
click("save_button.png")The image is saved inside your .sikuli folder. You can rename, replace, or reuse it across scripts.
2. Run it
Section titled “2. Run it”Press ▶ Run (or Cmd/Ctrl + R). OculiX:
- Takes a fresh screenshot of the current screen.
- Looks for
save_button.pnganywhere on it. - Moves the mouse to the match and clicks.
If it finds nothing, you’ll see FindFailed in the console — usually because the target moved, was hidden, or your similarity threshold is too strict.
3. Build something useful
Section titled “3. Build something useful”Here’s a one-screen script that exports a daily report:
from sikuli import *
# Open the app via its taskbar/dock icon (image captured beforehand)click("app_icon.png")wait("app_main_window.png", 10) # wait up to 10 s for the main window
# Walk through the export menuclick("file_menu.png")click("export_to_csv.png")wait("save_dialog.png", 5)
# Type the file name in the focused fieldtype("filename_field.png", "report_" + getDate() + ".csv")click("save_button.png")
# Wait for the confirmation toast before closingwaitVanish("loading_spinner.png", 30)popup("Done!")Three things to notice:
- No selectors. OculiX never asked you what the button’s CSS class or accessibility ID is.
wait()andwaitVanish()are how you sync with the application: wait for something to appear (or disappear) before continuing.- Standard Python. The
+ getDate()part is plain Python — anything you can do in Jython (Python 2.7 syntax, full JVM access) you can do here.
4. Tune similarity when the match is too strict
Section titled “4. Tune similarity when the match is too strict”By default OculiX requires 70 % similarity. For UIs with anti-aliasing, transparency, or theme changes, you may want to loosen that:
click(Pattern("save_button.png").similar(0.65))Or globally for the whole script:
Settings.MinSimilarity = 0.655. Save and re-run
Section titled “5. Save and re-run”Hit Save. Your script bundle (my-export.sikuli) is a regular folder you can:
- Version-control with Git
- Share with a teammate (zip the folder, that’s it)
- Schedule with cron / Task Scheduler (
java -jar oculixide.jar -l my-export.sikuli -e)
What to read next
Section titled “What to read next”- Visual matching in depth —
Region,Pattern,Match, similarity, anchors - Read text on screen with OCR — find a button by its label, not its image
- Tour the IDE — Workspace, Modern Recorder, Welcome tab