Opening Applications & Files Using Sikuli

sikuli course

Since Sikuli is a python interpreter, python modules can be used to open programs and files. Sikuli does come with a command that opens general programs such as the command. PATH) would open the specified file path. Make sure to wrap the path with double quotes and if you include spaces, add single quotes around the double quotes like this:‘”FILE PATH”‘). When referencing a file or path, make sure to include double backslashes:“FILE PATH\\app.exe”) or”FILE PATH\app.exe”). The ‘r’ in front of the path converts the statement into a string.


Another useful command is App.focus. When you are running a sikuli script, you always want it to flip between applications or files. Using App.focus() will switch the main window so Sikuli can run the code on the correct application. App.focus() uses a PID identifier. This identifier or name can be found in the task manager.

App.focus(“excel”) would bring Microsoft excel to the front.

App.focus(“iexplore”) would bring Internet Explorer to the front. 

What if you have multiple instances of the same application open. App.focus also solves for this by allowing indexing. If you have multiple excel files open, Sikuli identifies them by indexes from 0 to # of files open.

App.focus(“excel”[,2]) would flip to the third excel file instance. 


Similar to the, App.close() does the opposite. It works the same way by referencing the path.





Related Articles

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…


Your email address will not be published. Required fields are marked *